Repository navigation
fix(patchy): dev no longer serves a manifest that disagrees with its generated client - #366
Conversation
Astra reviewReviewed StandardsMethod: keep one stamped-manifest assemblyAt devPreparation.ts:148–151, I would block on finishing this simplification. Keep the shared This is a possible Duplicated Code finding and a design judgment, not a demonstrated runtime regression. It follows the root No separate YAGNI blocker. The helper has two current consumers, and moving index validation before activation is part of removing the second config execution. SpecNo merge-blocking findings. #331 says: "Return the first validated manifest without executing config again" and "Retain the generated index release, version, stamp and declaration checks against that snapshot." The diff does both. The main-config source guard remains in the activation transaction; imported files are not overwritten. VerificationRan Summary: Standards 1 blocker, overlapping stamp assembly; Spec 0 blockers, none. |
|
Reviewed StandardsThe diff conforms to the documented standards. It leaves commands, flags, exit codes, and the Effect service conventions do not apply. No Fowler smell needs a change. The extraction is the existing index walk, called from dev on the response body and from publish on the file. Two callers is the point where this repo shares a function. SpecIssue 331 is met. The problem is a save of an imported file between two config executions, so the prepared manifest can disagree with the manifest generation already ran. The issue says to return that first validated manifest, skip the second execution, and still refuse a generated index whose release, manifest version, stamps, or declarations do not match the snapshot. The issue says to leave the author's concurrent edit in place. The PR also checks the index before MethodThe method is sound. Dev keeps one config evaluation. The manifest written to
Keep both walks. A
Description still arrives on the returned manifest. A save of YAGNIThe diff is as small as the constraint. Keep The comment above the call states why dev must not evaluate config again. The doc comment on The new test is the one this bug needs. SummaryStandards, 0 findings. Spec, 0 findings. I would merge this. |
|
Review follow-up, in 6065647. Fixed
Kept as is
|
104be71 to
455d877
Compare
patchy dev evaluated patchy.config.ts twice: once for generation and again after activation, returning the second result. Saving an imported config file in between produced a prepared manifest that differed from the generated client. Preparation now returns its first validated manifest and runs the generated index checks (release, manifest version, stamps, declarations) against that same evaluation through resolveStamps, shared with executeConfig. The index is checked before activation, so a stale one is refused without touching the repo. Closes #331 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ated index prepare assembled a stamped manifest from the response's uses and then built the same manifest again in resolveStamps only to discard it. It now uses the resolveStamps result as the manifest it activates, checks against the generation metadata and returns. The metadata consistency check stays. prepare no longer decodes a manifest itself, so the dev lifecycle's SchemaError handler for it is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
6065647 to
1839bea
Compare
Stacked on #366 (branch fix/331-double-config). Closes #324. A tier 1 patch that routed to `/café` saw `/café` after `route.set`, then `/caf%C3%A9` after pressing Back to the same history entry, so a router matching the path showed "not found" while the URL hadn't changed (#324). The client kept its own raw request after a set. Back reported the browser's percent-encoded address. The initial load already decoded it. Now the shell decodes the patch-relative path once, the same way hosted parsing does, and reports that form for the initial load and Back/Forward. `route.set` still acknowledges with `null`, as wire 1 promises. Right after the acknowledgement the shell sends its ordinary `route` event with the decoded path, so `set("/caf%C3%A9")` also settles on `/café`. The client still takes the requested path on acknowledgement, and it no longer notifies subscribers when a route update leaves the path unchanged, so a plain set reports once. Already-built bundles keep their `null` result and their cached request path is corrected by the same event; there is no wire-version bump, so no stored version is sent to the needs-rebuild door. Tests: - New tier 1 browser test (set, Back, reload, encoded set) failed on the old code with `Received: "/caf%C3%A9"` after Back and passes now. The full Chromium tier 1 suite passes 5/5. Firefox wasn't run because its Playwright build isn't installed locally. - `clientTransport.test.ts` has the shell's route event repeat an unchanged path after a set and checks that subscribers aren't notified twice. That assertion fails without the change. - `pnpm typecheck` and `pnpm lint` are clean. `pnpm test`: 953/958 under load from parallel runs. The 5 failures were in `devLifecycle.test.ts` and the two Postgres integration files, none of which this PR touches, and all 17 tests in those files pass when run alone. Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).
Stacked on #365 (branch fix/318-fixture-retry).
patchy devevaluatedpatchy.config.tstwice and kept the second result. Saving a file the config imports between the two runs gave a prepared manifest that differed from the generated client. Closes #331.Preparation now evaluates config once. The second run was also where the generated index checks happened (release, manifest version, stamps, declarations), so those move into
resolveStamps, shared withexecuteConfig.preparestamps its single evaluation withresolveStamps, using the index from the generation response, and that one manifest is checked against the generation metadata, written tomanifest.jsonand returned. The old second walk that stamped from the response'susesarray is gone; the metadata consistency check stays.Behaviour changes:
usesarray. The server builds both from one array, so a mismatch between them is a server defect; it now surfaces asstale_generatedinstead of "Generation returned no stamp for …" / "an inconsistent declaration set".Tests:
devPreparation.test.tscallsprepareagainst an in-memory instance.fields.tsfromtitletobodymid-generation) failed before the fix and passes now.stale_generated.The existing
executeConfigrefusal tests pass unchanged.pnpm typecheckandpnpm lintpass, and all 310 tests inpackages/patchypass.Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).