Skip to content

demo: walk a data fault through the tour and prove the abandon left nothing behind - #267

Draft
Kiran01bm wants to merge 1 commit into
mainfrom
kiran01bm/cs12-demo-tour
Draft

Kiran01bm wants to merge 1 commit into
mainfrom
kiran01bm/cs12-demo-tour

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

The demo tour now walks a data fault through the built binary: a copy-and-swap whose rows will not fit the new type reports failed / data-fault with exit 1, and a second copy-and-swap on the same table proves the abandon left nothing behind.

Why

The engine abandons a run on a data fault — drops the shadow, releases the slot or the fence, deletes the checkpoint row — and the Go suite proves that against testcontainers. The artifact smoke test did not exercise the path at all, so a regression in the CLI's rendering of it (the exit code, the code field, the table) would reach a release unseen. The tour is the one check that runs the shipped binary the way a user does.

While wiring it in, the seed turned out not to be rerunnable once a copy-and-swap has run: the compose role is pgsprite, the engine creates a schema of the same name for its checkpoint table, and from then on the seed's unqualified CREATE TABLE landed in pgsprite instead of public under the role's default search_path, so every public.* assertion in a second make demo-check failed. CI never saw it because its database is fresh.

What

  • demo/seed.sql: orders gains a note text column; one row (id = 4000, past the copier's first chunks) carries a 64-character note. The seed pins search_path = public so reseeding lands in public whether or not the engine's schema exists yet.
  • demo/tour.sh: new execute_data_fault helper (check mode asserts exit 1, outcome == failed, code == data-fault, table, not forced; demo mode prints the verdict and the expected exit) and two run_exec rows after the existing copy-and-swap: narrow note to varchar(32) (the fault), then widen it to varchar(200) through copy-and-swap again — the success is the proof that no shadow, slot, or checkpoint row survived the abandon.
  • demo/README.md: the exec row and the check-mode exit-code list name the new step.

Before / after

Same table, same seeded rows. Before, the tour ran one copy-and-swap on orders and moved on; a data fault was never exercised by the built binary, and the second local run seeded into the wrong schema. After, the fault is met part-way through the copy, the verdict is asserted, and the next copy-and-swap on the same table succeeds only because the abandon released everything.

Before                                        After
──────                                        ─────
make demo-check (fresh DB)                    make demo-check (fresh DB, or a reused one)
  seed → public.orders(user_id int, total)      seed → SET search_path = public
                                                       public.orders(user_id, total, note)
                                                       id 4000: note = 'xxxx…' (64 chars)
  exec:                                         exec:
    orders.user_id int → bigint                   orders.user_id int → bigint
      executed-via-copy-and-swap, exit 0            executed-via-copy-and-swap, exit 0
                                                  orders.note text → varchar(32)
    (data fault: never run by the tour)             chunk [2001,4000] hits id 4000
                                                    → SQLSTATE 22001
                                                    → run abandons itself:
                                                      shadow dropped, slot dropped,
                                                      checkpoint row deleted
                                                    verdict: failed / data-fault
                                                    table public.orders, exit 1   ◀ asserted
                                                  orders.note text → varchar(200)
                                                    executed-via-copy-and-swap, exit 0
                                                    ◀ could not start if anything
                                                      had been left behind
    DROP INDEX orders_total_idx rows …            DROP INDEX orders_total_idx rows … (unchanged)

make demo-check again (same DB)               make demo-check again (same DB)
  pgsprite schema now exists                    pgsprite schema now exists
  seed → pgsprite.orders  ✗                     seed → public.orders  ✓
  every public.orders assertion fails           all checks pass

🤖 Generated with Amp (Claude Opus 4.6)

…othing behind

The built binary never exercised the data-fault path; the tour now
narrows a seeded column one row will not fit, asserts the failed /
data-fault verdict and exit 1, then runs a second copy-and-swap on the
same table as proof nothing was left behind. The seed also pins
search_path = public: the compose role shares its name with the
engine's schema, so a reseed after any copy-and-swap landed the tables
in the wrong schema.
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.

1 participant