interplane.Get Omega
Read in your language

aien-architecture-mv

Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories.

Brought by drakestapleton

branch main Branches Tags History

aien-architecture-mv / formal / invariants / artifact-receipt-v1.toml

124 lines · 6463 bytes Raw Blame History
1schema_version = 0
2id = "AIEN.INV.RECEIPT.REJECTION_CONSISTENCY.V1"
3version = 1
4status = "SEEDED"
5
6statement = """
7An admission receipt is internally consistent. A receipt whose decision is Rejected records that nothing ran \
8(execution status NotRun, no exit status, no syscalls, no object reads, no denials, no success-type result flags) \
9and records a rejection stage and a rejection reason. A receipt whose decision is not Rejected records no \
10rejection stage and no rejection reason. A receipt that claims the canary passed also records that execution \
11exited with status zero. An optional field whose presence flag is absent carries only its zero value and so \
12cannot be read as present."""
13
14assumptions = [
15 "Cryptographic identity: digests, nonce derivation, and the Ed25519 signature are sound. Crypto correctness is not proven here.",
16 "The receipt byte layout (512 bytes, magic AIENRCP, version 0) is the contract; the in-memory struct is a view.",
17 "Kernel-emitted receipts are unsigned; host tooling signs them.",
18]
19
20semantic_types = ["Receipt", "Decision", "ExecutionStatus", "PresenceFlags", "ResultFlags", "RejectionStage", "RejectionReason"]
21
22oracle_models = ["lean"]
23
24evidence_requirements = [
25 "positive corpus of valid receipts for each decision",
26 "negative corpus: one receipt per violated rule, each refused",
27 "deliberate mutant that accepts a Rejected receipt with a non-NotRun status, which must not survive",
28 "encode then decode preserves the abstract receipt where practical",
29 "existing implementation unit tests and existing admission receipts keep passing",
30]
31
32required_counterexamples = [
33 "rejected_but_ran",
34 "rejected_without_reason",
35 "non_rejected_with_rejection_fields",
36 "canary_passed_without_clean_exit",
37 "absent_flag_with_nonzero_value",
38]
39
40omega_takeover_condition = """
41Omega expresses the receipt consistency rules as native propositions over the canonical receipt layout, accepts the \
42positive corpus, rejects the negative corpus, kills the required counterexample mutants, and emits a canonical \
43proof/evidence identity that the gates consume, with Lean absent."""
44
45[[positive_examples]]
46name = "admitted_clean"
47description = "Decision Admitted, no rejection stage or reason, execution Exited with status 0, nonce matches verifier identity and sequence."
48
49[[positive_examples]]
50name = "rejected_at_stage"
51description = "Decision Rejected, stage 1..9, a valid reason code, status NotRun, all counters zero, result flags empty or only RECLAIMED."
52
53[[negative_examples]]
54name = "rejected_with_exit_status"
55description = "Decision Rejected but exit_status is nonzero or execution status is Exited."
56
57[[negative_examples]]
58name = "admitted_with_reason"
59description = "Decision Admitted but a rejection reason is present."
60
61[[negative_examples]]
62name = "canary_flag_after_fault"
63description = "CANARY_PASSED set while execution status is Fault."
64
65[[counterexamples]]
66name = "rejected_but_ran"
67description = "A Rejected receipt with status other than NotRun, or nonzero exit status, syscalls, object reads, or denials, is accepted."
68
69[[counterexamples]]
70name = "rejected_without_reason"
71description = "A Rejected receipt with stage 0 or reason 0 is accepted."
72
73[[counterexamples]]
74name = "non_rejected_with_rejection_fields"
75description = "A receipt whose decision is not Rejected, with a nonzero rejection stage or reason, is accepted."
76
77[[counterexamples]]
78name = "canary_passed_without_clean_exit"
79description = "CANARY_PASSED set without execution status Exited and exit status 0 is accepted."
80
81[[counterexamples]]
82name = "absent_flag_with_nonzero_value"
83description = "Machine id digest, generation, context id, or observed time is nonzero while its presence flag is clear, and the receipt is accepted."
84
85[[implementation_surfaces]]
86repo = "aien-dev/aienux"
87path = "crates/aienos-artifact/src/receipt.rs"
88kind = "production"
89observed_at = "2ee61b4b158a385c5fcf2c925a625ac043babb21"
90note = "Rust: receipt::validate (semantic rules) and receipt::decode / encode (strict byte layout)."
91
92[[observations]]
93surface = "crates/aienos-artifact/src/receipt.rs"
94text = """
95validate(r) returns MalformedReceipt when any of these hold. Presence flags: machine_id flag clear and machine_id_digest nonzero; \
96context_id flag clear and generation or context_id nonzero; timestamp flag clear and observed_time_ns nonzero. \
97Codes: rejection_stage > 9, or rejection_reason nonzero and not in 1..=19 or 0x101..=0x10a. \
98Decision Rejected: stage == 0, or reason == 0, or execution_status != NotRun, or exit_status != 0, or syscalls != 0, \
99or object_reads_ok != 0, or denials != 0, or result_flags has any bit other than RECLAIMED. \
100Any other decision: stage != 0 or reason != 0. \
101CANARY_PASSED set and (execution_status != Exited or exit_status != 0). \
102Nonce != receipt_nonce(verifier_identity, sequence)."""
103
104[[observations]]
105surface = "crates/aienos-artifact/src/receipt.rs"
106text = """
107decode applies strict layout checks first (length, magic, version, header size, unknown flag bits, nonzero reserved bytes, \
108signature algorithm) then calls validate, so every decoded receipt satisfies validate. encode is field by field and does not itself call validate."""
109
110[[observations]]
111surface = "crates/aienos-artifact/src/receipt.rs"
112text = """
113The decision enum is Admitted, Rejected, CanaryFailed, Destroyed. validate ties nothing between CanaryFailed or Destroyed decisions and the \
114execution status code CanaryFailed beyond the rules above (for example a CanaryFailed decision with execution status Exited is not refused by validate). \
115That linkage may be intended or a gap; it is recorded, not asserted."""
116
117[[observations]]
118surface = "PLAN.md section 10 versus code"
119text = """
120divergence in strength, not direction: the plan lists 'rejected => NotRun', 'rejected => no successful execution evidence', and 'rejected => stage/reason present'. \
121The code is stronger: Rejected also forces zero exit status, zero syscalls, zero object reads, zero denials, and result flags limited to RECLAIMED. \
122The plan's 'CANARY_PASSED => execution succeeded' maps to execution_status == Exited and exit_status == 0. \
123The plan's 'absent optional-field flag => value cannot be interpreted as present' maps to the three presence-flag rules above (values must be zero). \
124The plan's 'not rejected => rejection-only fields absent' maps to stage and reason both zero; the code treats only those two fields as rejection-only."""