feat(planning): EYT-120 transport foundation - #103
Merged
Merged
Conversation
Reviewer's GuideThis precursor extends only the contracts package with a publicly exported Gregorian LocalDate primitive and a strict, minimal WorksiteDay DTO that separates stable identity from revision-bound configuration, intentionally adds no route, persistence, migration, UI, or working-time materialization. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Enhancements:
Tests: