Repository navigation
fix(patchy): reverting a failed shared fixture edit brings its rows back - #365
Conversation
Astra reviewReviewed StandardsNo merge-blocking method or YAGNI findings. The change reuses the existing per-source stamp and retry path without adding another state model or abstraction. The regression test exercises real resource preparation and handlers in a scoped temporary directory. SpecNo merge-blocking intent findings. Issue #318 asks to invalidate the affected source's successful stamp before destructive recreation while preserving unrelated owned data and source stamps. The change removes only changed sources from the saved stamp before database preparation and restores the full stamp only after successful preparation. Reverting a failed fixture therefore triggers reseeding instead of accepting an empty source as initialized. Verification
No Summary: Standards 0 blockers, none; Spec 0 blockers, none. |
|
Reviewed StandardsThe diff follows the documented standards. Effect service conventions stay out of this change. The new branch in The stamp rewrite at One smell, as a judgement call. Duplicated code: the new session at SpecThe diff matches issue 318. Missing or partial. None. The published-consumer case is covered. The issue says restoring the exact previously-working fixture should restore its contact, and that another restart returned 0 rows. The new test sets a baseline, changes Owned notes stay. The rewrite keeps Scope. None. The diff is the stamp rewrite and the regression test. The issue allows this method in its own words: "Invalidate only the affected source's successful stamp before destructive recreation." The branch does that for every changed source. When the seed later succeeds, line 198 replaces the stripped stamp with the full one. On an unpublished patch, a fixture-only edit already avoids the full wipe, from the parent branch. This same strip covers that edit. The full wipe remains where the parent put it, on unpublished owned-schema changes. Wrong implementation. None. Failure still happens after the source schema is dropped. The new test passed on this commit: MethodThe stamp strip is the right method for this bug.
On success, The new branch runs only when A transaction around the drop and the fixture would roll the empty schema back, so a failed edit would leave the previous shared rows on disk. Drop and provision already commit inside YAGNIThis is the small version. There is no new helper, type, parameter, error, or service. The test is the published-consumer repro from the issue. The copied session stays. A stamp service or a transaction type would be a larger model for the same result. The branch, the comment, and this one test are the whole change. Standards: 0 hard violations. 1 judgement-call smell, the duplicated test session, and the repo's YAGNI note overrides it, so no change. Spec: 0 findings. Reviewed by Grok 4.7 in Grok Build. |
|
Both reviews are clean on Kept as is:
Checks on |
df13176 to
483a491
Compare
Dev recreated a changed shared source before running its fixture, but a failed fixture left the last successful stamp in place. Restoring the original fixture then matched that stamp, so the source stayed empty. Now the changed sources' stamp entries are dropped before recreation, so a failed seed is retried on the next start. Other sources' entries and the patch's own rows are untouched. Closes #318 Co-Authored-By: Claude Opus 5.5 <[email protected]>
104be71 to
455d877
Compare
…generated client (#366) Stacked on #365 (branch fix/318-fixture-retry). `patchy dev` evaluated `patchy.config.ts` twice 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 with `executeConfig`. `prepare` stamps its single evaluation with `resolveStamps`, using the index from the generation response, and that one manifest is checked against the generation metadata, written to `manifest.json` and returned. The old second walk that stamped from the response's `uses` array is gone; the metadata consistency check stays. Behaviour changes: - The index is checked before the generated files are activated, so a stale index is refused without touching the repo. Before, the files were written and then rolled back. - A generation response with no index is refused with "Generation returned no declaration index." - Stamps come from the index, not the response's `uses` array. The server builds both from one array, so a mismatch between them is a server defect; it now surfaces as `stale_generated` instead of "Generation returned no stamp for …" / "an inconsistent declaration set". Tests: `devPreparation.test.ts` calls `prepare` against an in-memory instance. - The reproduction (change `fields.ts` from `title` to `body` mid-generation) failed before the fix and passes now. - A stale-release index is still refused with `stale_generated`. - A declared shared table is stamped from the index, and metadata with a different revision is refused. The existing `executeConfig` refusal tests pass unchanged. `pnpm typecheck` and `pnpm lint` pass, and all 310 tests in `packages/patchy` pass. Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).
Stacked on #364 (branch fix/322-fixture-owned-data).
If you broke a shared-table fixture in
patchy devand then put the original back, that source's local rows stayed empty across every restart. Dev had already recreated the source when the fixture failed, but its stamp still recorded the last good fixture, so restoring those bytes looked like "nothing changed" and the INSERT never ran again.Now dev removes the changed sources' entries from the stamp before it recreates them. A fixture that fails to seed counts as changed on the next start and gets another try. Other sources' entries and the patch's own rows stay as they are.
Test evidence:
devResources.test.tscase follows the ticket's steps against a published consumer with one owned row: seed, typo the column (SharedFixtureInvalid), restore, restart twice. Before the fix:contacts: []. After: the contact is back on both restarts and the owned row is kept. It also passes with the baseline removed (never-published path).pnpm typecheckandpnpm lintare clean.pnpm test: 952 passed, 3 hit 5s timeouts in untouched packages (company-database,integrations/postgres) while other test runs loaded the machine. All 3 pass when re-run alone.Closes #318
Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).