Repository navigation
fix(cli,api,init,engine): clear bounded-risk residuals from the #402 follow-up ledger - #403
enclavalabs wants to merge 3 commits into
Conversation
follow-up ledger - cli: refuse diverging --log-key/--generate-log-key on a byte-identical replay instead of silently ignoring them (#402, #369-3) - cli: a recovery-seed error no longer pre-empts a saved bootstrap key that answers the signed request (#402, #369-4) - cli: pin the template-deployment status vocabulary in a generated fixture with a contract test against the classifier sets, wired into CI (#402, #369-1) - cli: name the enclava-paas owning code for the mirrored rejection rules and the verified idempotency-retention contract for live rows (#402, #369-2/5) - api,engine: export DEPLOYMENT_ID_LABEL from the engine crate and consume it in every reader (#402, #385-2) - api: document the per-claim probe-predicate cost, the shared-DB drain-and-ignore test caveat, and the probe-slice/poll-interval coupling (#402, #388-1/2/3) - init: stage-before-error write order comment; make stage-only-from- last_stage() structural via a private field + diagnose param (#402, #400-1/2)
enclavalabs
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Comment — no blocking findings. Both behavior changes go in the safe direction (refuse-and-explain instead of silently ignoring), the label consolidation is behavior-identical, and the vocabulary fixture/contract-test system is well built. Verified locally on the PR head (aa2bdcb, fresh clone, isolated CARGO_TARGET_DIR): enclava-cli template_deploy_retry 48/48 pass, enclava-api models::tests pass, enclava-init safe_diagnostics 8/8 pass, enclava-engine manifest_statefulset_test 23/23 pass, and scripts/gen-template-deployment-status-vocabulary.sh passes both the CAP half and the PaaS half (run against a live enclava-paas checkout via ENCLAVA_PAAS_CHECKOUT). At review time "Test Rust workspace" CI was still pending; everything else was green.
Critical
- None.
Warnings
- None.
Suggestions
- crates/enclava-api/src/models.rs (new test) —
deploy_status_vocabulary_is_pinned_against_the_cli_fixtureiterates a hardcoded variant list, so a newly addedDeployStatusvariant does not fail this unit test; only the shell script's CAP half catches that (regex over the enum). That's fine as designed, but a one-line comment saying "variant enumeration is enforced by gen-template-deployment-status-vocabulary.sh, not this test" would prevent a future reader from assuming the test pins completeness. - scripts/gen-template-deployment-status-vocabulary.sh (PaaS extraction) —
grep -oE '"[a-z_]+"'over the two PaaS functions captures every lowercase string literal in them, not just status arms; a future non-status literal (log line, field name) would false-positive as DRIFT. Fail-closed and noisy rather than silent, which is the right direction — just be aware the check may need tightening when PaaS evolves. - crates/enclava-cli/src/commands/template.rs (
peek_password_bootstrap_key) — theOk(_) => "recovery seed derivation failed"arm is unreachable today (SeedErroris only returned whenderived.is_err()), andDerived => derived.ok().flatten()silently yieldsNoneif that invariant ever breaks. Both are defensible defensive choices; adebug_assert!(derived.is_err())in the error arm would make the invariant explicit. NIT, non-blocking.
Looks Good
replay_log_key_flag_conflict— correct refusal semantics with an excellent user-facing message (names the flag, the stored key, and the two ways out); the both-flags case, no-flags case, and cross-flag match are all pinned by tests.password_resume_key_source_seed_fallible— the seed-error-no-longer-pre-empts-a-matching-saved-key fix preserves the original precedence exactly (saved-match first), and the regression test documents the pre-fix behavior.- Status vocabulary fixture +
deployment_status_vocabulary_stays_classified— pins fixture ↔ classifier sets bidirectionally with a clean fail-open/fail-closed story (foldedstatuses must fall through to the fail-open default); the script fails closed on zero extracted statuses. DEPLOYMENT_ID_LABELconsolidation — single source of truth inenclava-engine::manifest, all five prior hardcoded copies (including tests) now consume it; behavior-identical.SafeBootstrapDiagnostic.stageprivacy — making "stage only fromlast_stage()" structural rather than conventional is the right shape; all construction sites migrated.- Honest ledger: the deferred items (#369-6, #385-1/3/4) with reasons make the scope reviewable.
Note for the maintainer: the PR body asks for the bash scripts/gen-template-deployment-status-vocabulary.sh line to be added to AGENTS.md required_checks (protected file) — please add it on merge so the CI step has a local mirror.
Reviewed by Hermes Agent (pr-reviewer profile, glm-5.3)
|
Confidence: 5/5 |
…e to the tracker A template deploy with no log-key flag can still sign PaaS's already-active key. Persist that signed key id separately from explicit flag output so a retry naming the same --log-key resumes instead of being refused, without inventing a generated private-key path. diagnose no longer accepts a stage string. It reads the tracker record_stage writes, so a failure report cannot name a stage the run never reached.
…ivate key A matching active key id is not evidence that this machine generated a private key. Replay still re-posts the stored request, so --generate-log-key resumes only when a private-key path was already recorded for that id and the retry does not name a different file.
Progress on #402 — clears the bounded-risk, in-repo residuals from the follow-up ledger. This PR does NOT claim the full ledger: the deferred items and their reasons are listed below so the ledger stays honest.
Problem
The four maintainer-merged PRs (#369, #385, #388, #400) left 16 residual edge-class items (#402). Several are cheap contracts and comments that should land before the code drifts further; two are small but real behavior gaps.
Approach
Implemented (12 of 16 ledger items):
crates/enclava-cli/tests/fixtures/template_deployment_status_vocabulary.jsonwith contract tests on both sides:deployment_status_vocabulary_stays_classified(enclava-cli) pins fixture ↔IN_FLIGHT_STATUSES/TERMINAL_STATUSESboth ways, anddeploy_status_vocabulary_is_pinned_against_the_cli_fixture(enclava-api) pinsDeployStatusagainst the fixture.scripts/gen-template-deployment-status-vocabulary.shdrift-checks the owning servers' sources (PaaS half when a checkout is present) and is wired intoci.yml.template_instance_rejection_retires_attempt/unstamped_cap_rejection_is_permanent: enclava-paasserver/src/hosted_operations.rs::is_permanent_cap_rejection/record_permanent_rejection, and the replay window onhosted_operation_intents.replay_log_key_flag_conflict: a replayed request is byte-identical, so a retry naming different--log-key/--generate-log-keyvalues now refuses naming the flag instead of silently ignoring it.password_resume_key_source_seed_fallible: a recovery-seed error no longer pre-empts a saved per-app key that matches the signed request; the error surfaces only when no saved key answers.hosted_operation_intents.replay_activeholds whilepending/token_pendingandreplay_expires_at(24h) starts only at terminalization; CAP's reaper (IDEMPOTENCY_REAP_HORIZON_SECONDS, 24h untouched) settles quiescent reservations asidempotency_recovery_required, already on the retire list. Documented atTEMPLATE_DEPLOY_REPLAY_WINDOW_SECS; no extra bound needed.enclava.engine::manifest::DEPLOYMENT_ID_LABELis now the single source of truth; all five hardcodedenclava.dev/deployment-idcopies consume it.dispatcher_claim_wrappers_route_owner_wait_probes, and a doc note on theEXTENDED_OWNER_WAIT_PROBE_SLICE↔poll_intervalcoupling (a debug_assert would break the deliberately-tolerated 5 ms-poll test config).record_failure_file: stage-before-error write order is deliberate.SafeBootstrapDiagnostic.stageis now private, set only viadiagnose(error, stage)/with_stage; "stage only fromlast_stage()" is structural.Deferred (remaining ledger items)
cli_delete_app/validate_slug); needs a PR in that repo.tx.begin()where ordering allows. The 10 s cap andBeforeSupersessionshort-circuit already bound it; the reorder changes probe-to-supersession race semantics and needs its own reviewed change.publication_stamp_candidate→plan(..., BestEffort)reconciler refactor.recover_deleting_workload_publications.Tests
diverging_log_key_flags_refuse_a_replay,a_seed_error_does_not_pre_empt_a_matching_saved_key,deployment_status_vocabulary_stays_classified.manifest_statefulset_test23 pass; enclava-apimodels::testspasses.cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warningsclean (remaining warnings are pre-existing vendoredrdrandnoise).Risk
Low. Two behavior changes are refusals (safer direction: a diverging retry and a blocked-but-completable replay now stop instead of doing something unintended). Label constant consolidation is behavior-identical. Everything else is comments, fixtures, and tests. Note: the AGENTS.md
required_checkslist could not be updated in this session (protected file) — theci.ymlstep is the enforcement; the AGENTS.md linebash scripts/gen-template-deployment-status-vocabulary.shshould be added by a maintainer.Review
Reviewed by enclava-reviewer (grok-4.7), round 1 verdict: approve-with-comments. Both review warnings (drift check not CI-enforced; script fail-open/
--writehonesty) are fixed in this PR.Signed: enclava-coder (glm-5.3), reviewed by enclava-reviewer (grok-4.7).