Skip to content

v3.0.0 fix: persist settlement inputs before resuming stored jobs - #372

Merged
djh58 merged 2 commits into
3.x.xfrom
djh58/prism-b370-resume-inputs
Sep 15, 2026
Merged

djh58 merged 2 commits into
3.x.xfrom
djh58/prism-b370-resume-inputs

Conversation

@djh58

@djh58 djh58 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

Summary

Persist the settlement inputs captured when prepared work is built, and require those inputs to match before resuming a stored job. Builder-version or CTV configuration changes produce a cache miss; legacy rows without inputs also miss, while malformed records remain backend errors.

Compatible jobs retain their original bundle, settlement inputs, worker identity and expiry. Compatibility is checked before the live fee check: incompatible work returns a miss even where the base branch could surface a fee error first; compatible work retains fee admission.

Centralize compact input conversions and extract the stored-input compatibility decision. Both formats require an explicit ctv key, with null representing no CTV; the compact storage reader already rejected omission through canonical re-encoding. Valid compact serialization, legacy round-trip bytes, cancellation owners and clock semantics remain unchanged. The nonoptional input view remains documented beside the durable representation.

Refs #370

Validation

  • Disposable-PostgreSQL runner: 270 server library tests passed, 2 ignored; 13 compact-storage tests passed.
  • Execution manifest: 54 distinct gated checks executed, none skipped or failed (42 library and 12 compact-storage checks).
  • Final focused resume-input suite: 9 passed, covering original identity/expiry, standard/CTV/bootstrap work, legacy and configuration misses, malformed records, and configuration-error propagation.
  • Compact tests cover explicit-null/missing CTV, real storage lookup/retry rejection, unchanged canonical encoding, cancellation ownership and legacy payload hashes.
  • cargo clippy --locked --workspace --all-targets -- -D warnings, cargo fmt --all --check, and git diff --check: passed.

Review status

  • Thermo findings, dispositions and appended fix evidence.
  • Initial head 5072308: medium-effort and Codex adversarial reviews found no actionable issue; the coordinator reports Fable adversarial completed with no refutation found. Bugbot and CI passed on that initial head.
  • Appended fix: 7406ff966d4c12a2baa81fc318e0c95da14db97f. Focused independent verification and CI for this head are pending; the full review is not complete.

No merge, schema migration, compact runtime activation or production change. Signing configuration, VERSION and CHANGELOG are unchanged.

@djh58

djh58 commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5072308. Configure here.

@djh58

djh58 commented Sep 15, 2026 •

Copy link
Copy Markdown
Member Author

PR #372 thermo review dispositions

Reviewed head: 50723083d94420c10d14f9d0b4ac14d7c30870ff.

  1. Partially accepted; fixed in 7406ff9. Centralize compact-to-BundleInputs conversion and a constructor taking the original BundleInputs, keeping compact fields and serialization order intact. The reported storage-level missing-ctv inconsistency is not reachable: ledger/jobs/prepared.rs::decode_row already compares canonical re-encoding against the original payload, so omission differs from explicit null and is rejected. Make direct compact deserialization reject omission too; explicit null remains valid and valid stored bytes stay unchanged.
  2. Accepted documentation correction. Keep the nonoptional Prepared.inputs view used by build/submit and the explicit original-build handoff. Document that it copies the same captured/persisted value, and that resumed work now knows its inputs but is already issued, so cannot supply the unpublished original-build authority required by compact capture. Removing the view would spread an optional legacy-storage invariant into existing callers without fixing a demonstrated divergence.
  3. Accepted; fixed in 7406ff9. Extract the existing legacy/config/bundle compatibility decision into StoredPrepared::issued_inputs, preserving gate ordering, fee checks, cancellation owners, clock domains and deadlines.
  4. Accepted documentation correction. Compatibility precedes the live fee check deliberately: incompatible stored work returns a cache miss even when the current fee would reject it; compatible work still performs the fee check. This is an operator-visible change from the base branch and will be stated in the PR description.
  5. Accepted. Explain that deserialize_with = "Option::deserialize" requires a ctv key, with explicit null representing no CTV.
  6. Accepted. Replace string-selected mutation matches with typed closure tables, retaining every scenario and its diagnostic label.

Appended fix and validation

Pushed commit: 7406ff966d4c12a2baa81fc318e0c95da14db97f (diff). Findings 1, 3, 5 and 6 have bounded code/test changes; findings 2 and 4 have the documented dispositions above. The five-file fix keeps both persisted layouts and the existing cancellation owners, fee-gate position and absolute-to-monotonic expiry calculation.

Executed locally:

  • Repository disposable-PostgreSQL runner with cargo test --locked -p qbit-prism-server --lib --test compact_prepared_storage -- --nocapture: 270 library tests passed, 2 ignored; 13 compact-storage tests passed.
  • The execution manifest records 54 distinct gated checks executed, none skipped or failed (42 library + 12 compact-storage); the additional compact encoding test is ungated.
  • Final focused coordinator::miner_tests::resume_inputs: 9 passed, including a direct policy test proving stored-reference identity, legacy misses and configuration-error propagation.
  • cargo clippy --locked --workspace --all-targets -- -D warnings, cargo fmt --all --check, and git diff --check: passed. A test-only type alias resolved the initial Clippy type-complexity finding; the focused suite was rerun afterward.
  • PostgreSQL regression confirms explicit-null CTV is accepted, omission remains an error, and retry cannot accept the corrupt row. Existing capture/hydration cancellation and legacy-byte/hash round-trip tests passed.

The coordinator reports the independent Fable adversarial review of 5072308 completed with no refutation found. Focused independent verification of 7406ff9 has been requested; its result and CI for the new head remain pending, so the full review is not complete. No merge, version bump, signing-configuration change, migration or compact runtime activation was performed.

Keep compact input conversions together and extract the inline resume
compatibility decision without moving fee admission, cancellation owners,
or the original expiry calculation. Document why Prepared keeps a typed
input view and why resumed work cannot authorize original compact capture.

Require an explicit ctv key in direct compact decoding, matching the
storage reader that already rejects omitted keys via canonical re-encoding.
Preserve explicit null, flat compact fields, field order and legacy bytes.

Incompatible inputs still return a miss before the live fee check; compatible
work retains that check. Cover the policy directly and exercise missing-CTV
rejection through the real PostgreSQL reader and retry path.

Refs #370
@djh58

djh58 commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

Coordinator final verification: independent Fable reviewed 5072308..7406ff9 and found no remaining findings. It independently confirmed unchanged persisted serialization, strict omitted-versus-null CTV handling, preserved compatibility/fee ordering, and untouched cancellation/expiry ownership. Disposable PostgreSQL qualification passed 270 library tests and 13 compact-storage tests; Clippy and formatting passed. Current-head CI is now green after the documented single startup-timeout retry; artifact provenance was verified and the original cause remains unconfirmed. All initial review lanes and thermo dispositions are accounted for. This supersedes earlier pending-final-verification wording. Ready on this reviewed head; recheck integration if the base changes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant