Repository navigation
fix(macos): decode server occurrence ids in the split projection - #5207
Merged
Merged
Conversation
The thisAndFollowing split projection parsed and composed app-facing
occurrence ids with `|`. The canonical format is `${eventId}::${recurrenceId}`,
owned by packages/core/src/util/occurrence-id.ts: the backend mints it in
event-list.translation.ts and decodes it back into a single-occurrence command
target in event-command.translation.ts.
On a real server-minted id, Swift's `split(separator: "|")` returns one
element, so `.last` is the WHOLE id and the intended schedule-start fallback
was dead code. Two consequences:
- The whole id became the `splitAt` fed to `SeriesSplit.remainderMasterId`, so
macOS hashed `<seriesId>:<seriesId>::<stamp>` while sync hashed
`<seriesId>:<stamp>`. The deterministic remainder-master id exists so one
split always resolves to one master; instead macOS and the server derived
different masters and a split forked in two.
- Repointed occurrences became `<newMaster>|<oldMaster>::<stamp>`, which
`decodeOccurrenceId` rejects, so a later scope-"this" action on one silently
escalated to the whole series.
No test caught it because every macOS split fixture composed its own ids with
`|` (the demo-seeder convention), so the projection agreed with its fixtures
and diverged only against the real server.
`OccurrenceIdFormat` now mirrors the core codec in CompassKit, validating the
id shape as core does so a nested local id falls back instead of guessing. The
projection reads both formats, keeping demo-seeded `|` ids working, and only
ever mints the canonical one. Guards: a pinned cross-language vector for
`remainderMasterId` (CryptoKit on one side, a hand-rolled SHA-256 on the
other, previously unpinned on the Swift side) and a Linux-runnable check tying
the Swift separator to core's.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmwVQFVTgaGuPMYCVA35kD
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.
No issue: finding from the scheduled tech-debt sweep over the 17 merges after
the 2026-11-09 sweep (#5189 to #5206).
What and why
The thisAndFollowing split projection in
ProjectRecurringEdit.swiftparsedand composed app-facing occurrence ids with
|. The canonical format is${eventId}::${recurrenceId}, owned bypackages/core/src/util/occurrence-id.ts:the backend mints it at
event-list.translation.ts:68and decodes it back intoa single-occurrence command target at
event-command.translation.ts:135. On areal server-minted id, Swift's
split(separator: "|")returns a single element,so
.lastwas the whole id and the intendedscheduleStartStringfallback wasunreachable. That gave two silent divergences: the whole id became the
splitAtfed to
SeriesSplit.remainderMasterId, so macOS hashed<seriesId>:<seriesId>::<stamp>while sync hashed<seriesId>:<stamp>(
series-exception.ts:176) and one split resolved to two different remaindermasters, defeating the deterministic id whose whole purpose is that it resolves
to one; and repointed occurrences became
<newMaster>|<oldMaster>::<stamp>,which
decodeOccurrenceIdrejects, so a later scope-"this" action on oneescalated to the whole series exactly as that module's comment warns. No test
caught it because every macOS split fixture composed its own ids with
|, thedemo-seeder convention, so the projection agreed with its fixtures and diverged
only against the real server.
OccurrenceIdFormatnow mirrors the core codec inCompassKit with the same shape validation, so a nested local id falls back
instead of being guessed at; the projection reads both formats, which keeps
demo-seeded
|ids working, and only ever mints the canonical one. Two guardscome with it: a pinned cross-language vector for
remainderMasterId, which waspreviously unpinned on the Swift side so CryptoKit and the hand-rolled SHA-256
in core could drift apart unnoticed, and a Linux-runnable check tying the Swift
separator to core's. Deliberately left alone and recorded in
judged-fine.md: the|demo-seeder convention itself (converting it wouldchange what a demo store holds and touch its UI-test launch args, a contract
decision rather than debt) and the timed/all-day normalization difference in the
non-composite fallback (needs a date-parsing decision on the Swift side).
Verify
VERDICT: PASSfrombun run verify --strict.Checks run:
test:scripts:fast,type-check,lint,knip. Checks skipped:none. No PRE-EXISTING or FLAKY lists: nothing failed.
CI-only, so unverified locally and the point of the required
macoscheck onthis PR:
test:macosandtest:macos:packages. Both Swift test files here(
OccurrenceIdFormatTests, the updatedProjectRecurringEditTests) and theupdated
EventsStoreRecurringTestsfirst compile and run there, since thismachine has no Xcode.
Generated by Claude Code