Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(package-service): add private package state model (#1750) - #1800

Merged
joshuajbouw merged 6 commits into
os/universalfrom
codex/package-service-state-model-1750
Sep 1, 2026
Merged

joshuajbouw merged 6 commits into
os/universalfrom
codex/package-service-state-model-1750

Conversation

@joshuajbouw

@joshuajbouw joshuajbouw commented Sep 1, 2026

Copy link
Copy Markdown
Member

Linked Issue

Tracking #1750

Summary

Repairs the private registry-neutral package-service contract and pure owner/package state model at the rejected exact head.

This slice adds no package parsing, transport, durable persistence engine, execution wiring, or external authority mapping. It does not close #1750.

Changes

  • Drain commits now enforce the authoritative drain deadline even after accepted zero-lease proofs, so a late commit with a valid receipt can no longer complete a replacement or retirement after the drain window closes.
  • Drain proofs fail closed at the exclusive authority expiry, including when the drain deadline and expiry coincide.
  • Unknown non-drain operations on an absent slot reach a conservative terminal outcome during recovery instead of remaining unresolved.
  • Unknown records reported before a drain starts, and executing records left past the drain deadline, terminate safely without fencing the slot.
  • Admitted intents left past their authority expiry reach a safe terminal outcome, releasing the nonce and slot.
  • Generation exhaustion is preflighted at admission and drain start, and proof advancement refuses boundaries that could never commit or restore.
  • Work past a closed drain deadline fails closed at begin_work, and the artifact budget is rechecked at commit.
  • Package-service test fixtures derive nonce and signing material instead of embedding hard-coded cryptographic values.

Repair Law

  • Validate artifact budgets before first admission and at plan validation.
  • Reject Exact zero state so it cannot substitute for absence.
  • Bind authority class into the signed payload and retain the admitting authority for cancel and recovery.
  • Reject stale authority admission without creating a durable nonce.
  • Bind commit and drain runtime receipts exactly and enforce the drain deadline after accepted proofs.
  • Restore expiry and old-state recovery as the exact inactive successor of the authoritative drain boundary, advancing generation.
  • Recover zero-, one-, and many-proof old-state outcomes and explicit non-drain unknowns.
  • Name plan/operation conflicts and state that nonce replay protection lasts only through retained bounded history.
  • Use canonical OwnerId encoding and conservative durable-record accounting.

Verification

  • cargo test -p astrid-package-service --all-features --all-targets --locked
  • cargo check --workspace --all-features --all-targets --locked
  • cargo clippy --workspace --all-features --all-targets --locked -- -D warnings
  • cargo fmt --all --check
  • git diff --check
  • python3 scripts/changelog.py check --base b868d0a770704fbca262e27ed2e6bd08c9ec5133 --head HEAD
  • GPG commit verification and DCO author match

AI / Tool Assistance

Assisted-by: Codex

Codex drafted the successor repair, tests, changelog update, and workspace evidence. Independent review remains required.

Checklist

  • Linked to an issue
  • Changelog fragment updated under changes/{issue}.{kind}.md
  • I understand every change in this PR and can explain its design, risks, and validation.
  • I reviewed and tested any meaningful tool-generated output included in this PR.
  • Every non-bot, non-merge commit has a matching Signed-off-by trailer.

Add canonical context binding, Ed25519 authority verification, public provenance digest derivation, bounded durable history, and a pure owner/package lifecycle model with drain, recovery, replay, and quota behavior.

Assisted-by: Codex
Signed-off-by: Joshua J. Bouw <[email protected]>
@joshuajbouw joshuajbouw added campaign/os-universal Tracked by the Astrid Universal Substrate campaign project feat New feature or capability labels Sep 1, 2026

@github-advanced-security github-advanced-security AI 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.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Validate first-install budgets and plan compatibility, reject zero-state substitution and stale admission, bind authority class and exact receipts, enforce drain deadlines after proofs, restore inactive successor boundaries, reconcile old-state and non-drain unknowns, and make replay protection match bounded retention.

Assisted-by: Codex

Signed-off-by: Joshua J. Bouw <[email protected]>
- enforce the drain deadline at commit after accepted proofs
- reject drain proofs at the exclusive authority expiry
- terminate unknown, pre-drain, and expired-intent records without
  fencing the slot, restoring the boundary only for real drain lineage
- preflight generation headroom at admission, drain start, and proof
  advance so exhausted boundaries can never strand a record
- fail begin_work closed past the drain deadline and recheck the
  artifact budget at commit
- derive test nonce and signing material instead of hard-coded
  cryptographic values, and split drain regressions into their own
  integration test file

Signed-off-by: Joshua J. Bouw <[email protected]>
Assisted-by: Codex
Signed-off-by: Joshua J. Bouw <[email protected]>
Comment thread crates/astrid-package-service/src/context.rs Fixed
Keep canonical framing and nonce bytes as separate hash inputs while preserving the exact domain, length, and field-byte digest stream.

Assisted-by: Codex
Signed-off-by: Joshua J. Bouw <[email protected]>
@joshuajbouw

Copy link
Copy Markdown
Member Author

Independent exact-head review accepted a14b3e27706354138a1473ff39590e44c944107a for digest-field isolation. Required CodeQL still reports the OwnerId encoding-buffer alert at crates/astrid-package-service/src/context.rs:312. Exclusive repair continues. Draft remains Tracking #1750 and does not close the contract.

The canonical owner helpers seeded their encoding scratch with a constant
zero array, which static analysis classifies as hard-coded cryptographic
material. Build the buffer with a runtime fill instead:
OwnerId::encode_canonical overwrites every byte of an exactly sized
output before returning, so the canonical bytes are unchanged.

Assisted-by: Codex
Signed-off-by: Joshua J. Bouw <[email protected]>
@joshuajbouw
joshuajbouw marked this pull request as ready for review September 1, 2026 19:09
@joshuajbouw
joshuajbouw merged commit f0d64ee into os/universal Sep 1, 2026
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

campaign/os-universal Tracked by the Astrid Universal Substrate campaign project feat New feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants