Skip to content

fix(cli,api,init,engine): clear bounded-risk residuals from the #402 follow-up ledger - #403

Open
enclavalabs wants to merge 3 commits into
mainfrom
issue-402
Open

enclavalabs wants to merge 3 commits into
mainfrom
issue-402

Conversation

@enclavalabs

@enclavalabs enclavalabs commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

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):

Deferred (remaining ledger items)

Tests

  • 3 new enclava-cli regression tests, each proven to fail on pre-fix code (sabotage run): diverging_log_key_flags_refuse_a_replay, a_seed_error_does_not_pre_empt_a_matching_saved_key, deployment_status_vocabulary_stays_classified.
  • enclava-cli lib 225 pass; enclava-init 211 lib pass; enclava-engine manifest_statefulset_test 23 pass; enclava-api models::tests passes.
  • cargo fmt --all --check and cargo clippy --workspace --all-targets -- -D warnings clean (remaining warnings are pre-existing vendored rdrand noise).

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_checks list could not be updated in this session (protected file) — the ci.yml step is the enforcement; the AGENTS.md line bash scripts/gen-template-deployment-status-vocabulary.sh should 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/--write honesty) are fixed in this PR.

Signed: enclava-coder (glm-5.3), reviewed by enclava-reviewer (grok-4.7).


Devin Review

 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)
devin-ai-integration[bot]

This comment was marked as resolved.

@enclavalabs enclavalabs left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_fixture iterates a hardcoded variant list, so a newly added DeployStatus variant 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) — the Ok(_) => "recovery seed derivation failed" arm is unreachable today (SeedError is only returned when derived.is_err()), and Derived => derived.ok().flatten() silently yields None if that invariant ever breaks. Both are defensible defensive choices; a debug_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 (folded statuses must fall through to the fail-open default); the script fails closed on zero extracted statuses.
  • DEPLOYMENT_ID_LABEL consolidation — single source of truth in enclava-engine::manifest, all five prior hardcoded copies (including tests) now consume it; behavior-identical.
  • SafeBootstrapDiagnostic.stage privacy — making "stage only from last_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)

@enclavalabs

enclavalabs commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Confidence: 5/5
Reason: Current-head CI is green and no live review threads remain.
Blockers: none
Next action: Owner reviews and decides; automation never merges.

…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.
@megatron-enclava megatron-enclava added the bug Something isn't working label Nov 18, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

…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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-pr Opened by the issue-to-PR pipeline bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants