Skip to content

refactor(types): derive schedule, region level and verification types from payload-types - #681

Merged
sydevs-bot merged 8 commits into
mainfrom
claude/refactor-derive-generated-types
Sep 4, 2026
Merged

sydevs-bot merged 8 commits into
mainfrom
claude/refactor-derive-generated-types

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Changes

  • src/types/schedule.ts — one exported name per shape. EventSchedule is NonNullable<Event['schedule']>; ExclusionRange derives from its exclusions member. A caller holding a partial schedule writes Partial<EventSchedule> at the call site.
  • src/lib/schedule/scheduleHooks.ts — the export type { … } re-export is gone; its two consumers import from @/types/schedule.
  • src/lib/mapbox/geocoder.ts, src/lib/atlasSidebar/sidebarModel.ts, seeds/atlas/import.ts — RegionLevel is an unexported local in each. The two admin components and the sidebar spec write Region['level'].
  • src/lib/clients/verification.ts — CanonicalVerification / VerifiedEmbed / VerificationAttempt alias the generated HttpsSahajcloudDevSchemasClientCanonicalVerificationJson, which nothing imported before.
  • seeds/atlas/helpers/scheduleMapper.ts — ScheduleInput derives every member; the timezone is narrowed against SUPPORTED_TIMEZONES and resolved once, for firstDate and firstDate_tz together.
  • seeds/atlas/import.ts — startingAt_tz takes the same narrowing, and a substitution is now reported rather than swallowed.
  • src/types/AGENTS.md — the rule, the shapes that are not restatements, that a derived alias is local and never re-exported, and that a modifier applied to a derived name does not earn an alias either.
  • src/collections/CLAUDE.md — was the only CLAUDE.md in the repo checked in as a regular file rather than a symlink, so this PR's own guide edit left the copy Claude Code reads describing a deleted type. Now a symlink like the other eighteen.

What changed in review

@Ardnived left five comments across two rounds; four adopted, one still open. The adversarial pass left six; all six addressed.

  • ScheduleSubFields is gone — a flat rename of the private EventSchedule on the next line. One name, across all 8 files. (Raised independently by both reviews.)
  • EventScheduleInput is gone too (round 2). It was the third name for one shape in a PR arguing that one shape gets one name; every call site now writes Partial<EventSchedule>. The reason it is not Event['schedule'] — both members required — survives as a docblock on EventSchedule and as a general rule in src/types/AGENTS.md.
  • No exported or re-exported derived aliases. RegionLevel was exported from geocoder.ts and re-exported again from sidebarModel.ts, so the shape had three homes and the admin components were two hops from the generated type.
  • The collapsed union's leftovers — an identity cast in icsBuilder.ts and a stale paragraph in collections/AGENTS.md describing the deleted union — are removed.
  • The seed's second timezone defect is fixed, not filed. import.ts:1318 wrote the raw dump string into the same enum column; it takes supportedTimezone() now.
  • The substitution is no longer silent. It writes the row at a different instant than the source states, which is worse than the loud enum rejection it replaces — reportTimezoneSubstitution compares the raw zone against the resolved one, mirroring the language warning 20 lines up. The mapper stays pure; the caller holds both values already.

⏳ One thread is still open and it is a question for you — the lib-boundary.spec.ts roots change. Summary in the <details> below; the alternative is a one-line revert plus a waiver, which I didn't take because the waiver would assert something false.

⚠ One change to a gate, forced by the above — worth a look

Removing the sidebarModel → geocoder type import left geocoder.ts reading as single-consumer to tests/unit/lib-boundary.spec.ts, which failed the unit lane. Its import graph scanned src and scripts only, so seeds/atlas/import.ts — the module's second owner — was invisible to it.

I added seeds/ to the roots, which is what that spec's own docblock already claims ("consumers are counted over the whole repo, in every import form"). That surfaced one pre-existing offender the gap had been hiding: @/lib/richEditor/plainTextToLexical, whose only consumer is seeds/atlas/helpers/lexical.ts. Recorded in KNOWN_SINGLE_CONSUMER with the reason rather than moved — a plain-text→Lexical converter is general-purpose, and moving it is nobody's job in a types refactor.

The alternative was waiving geocoder in that baseline instead, which I didn't take because the waiver would have asserted something false: it has two consumers, the check just couldn't see one.

The negative proof, the seed defects, and what was left alone

The narrowing was proven, not assumed

A scratch file asserting the five values the old types accepted, compiled against the new ones:

Type '"Monday"' is not assignable to type '"MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU"'
Type '"5"' is not assignable to type '"1" | "2" | "3" | "4" | "-1" | null | undefined'
Type '"Mars/Olympus"' is not assignable to type 'SupportedTimezones | undefined'
Type '"continent"' is not assignable to type '"country" | "region" | "city" | "venue"'
Type '"hash"' is not assignable to type '"query" | "path"'

All five compiled before. The file was deleted; it is not in the diff.

The seed defect, the second one the fix introduced, and the third one next door

mapSchedule built firstDate_tz as timeZone || 'UTC' from the Atlas dump — an arbitrary string. ScheduleInput declared it string, so nothing objected; the CMS would have refused the write.

Narrowing only the column then created a worse bug: firstDate is an instant computed in a zone and firstDate_tz is the zone it is read back in. Resolving the column to UTC while computing the instant at +05:30 puts the event and its whole recurrence 5.5 hours out, silently. Both now come from one supportedTimezone() call.

import.ts:1318 was the same defect a file away, on startingAt_tz, and did not surface as a type error only because upsert accepts a looser shape. Same helper, same import run.

Both are latent, not live: every distinct zone in the committed dump is in the generated 581-member union (venues 47/47, regions 53/53, registrations 64/64). That is precisely why a refreshed dump introducing one would have gone unnoticed — hence the warning.

The assertions were watched failing

tests/unit/atlas-schedule-mapper.spec.ts gained three supportedTimezone cases, and dropping the membership test reddens the new "substitutes UTC" case and the existing +05:30 mapper case — the pair that has to move together. Restored after.

The mapper case itself was watched failing at the real site earlier: restoring timeZone || 'UTC' on the toFirstDateUtc call gives 2021-07-27T13:30:00.000Z against the expected …T19:00:00.000Z — the 5.5 hours exactly.

Left alone deliberately

  • ScheduleInput.endingType stays 'until', narrower than the column's 'count' | 'until' | null. The importer never writes a count ending. src/types/AGENTS.md now records deliberate narrowing as a non-restatement, so a future sweep does not widen it back.
  • icalRule / upcomingDates appear on EventSchedule because they are on the column. Nothing reads them through this type; they are virtual, computed on read.
  • WeekdayCode / WeekNumber stay derived by indexing the group — nothing exports those unions.

Test results

  • Lean gate on this head (a55e841): ✓ lint, ✓ typecheck, ✓ typecheck:tests, ✓ test:unit — 120 files / 1557 specs, all exit 0. Typecheck is the load-bearing one for the inlining: an identifier substitution either compiles at all 37 positions or it does not.
  • Targeted: ✓ tests/unit/atlas-schedule-mapper.spec.ts (17), tests/unit/lib-boundary.spec.ts
  • Integration lane runs locally — fix(test): give $PGDATA its own mode, and make the failure branch actually print #679 merged, scripts/ensure-test-db.sh brings the cluster up, and tests/int/schedule-last-date-backfill.int.spec.ts is green (7 specs). Nothing here touches an integration-covered path; the runtime changes are all in seeds/atlas/, which no integration spec exercises.
  • origin/main merged in, so this is now tested on top of fix(api): map a Postgres 22P02 cast failure to 400, on Payload's routes and in geojson #685.
  • Build: N/A — Railway builds on the preview deploy.

Preview

Railway builds this PR's preview on push; nothing here is reachable from a URL — the change is type-level plus a seed helper — so there is no route to deep-link.

Contributes to #671

🤖 Written by the sydevs autonomous loop — see what this is


🤖 Generated with Claude Code

https://claude.ai/code/session_01W3bncHkCBKywbTiJSniKh8

@sydevs-bot
sydevs-bot requested a review from Ardnived September 2, 2026 21:22
@railway-app

railway-app Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-681 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Sep 3, 2026 at 11:09 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🧐 Adversarial review

The PR is the right size for its ticket and the derivations are exact, not approximate — I checked each against payload-types.ts rather than taking the body's word. Items 1–3 of #671, nothing smuggled in. The corrected premise on item 2 is correct: canonicalVerificationJsonSchema is built by splatting the const arrays, so deriving them from the schema would have inverted the dependency; and the generated HttpsSahajcloudDevSchemasClientCanonicalVerificationJson (payload-types.ts:2335-2349) is byte-for-byte the three interfaces it replaces — routing: 'query' | 'path', the seven-member reason union, no [k: string]: unknown escape hatch — so nothing loosened on the way through. The seed defect is real and the one-resolution fix is the right one.

The shape criticism is that the refactor collapsed a union and stopped at the files it opened. EventScheduleInput is no longer a union, but the cast and the doc paragraph that existed to reconcile that union are still in icsBuilder.ts and collections/AGENTS.md. And the new src/types/schedule.ts introduces a private alias that exists only to be aliased again — contradicted, in this same PR, by the one-line form its own AGENTS.md prescribes. A PR whose subject is "stop keeping two names for one shape" is the wrong PR to add one in.

One thing worth naming even though I am not flagging it: this bundles a zero-runtime type refactor with the only behaviour change in the diff — silent UTC substitution in the Atlas importer. The narrowing forced it, so splitting was not free, but it means the part that can alter written data is also the part with no integration coverage on this branch.

Findings

should-fix

  1. src/types/schedule.ts:42 — the collapsed union left an identity cast and a stale comment in icsBuilder.ts:121-123, and a stale paragraph in collections/AGENTS.md:785-787.
  2. src/types/schedule.ts:11 — EventSchedule is a private alias renamed on the next line; three spellings of one shape, against the one-liner this PR's own doc prescribes.

consider

  1. seeds/atlas/helpers/scheduleMapper.ts:28 — Timezone is three hops to SupportedTimezones, which payload-types exports directly.
  2. seeds/atlas/helpers/scheduleMapper.ts:175 — the timezone substitution is silent, where import.ts:1177 warns for the analogous one and this same function refuses a silent fallback 25 lines down.
  3. seeds/atlas/helpers/scheduleMapper.ts:117 — the identical raw-timezone write survives at import.ts:1318; apply the helper or file the ticket rather than offering to.
  4. src/types/AGENTS.md:50 — the "not a restatement" list omits deliberate narrowing, which is a shape this PR ships (endingType?: 'until'); as written a future sweep would widen it.
What was checked

Ticket and its history. #671 (current body, rewritten after this PR), all 5 comments — including the sweep that produced items 1–4 and the reviewer's two follow-ups. Verified the scope claim: the diff contains items 1–3 and nothing from item 4; src/plugins/access/types.ts is untouched.

Diff. git diff origin/main...FETCH_HEAD over all 9 files, plus each touched file read whole at FETCH_HEAD.

Every derivation checked against the generated type, not the description:

  • Event['schedule'] (payload-types.ts:1729-1774) — confirmed firstDate: string and firstDate_tz: SupportedTimezones are required, so ScheduleInput did not silently widen when its two required members switched to derived; confirmed weekdays, weekNumber, weekdayOfMonth, monthlyMode, recurrenceType are the enumerations the PR claims; confirmed icalRule / upcomingDates are on the group, so ScheduleSubFields genuinely gained them.
  • HttpsSahajcloudDevSchemasClientCanonicalVerificationJson (payload-types.ts:2335-2349) vs the three deleted interfaces — member-by-member, including that attempts is required (or CanonicalVerification['attempts'][number] would not compile) and that additionalProperties: false in the schema means no index signature reached the generated type.
  • Region['level'] vs the deleted literal union; ROUTING_MODES (canonical.ts:30) vs the generated 'query' | 'path'.

The SUPPORTED_TIMEZONES claim, measured. src/lib/timezones/index.ts is the list payload.config.ts:90 installs as admin.timezones.supportedTimezones, so the membership test and the generated union cannot disagree — confirmed by reading both. Then parsed the 581 members of SupportedTimezones out of payload-types.ts and diffed them against every distinct time_zone in the committed dump: venues.json 47 distinct / 0 unsupported, regions.json 53 / 0, registrations.json 64 / 0. events.json carries no time_zone key at all — an event's zone comes from its venue or its area (import.ts:1168-1169), which is what makes the venue/region check the relevant one, not the one the PR body cites.

Consumer sides followed. All 15 importers of @/types/schedule (scheduleHooks, icsBuilder, scheduleMatch, scheduleStatus, backfillLastDate, gating, watermark, verify, syncVerificationOnSave, seeds, 4 specs) — findings 1 and 2 came out of that pass. Consumers of the verification types (VerifyEmbeds.ts, CanonicalEmbedPicker/{model,Description}) read for anything depending on the old hand-written shapes; nothing does. mapSchedule's only caller (import.ts:1189) read with its surroundings, which is where the addWarning precedent and the startingAt_tz sibling turned up.

Not flagged, deliberately. The two whitespace-only hunks in the spec files; the candidate as Timezone cast (unavoidable behind a Set<string> membership test); test-coverage volume; anything the author-side pass owns.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread src/types/schedule.ts Resolved
Comment thread src/types/schedule.ts Resolved
Comment thread seeds/atlas/helpers/scheduleMapper.ts Resolved
Comment thread seeds/atlas/helpers/scheduleMapper.ts Resolved
Comment thread seeds/atlas/helpers/scheduleMapper.ts Resolved
Comment thread src/types/AGENTS.md Resolved
Comment thread src/lib/mapbox/geocoder.ts Resolved
Comment thread src/types/AGENTS.md Resolved
Comment thread src/types/schedule.ts Resolved
Comment thread src/types/schedule.ts Resolved
… from payload-types

Items 1–3 of #671. Four hand-written types restated shapes `payload-types.ts`
already generates, and two of them were *wider than the CMS* — they type-checked
values a write then rejected:

- `ScheduleSubFields` (`src/types/schedule.ts`) declared `firstDate_tz?: string`,
  `weekdays?: string[]` and `weekNumber?: string` where the column enumerates
  `SupportedTimezones`, `'MO'|…|'SU'` and `'1'|…|'-1'`. So `weekdays: ['Monday']`
  compiled and failed at the database. It is now `NonNullable<Event['schedule']>`,
  and `ExclusionRange` derives from its `exclusions` member.
- `RegionLevel` (`src/lib/mapbox/geocoder.ts`) was byte-identical to
  `Region['level']`. `TYPES_BY_LEVEL` is a `Record` over it, so deriving turns a
  new CMS level into a compile error rather than a silent gap in the geocoder.
- `CanonicalVerification`, `VerifiedEmbed` and `VerificationAttempt`
  (`src/lib/clients/verification.ts`) hand-declared the column beside a generated
  type that nothing imported. They now alias
  `HttpsSahajcloudDevSchemasClientCanonicalVerificationJson`.

The narrowing surfaced one real defect, which is the point of the exercise.
`seeds/atlas/helpers/scheduleMapper.ts` declared its own fifth copy of the same
shape and passed `timeZone || 'UTC'` straight through from the Atlas dump — an
unrecognised zone would reach a write the CMS refuses. `ScheduleInput` now
derives every member, and `supportedTimezone()` narrows against the same
`SUPPORTED_TIMEZONES` list the Payload config installs (and that
`payload-types.ts` is generated from), falling back to `UTC` as the caller
already did for an absent zone.

Item 2's premise in the ticket is corrected rather than implemented: the const
reason arrays are spliced *into* the JSON schema Payload generates the type
from, so they are the single source, not a third one. Deriving the arrays from
the schema would invert a correct dependency.

Item 4 (`TypedAuthUser` and the `currentProject` `''` narrowing) is deliberately
not here — it is gated on a design decision nobody has made. #671 stays open for
it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ShFzQH9fUk4XbiGguzLExA
…d its column

Caught by the review pass on the previous commit. `firstDate` is an instant
computed *in* a zone and `firstDate_tz` is the zone it is read back in, so the
two must be the same string. Narrowing only the column left an unsupported zone
— `+05:30`, or an IANA alias the pinned `@vvo/tzdb` does not group — resolving
the instant at that zone while storing `UTC`, putting the event and its whole
recurrence hours out.

That is strictly worse than what it replaced: before, the mismatched zone was
refused by the column's enum on write. Trading a loud rejection for silently
wrong data is the opposite of what #671 is for.

The spec was watched failing at the real site — restoring `timeZone || 'UTC'` on
the `toFirstDateUtc` call gives `2021-07-27T13:30:00.000Z` against the expected
`…T19:00:00.000Z`, the 5.5 hours exactly — then restored.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01ShFzQH9fUk4XbiGguzLExA
Review on #681 asked for two things that turn out to be the same thing:
`ScheduleSubFields` was a flat rename of the private `EventSchedule` on the
next line, and `RegionLevel` was exported from `geocoder.ts` and re-exported
again from `sidebarModel.ts`. Both put a name between a reader and the
generated type it derives from, which is what the PR was opened to stop.

- `src/types/schedule.ts` exports `EventSchedule` — the name the group already
  had — and nothing aliases it. `ScheduleSubFields` is gone from all 8 files.
- `scheduleHooks.ts`'s `export type { ExclusionRange, ScheduleSubFields }` is
  gone; its two consumers import from `@/types/schedule`. That re-export is
  precisely the shape `src/types/AGENTS.md` argues against, in the PR adding
  the argument.
- `RegionLevel` is now an unexported local in each of the three files that
  repeat it (geocoder, sidebarModel, the Atlas importer). The two admin
  components and the sidebar spec name it once each and write `Region['level']`.
- `icsBuilder.ts`'s `input.schedule as Partial<ScheduleSubFields>` was an
  identity cast once the union collapsed — dropped, with the comment that
  explained the union it reconciled.

`EventScheduleInput` stays. It is `Partial<EventSchedule>`, which is not
`Event['schedule']`: the generated group keeps `firstDate` and `firstDate_tz`
required, and all 10 consumers take a field patch or a `siblingData` merge.

Removing the sidebarModel → geocoder import left `geocoder.ts` reading as
single-consumer to `lib-boundary.spec.ts`, whose graph scanned `src` and
`scripts` only — so the Atlas importer, its second owner, was invisible. Added
`seeds/` to the roots, which is what that spec's own docblock already claims.
That surfaced one pre-existing single-consumer, `richEditor/plainTextToLexical`;
recorded in the baseline rather than moved, since a plain-text→Lexical converter
is general-purpose and moving it is nobody's job in a types refactor.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JrS3RGMd96BwUAM7g2g5vU
… substituted

Two findings from the review pass on the timezone narrowing, both about the
half that was left behind.

`import.ts:1318` wrote `startingAt_tz: reg.timeZone ?? undefined` — the raw
`time_zone` string off the dump, into the same `SupportedTimezones` enum column
`firstDate_tz` uses. It is the identical defect this PR was opened to fix, one
file away, and it did not surface as a type error only because `upsert` accepts
a looser shape. `supportedTimezone()` is now exported and applied there.

The substitution was also silent, in both places. It does not merely reject a
value — it writes the row at a different instant than the source states, which
is strictly worse than the loud enum rejection it replaces, and the importer
already warns for the analogous language substitution 20 lines up.
`reportTimezoneSubstitution` compares the raw zone against the resolved one and
warns; the mapper stays pure, since the caller holds both values already.

Unreachable against the committed dump — every distinct zone is in the
generated 581-member union (venues 47/47, regions 53/53, registrations 64/64) —
which is exactly why a refreshed dump introducing one would go unnoticed.

`Timezone` was three hops (`EventSchedule['firstDate_tz']`) to
`SupportedTimezones`, which `@/payload-types` exports directly and which the
Payload config and the CMS both call by that name. Imported instead.

Three `supportedTimezone` cases added, and watched failing at the site that
would cause it — dropping the membership test reddens both the new case and
the existing `+05:30` one, which is the pair that has to move together.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JrS3RGMd96BwUAM7g2g5vU
Writes down the rule the review asked for, beside the one this PR already
added: derive from the generated type, and don't put an exported name in front
of the derivation. An alias earns its place where one file repeats the indexed
form enough that it gets in the way, and then it stays unexported there.

Also adds the third non-restatement — a deliberate narrowing at a boundary.
The importer's `ScheduleInput.endingType` is `'until'` where the column is
`'count' | 'until'`, and the two exceptions as written covered a relationship
and a loose input but not that, so a future sweep reading the section would
widen it back and lose the intent the comment exists to preserve.

`src/collections/AGENTS.md` still described `EventScheduleInput` as
"`ScheduleSubFields` **or** Payload's generated `| null` shape" — a union this
PR deleted, under a name that no longer exists.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JrS3RGMd96BwUAM7g2g5vU
@sydevs-bot
sydevs-bot force-pushed the claude/refactor-derive-generated-types branch from b327628 to 6212336 Compare September 3, 2026 05:20
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-681 September 3, 2026 05:20 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

All four of your comments are handled — three adopted, one answered with the source. Two threads left open on purpose, both needing your call.

Your comment Outcome
geocoder.ts:46 — don't export/re-export RegionLevel, trim the comment Adopted. Unexported local in the three files that repeat it; Region['level'] at the call sites that name it once. ⚠ left open — it forced one change to lib-boundary.spec.ts, below
types/AGENTS.md:43 — avoid re-exporting derived types Written down as its own section, with the ❌ example being the chain this PR had. Resolved
schedule.ts:33 — why not just EventSchedule? Adopted. ScheduleSubFields is gone from all 8 files, and scheduleHooks.ts's re-export of it with them. Resolved
schedule.ts:42 — isn't this a redefinition of Event['schedule']? No — the generated group keeps firstDate and firstDate_tz required (payload-types.ts:1730-1732) and all 10 consumers hold a patch. Left open: happy to inline Partial<EventSchedule> at every site if you'd rather have no name at all

The six adversarial-review threads are all addressed and resolved. Two of them turned into real fixes rather than tidying: the seed wrote an unvalidated dump timezone into a second enum column (startingAt_tz), and the UTC substitution was silent in both places — it writes the row at a different instant than the source states, which is worse than the enum rejection it replaces. Both are latent against the committed dump (all 64 registration zones are in the union today), which is exactly why they would have gone unnoticed on a refresh.

The one thing worth your eye beyond the types: removing the sidebarModel → geocoder import made geocoder.ts read as single-consumer to tests/unit/lib-boundary.spec.ts and reddened the unit lane — its graph scanned src and scripts only, so the Atlas importer was invisible to it. I added seeds/ to the roots, which is what that spec's own docblock already claimed, and recorded the one pre-existing offender it surfaced. The alternative was waiving geocoder in the baseline, which I didn't take because the waiver would have asserted something false. Details in the PR description.

Lean gate green (1545 specs), and the integration lane runs locally again now that #679 has landed.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@Ardnived, on the thread: "`Partial<EventSchedule>` actually reads better
because it tells us this is the common `EventSchedule` type but with a
modifier. The alias obscures that."

`EventScheduleInput` is gone; every call site spells the shape. The alias
was the third name for one type in a PR whose whole subject is that one
shape should have one name, and it only survived the first round because
the argument for it — that `Event['schedule']` keeps `firstDate` and
`firstDate_tz` required, so the callers genuinely hold something looser —
is an argument for `Partial`, not for a name.

That distinction still needs writing down, so it moved to a docblock on
`EventSchedule` rather than disappearing with the alias: a field hook's
`siblingData`, a merge of a previous doc over an incoming patch, and a
partially-built schedule all lack both required members.

`src/types/AGENTS.md` gains the general form as its own rule — a modifier
applied to a derived name is still spellable from the generated type, so
it does not earn an alias. It replaces the carve-out that had cited this
very alias as the example of a shape needing a name, which the review has
now overruled.

Also fixes drift this PR itself introduced: `src/collections/CLAUDE.md`
was the ONE `CLAUDE.md` in the repo checked in as a regular file rather
than a symlink to its `AGENTS.md`, so 6212336 updated the guide and left
the copy Claude Code actually reads still naming `ScheduleSubFields` — a
type this PR deletes. The two files agreed until that commit, and their
only difference was those three lines. Replaced with a symlink, matching
the other eighteen; `git ls-files -s '*CLAUDE.md'` is now all 120000.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W3bncHkCBKywbTiJSniKh8
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-681 September 3, 2026 16:25 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Inlined as you asked — EventScheduleInput is gone, every call site writes Partial<EventSchedule>. a55e841, with origin/main merged in so this now sits on #685.

Your reason is the one that settles it: the alias was the third name for one shape in a PR arguing that one shape gets one name. The argument I kept it on — that Event['schedule'] holds two members required, so callers genuinely have something looser — is an argument for Partial, not for a name. That fact still had to live somewhere, so it is a docblock on EventSchedule now, and the general form is a rule in src/types/AGENTS.md replacing the carve-out that had cited this very alias.

The sweep turned up drift this PR itself caused. src/collections/CLAUDE.md was the one CLAUDE.md in the repo checked in as a regular file rather than a symlink to its AGENTS.md — so 6212336 updated the guide and left the copy Claude Code actually reads still describing ScheduleSubFields, a type this PR deletes. The two files agreed until this branch (diff is exactly those three lines), so it is now a symlink like the other eighteen.

⏳ One thread is still yours — the lib-boundary.spec.ts roots change. Adding seeds/ to its import roots is what let it see geocoder.ts's second consumer, and it surfaced one pre-existing single-consumer module I recorded rather than moved. The alternative is a revert plus a waiver on geocoder, which I didn't take because the waiver would say "one consumer" and that is false. Say the word either way.

Gate green on this head: lint, typecheck, typecheck:tests, test:unit (120 files / 1557 specs).

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-681 September 3, 2026 23:07 Destroyed
@sydevs-bot
sydevs-bot merged commit 3ff41dc into main Sep 4, 2026
2 checks passed
Ardnived pushed a commit that referenced this pull request Nov 5, 2026
Review on #681 asked for two things that turn out to be the same thing:
`ScheduleSubFields` was a flat rename of the private `EventSchedule` on the
next line, and `RegionLevel` was exported from `geocoder.ts` and re-exported
again from `sidebarModel.ts`. Both put a name between a reader and the
generated type it derives from, which is what the PR was opened to stop.

- `src/types/schedule.ts` exports `EventSchedule` — the name the group already
  had — and nothing aliases it. `ScheduleSubFields` is gone from all 8 files.
- `scheduleHooks.ts`'s `export type { ExclusionRange, ScheduleSubFields }` is
  gone; its two consumers import from `@/types/schedule`. That re-export is
  precisely the shape `src/types/AGENTS.md` argues against, in the PR adding
  the argument.
- `RegionLevel` is now an unexported local in each of the three files that
  repeat it (geocoder, sidebarModel, the Atlas importer). The two admin
  components and the sidebar spec name it once each and write `Region['level']`.
- `icsBuilder.ts`'s `input.schedule as Partial<ScheduleSubFields>` was an
  identity cast once the union collapsed — dropped, with the comment that
  explained the union it reconciled.

`EventScheduleInput` stays. It is `Partial<EventSchedule>`, which is not
`Event['schedule']`: the generated group keeps `firstDate` and `firstDate_tz`
required, and all 10 consumers take a field patch or a `siblingData` merge.

Removing the sidebarModel → geocoder import left `geocoder.ts` reading as
single-consumer to `lib-boundary.spec.ts`, whose graph scanned `src` and
`scripts` only — so the Atlas importer, its second owner, was invisible. Added
`seeds/` to the roots, which is what that spec's own docblock already claims.
That surfaced one pre-existing single-consumer, `richEditor/plainTextToLexical`;
recorded in the baseline rather than moved, since a plain-text→Lexical converter
is general-purpose and moving it is nobody's job in a types refactor.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JrS3RGMd96BwUAM7g2g5vU

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-681 — 71ff7490 Deployed Sep 3, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants