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

Reviewer's Guide

This 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

Change Details Files
Adds a strict, deterministic local-date primitive for transport validation.
  • Validates canonical YYYY-MM-DD strings against Gregorian calendar rules, including leap years.
  • Exports the schema and inferred LocalDate type publicly.
  • Adds valid, invalid, and leap-year coverage.
packages/contracts/src/primitives.ts
packages/contracts/src/index.ts
packages/contracts/test/public-surface.test.ts
packages/contracts/test/worksite-day-foundation.test.ts
Introduces the minimal revision-safe WorksiteDay transport contract.
  • Defines required stable day, configuration, worksite, and local-date identifiers.
  • Keeps planned working time optional by omitting it from the DTO and generating no defaults.
  • Uses a strict object to reject unknown client-authoritative fields such as orgId.
  • Exports the schema and inferred DTO type publicly and tests identity/revision behavior.
packages/contracts/src/planning/schemas.ts
packages/contracts/src/index.ts
packages/contracts/test/public-surface.test.ts
packages/contracts/test/worksite-day-foundation.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@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