Repository navigation
feat(fleet-queue): DST-01 shared Command/Result contract in work/contracts.rs (#9451) - #12886
Merged
Merged
Conversation
…racts.rs (#9451) The shared fleet.command/v1 / fleet.result/v1 envelope, (authority_id, work_id) pair identity with numeric work-ID ordering, canonical decimal-string versions, the effect-separated reason-code registry (15 codes from the #9200 component, each with its permitted field effects), the auth-vs-actor distinction (actor_ref is audit-only; a client `authorized` field is a typed contract violation), the fleet.owner-priority-policy/v1 observation with its atomic ref check, and the RFC 8785 JCS + SHA-256 digest framing from architecture.md, verified against the published framing vectors. Proven by the issue's two named oracles: pmo_distribution_command_identity_reason_and_version and pmo_distribution_command_policy_ref_round_trips; full fleet-queue lib suite passes (513 passed / 0 failed). Wiring beyond the owned file: the one-line module export in work/mod.rs and the sha2 workspace dependency (already a workspace dependency) in fleet-queue's Cargo.toml, with its lock edge.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 seconds. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements DST-01 (#9451), the shared Command/Result contract slice of the PM orchestration design (#9200, program #9196), in its owned file
pkgs/fleet/crates/fleet-queue/src/work/contracts.rs:Command(fleet.command/v1) andCommandResult(fleet.result/v1) exactly asarchitecture.mdfixes them: snake_case wire names, explicitly nullable optionals, the sharedResult.outcomevocabulary (rejected…verified_complete), effects naming requested/observed/verified separately.WorkRef(authority_id, work_id); authority compared bytewise, work ID by arbitrary-precision integer value (9 < 10despite the string encoding);fleet://<authority>/work/<id>qualified URI.work_versionbeyond the u64 range round-trips exactly; a JSON number in a version's place is a typed schema failure).check_field_effectrefuses pairings the registry does not permit. Unknown codes return typedunsupported_reason_codeand are never aliased; unknown major schema versions return typedunsupported_version.actor_refis audit-only and is never consulted byevaluate_authorization, which reads only the authenticated principal's verified capabilities. A client payload carrying anauthorizedfield is rejected as a typed contract violation before any other interpretation.fleet.owner-priority-policy/v1observation DTO and the atomic ref check: matching ref passes, stale ref →OWNER_POLICY_VERSION_CONFLICT, missing ref fails closed. Denied protected mutations carryOWNER_POLICY_PROTECTED.ASCII(domain) || 0x00 || UTF8(JCS(dto)), SHA-256,sha256:+ 64 lowercase hex) over the exact intent DTO; domains only from the registry. Delivery/operation/dry-run changes do not move the digest; intent/precondition changes do.Wiring beyond the owned file (noted per the sibling-slice pattern): one-line module export in
work/mod.rs, andsha2 = { workspace = true }in fleet-queue'sCargo.toml(sha2 0.11 is already a pkgs/fleet workspace dependency) with its singleCargo.lockedge.Evidence
Ran on the laptop (
amd-6), worktree offorigin/main(4c01d0497c7), through~/tools/fleet-build-lock:cargo test --manifest-path pkgs/fleet/Cargo.toml -p fleet-queue --lib --features client,queue-broker -- --list→work::contracts::tests::pmo_distribution_command_identity_reason_and_version: testandwork::contracts::tests::pmo_distribution_command_policy_ref_round_trips: test.pmo_distribution_command_identity_reason_and_version→ 1 passed / 0 failed;pmo_distribution_command_policy_ref_round_trips→ 1 passed / 0 failed. The identity/reason/version oracle enumerates each of the 15 reason codes against the registry table, checks the field-effect boundary and no-mutation on every refusal, covers the digest golden vectors fromcontracts/digest-vectors.jsonbyte-for-byte, and proves an owner-lookingactor_refwithout a principal authorizes nothing.rustfmt --checkon the new file: clean.The gate decision that unblocked this slice (the recorded "#9200 closed" gate leg was inverted — the container closes when its children complete) is recorded on #9451 as a
decision:v1note (comment 7091462341). Production adoption, migration, deployment and live acceptance remain separately authorized stages, as the issue states; this PR is the offline contract + fixtures work.Merge Danger
Low. The module is additive and nothing consumes it yet; the only edits to existing files are the one-line module export, the one-line dependency declaration, and its lock edge. Revert is a single-commit revert with no data or wire impact.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.