Skip to content

test(compat): thrust-compat-plane with a fixture recorder and parity harness, serving S01 and S02 - #79

Merged
aRustyDev merged 1 commit into
mainfrom
test/compat-fixtures-harness
Oct 24, 2026
Merged

aRustyDev merged 1 commit into
mainfrom
test/compat-fixtures-harness

Conversation

@aRustyDev

@aRustyDev aRustyDev commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

What

First of nine PRs for #44 (the 48-route minimum slice). It adds the compat crate and the machinery every later row reuses, and serves the two rows that need no tables.

  • crates/thrust-compat-plane: runtime-free, so it builds for wasm32. Plane-shaped types stay inside it (chore(contracts): keep compat DTOs out of thrust-contracts; add the check-deps.sh rule #52). Both composition roots mount routes() beside thrust_api::router().
  • S01 GET /api/instances/: always is_setup_done: true.
  • S02 GET /api/users/me/: signed out, the pin answers 401 with {"detail": ...}, a JSON object with no id. A signed-in caller gets a 501 until the boot stage builds the profile tables, never a half-shaped 200.
  • tools/compat-record/record.py (uv script) records one fixture per row from the pinned Plane's oracle stack (ba85d4d3d3). It does the instance-admin setup first, because a fresh pin reports is_setup_done: false.
  • Normaliser: one rules file (tests/parity/normalise.json), implemented twice (Python records, Rust compares). normalise-cases.json is a hand-written case list that both must pass.
  • tests/parity.rs: one parity_ test per row, in process through the memory adapters, no network.

Findings worth a reviewer's eye

  • The pin's users/me 401 and the issue's "JSON object with no id" agree: the 401 body is {"detail": ...}.
  • The pin's React client does not redirect a 401 from / (apps/web/services/api.service.ts), so the redirect loop research/0003 §9 row 2 worries about only applies to private routes.
  • /api/instances/ sends cache-control: private, max-age=<remaining TTL>, which changes per request, so headers other than content-type, location, www-authenticate and retry-after are not compared.
  • workspaces_exist is a constant false until the onboarding stage adds the workspace read. That is wrong for a database seeded through the slice routes; noted in the code.

Controls (each shown failing)

Control Result
fixture with a renamed field, a changed status, a changed value, an int where Plane sends a float parity_control_* all require a divergence, and pass
is_setup_done: false in the handler parity_s01_instances fails with the differing path
tokio added to the crate scripts/check-deps.sh exits 1: FORBIDDEN: thrust-compat-plane depends on tokio
native root without the merge scripts/contract.sh native-memory: exactly the two new contract tests fail, 37 of 39
two recordings on the same stack byte-identical

Verified

  • cargo nextest run --workspace: 1029 passed.

  • scripts/contract.sh native-memory: 39 of 39 (EXPECT_MAIN 37 to 39).

  • cargo check -p thrust-server, and -p thrust-worker --target wasm32-unknown-unknown.

  • scripts/check-deps.sh covers the new crate.

  • CI on this PR: all 27 reported checks passed and the PR is CLEAN, including the main contract pass on native-pg, worker-memory and worker-cf, which I did not run locally.

Not run: a recording on a second fresh stack. Gaps are recorded as G-15 in docs/src/testing/status.md.

Effort

Modelled for the rows (research/0003 §8.1): S01 0.9 pd (crud/L) and S02 0.15 pd (crud/S). Most of this PR is shared machinery that the model prices separately (route scaffold, error bodies, serializer fidelity), plus the recorder and harness, which it does not price. I did not time the work, so there is no actual pd to report here.

cargo fmt --check is not clean at rustfmt's default width, as in every other crate; that gate is #40.

Refs: plane-byd.12.1

🤖 Generated with Claude Code

…harness, serving S01 and S02

First stage of #44. Adds the compat crate (runtime-free, Plane-shaped types stay inside it, #52), mounted beside
thrust_api::router() by both composition roots, with the two rows that need no tables: S01 GET /api/instances/ and S02
GET /api/users/me/ (signed out: the pin's 401 with a DRF `detail` body, a JSON object with no `id`; signed in is a 501
until the boot stage builds the profile tables).

tools/compat-record/record.py records one fixture per row from the pinned Plane's oracle stack (ba85d4d3d3), after the
instance-admin setup that makes S01 report is_setup_done. A shared rules file (tests/parity/normalise.json) is
implemented twice, in Python for recording and in Rust for comparing, and a shared case list checks both. Each parity_
test replays a fixture in process through the memory adapters.

Controls shown red: a renamed field, a changed status, value and number type in a fixture; a handler with
is_setup_done=false fails parity_s01; tokio added to the crate fails scripts/check-deps.sh (now covers the crate); the
native root without the merge fails exactly the two new contract tests. EXPECT_MAIN 37 -> 39, native-memory 39/39.
Not run here: the other three contract targets.

Recorded gaps are in docs/src/testing/status.md (G-15). workspaces_exist is a constant false until the onboarding stage.

Refs: plane-byd.12.1
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@aRustyDev
aRustyDev merged commit 53dc6c0 into main Oct 24, 2026
28 checks passed
@aRustyDev
aRustyDev deleted the test/compat-fixtures-harness branch October 24, 2026 21:41
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