feat(planning): EYT-120 transport foundation by DYAI2025 · Pull Request #103 · DYAI2025/EasyTree · GitHub
Skip to content

feat(planning): EYT-120 transport foundation - #103

Merged
DYAI2025 merged 2 commits into
masterfrom
feat/eyt-120-transport-foundation
Sep 7, 2026
Merged

DYAI2025 merged 2 commits into
masterfrom
feat/eyt-120-transport-foundation

Conversation

@DYAI2025

@DYAI2025 DYAI2025 commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

EYT-120 technical precursor

This PR introduces only the transport/domain-contract foundation required by the later EYT-120 Engagement Contract.

The change is limited to packages/contracts/**: deterministic LocalDate validation, a minimal stable WorksiteDay identity/revision DTO, public exports, and direct tests.

Summary by Sourcery

Establish the transport and domain-contract foundation for worksite-day planning.

New Features:

  • Add a validated LocalDate contract and a minimal WorksiteDay DTO covering stable identity, revision configuration, worksite, and date.

Enhancements:

  • Expose the new planning and primitive contracts through the public package API.

Tests:

  • Add direct validation and public-surface tests for LocalDate and WorksiteDay contracts.

@sourcery-ai

sourcery-ai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="packages/contracts/src/primitives.ts" line_range="59" />
<code_context>
+    const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
+    if (match === null) return false;
+
+    const year = Number(match[1]);
+    const month = Number(match[2]);
+    const day = Number(match[3]);
+    const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
+    const daysPerMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+
+    return month >= 1 && month <= 12 && day >= 1 && day <= (daysPerMonth[month - 1] ?? 0);
+  }, "Kein realer Kalendertag im gregorianischen Kalender")
+  .describe("Lokaler Kalendertag im Format 2026-09-07 — ohne Uhrzeit, ohne Zone");
</code_context>
<issue_to_address>
**issue (bug_risk):** `LocalDateSchema` accepts `0000-02-29` because the leap-year calculation treats year zero as divisible by 400, even though the domain's local-date conversion explicitly rejects years below 1 and the documented Gregorian calendar has no year zero.

**Triggers:** When a client sends a four-digit local date with year `0000`.

**Suggested fix:** Reject years below 1 before applying the leap-year calculation, for example with `if (year < 1) return false;`.

```suggestion
    if (year < 1) return false;
    const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
```
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: packages/contracts/src/primitives.ts:59


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread packages/contracts/src/primitives.ts

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@DYAI2025
DYAI2025 merged commit 20ac8ae into master Sep 7, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants