test(provision): contract SSOT + producer-pin for the core→CP provision request #3058
Reference in New Issue
Block a user
Delete Branch "feat/provision-request-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds a consumer-driven contract guarding the core→control-plane provision request wire shape, so the two duplicated structs (core
cpProvisionRequest↔ CPwsProvisionRequest, in separate repos) can no longer silently drift.provision_request.contract.json— the SSOT field list forPOST /cp/workspaces/provision, each field taggedcp_consumestrue/false (+ a requirednotefor dead fields).provision_request_contract_test.go— producer pin:cpProvisionRequest's JSON tags must equal the contract exactly; dead (cp_consumes:false) fields must justify themselves.Why
core and the CP have no shared compile unit, so a field added on the sender does nothing if the receiver lacks it. That is exactly how
template_assetswas silently dropped — core fetches+sends config.yaml/prompts on that channel, the deployed CP has notemplate_assetsfield, so it's ignored, and SaaS boxes fall back toconfig_files(the restart re-stub class — seeproject_saas_restart_re_stub_config/ RFC #2843). No test caught it because the only thing exercising the seam was post-merge black-box staging e2e.The contract records today's reality honestly:
template_assetsis markedcp_consumes:falsewith a note flagging the dead channel (cleanup tracked separately) — converting an invisible bug into an explicit, reviewed decision.Guard behavior (verified)
Companion (separate PR, molecule-controlplane)
A consumer-completeness test:
wsProvisionRequestmust have a json tag for everycp_consumes:truefield in this contract. Together the two guards make the template_assets failure class impossible to reintroduce silently.Context
Step 1 of the local-test parity plan (catch contract drift at the seam, in-repo, on the PR that introduces it — instead of via deployed staging e2e). Follow-ups: CP consumer test; a local/docker
WorkspaceProvisionerbackend with SaaS parity.🤖 Generated with Claude Code
APPROVED. Five-axis review complete on current head
80f8e0e8.Correctness: the new provision_request.contract.json honestly captures the current core→CP wire shape, including template_assets as cp_consumes:false with a note documenting the dead channel. The producer-side test reflects cpProvisionRequest JSON tags and requires exact equality with the contract field keys, so an added drift field or removed field fails until the contract is deliberately updated. Dead fields must carry a note, preventing silent sent-but-ignored channels.
Robustness/security/performance/readability: pure unit-test/contract addition; no runtime behavior, auth, or provision logic changes. The failure messages are specific enough to guide future producer/consumer updates. Visible core unit/build/all-required contexts are green; staging SaaS contexts are failing, but this PR is pure contract-test and those appear unrelated to this unit guard. No code blockers found.
agent-dev-a referenced this pull request2026-06-19 22:36:26 +00:00