#1152

fix(api): bind HTTP maintenance apply to the plan's token and ref

Openiamgpwants to merge intofrom

Closes the two gaps the review of #1219 found in the HTTP continuity maintenance path.

Token. A compaction plan carries before_revision and no plan_token. The CLI promotes the revision to the token, but /api/continuity/plan and /apply did not, so HTTP compactions journalled as compact:<table>:<ref>:None. Two plans at different revisions then shared one id (the second was refused with conflicting_claim), and the CLI and HTTP gave the same plan different ids. The derivation now lives in one place, phlo.operations.maintenance_plan_token, and the CLI plan, HTTP plan, and HTTP apply all use it. The HTTP plan response echoes the derived token in both plan_token and plan.plan_token.

Ref. ContinuityApplyRequest.ref defaulted to "main", so a plan for another ref applied without repeating ref mutated main. As in the CLI, which reads the ref only from the plan file, the plan now owns its ref. ref is optional with no default, and a request ref that disagrees with the plan returns 400 {"error": "ref_mismatch", "identifiers": [<request ref>, <plan ref>]} before any provider call.

Dagster maintenance ids are unchanged.

Tests. The maintenance API test now uses a compaction-shaped fake that returns before_revision only. The second apply uses a real second /plan response, and the test asserts the journalled ids compact:silver.orders:main:101 and ...:102. It also covers a feature-ref plan applied with a mismatched ref (refused, nothing executed) and without ref (executed on feature). On the old handlers the test fails with '' == '101'.

The support manifest maintenance reason now records this behaviour; both copies are identical and the manifest validator passes.

Verification: make check passed. The phlo-api package lane passed (1368 passed, 1 skipped). tests/cli/test_operations_maintenance.py passed (16). validate_support_manifest.py and check_version_drift.py passed.


    

Activity

315
coldtea-pr-lens[bot]3h ago
  • Redraw · drawn at a7d8464, the branch has moved on

Architecture


Data flow


Review

1 finding on the diff · 1 addressed · reviewed a7d8464

TIP

Open a diagram on the canvas, then press W or click play to walk through the change one step at a time

🪧 More tips
  • Run npx skills add coldteadotai/pr-lens, then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Run npx @coldtea/pr-lens-cli analyze --base origin/main on a branch, then npx @coldtea/pr-lens-cli render .pr-lens/graph.json. Same lenses, your own model key, before the pull request exists
  • Click the link under each diagram to open it on a canvas you can zoom, pan and step through
  • The diagrams are links. Click one to open it on the canvas, then press W or click play to walk through the change
  • The CLI's render reads .github/pr-lens.yml and applies your renames, exclusions and lane pins at draw time
  • Set github.comment.collapsed: true in .github/pr-lens.yml to fold the comment behind one View architecture… row. Drawing still runs as before
  • Set github.draw: on-demand in .github/pr-lens.yml and PR Lens stops drawing pull requests on its own. Comment @pr-lens draw on a pull request when you want that one drawn
  • Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and your model provider's key as its api-key to run PR Lens from your own CI. Any /chat/completions endpoint works
  • After a push, tick Redraw to draw the latest commit
  • Switch GitHub to dark mode and the diagrams follow. The moving dots are this pull request's data in motion
  • Set github.description: false in .github/pr-lens.yml to stop PR Lens adding buttons to your PR descriptions

Thanks for using PR Lens! It's free for OSS. If it helped, a star helps other teams find it. 

coldtea-pr-lens[bot]reviewed3h ago
coldtea-pr-lens[bot]reviewed3h ago
coldtea-pr-lens[bot]reviewed3h ago