mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 14:05:49 +00:00
* feat(evidence)!: name the Evidence subject by its target identity (format revision 2) The Evidence subject carries subject.identity (kind, sha256, format, architecture, selection) and the Evidence ID commits to it, so raw/DOL entry points and ESP flash offsets of the same bytes are different subjects. Every record declares evidence_format: 2; revision 1 bundles, standalone records and snapshots are refused with the recreate guidance. binaryTargetIdentity is the one projection of an open target, used by Evidence and snapshot comparison. BREAKING CHANGE: Evidence format revision 2. Evidence IDs commit to the subject's target identity (subject.identity, including the raw/DOL entry point or ESP flash offsets), and every record declares evidence_format: 2. Evidence bundles, records and analysis snapshots from earlier releases are refused; recreate the observations with this release. * refactor(analysis-view): read parent subjects through the Evidence identity accessors (#11423) Analysis views compare their parent's file identity (evidenceFileTarget) and take path and digest from evidenceSubjectTarget instead of reading the subject's digest, format and architecture members, which duplicate subject.identity until they are removed. A counted guard (evidence-subject-declaration-read) keeps new direct reads out and records the 20 remaining files. * fix(evidence): carry format refusals through Evidence readers and bind target selections - safeParseEvidence/safeParseImmutableEvidence return the format refusal as an expected failure; every consumer maps it to the one integrity refusal with the recreate guidance. An unmarked object is an earlier record only when it has every member records have always carried. - ArtifactProvider inventory roots and provider subjects that name the target's own bytes carry the target's selection (ESP flash offsets). - Snapshot rows bind only Evidence whose identity, selection included, matches the snapshot target. - Entry-point selections use the raw-binary entry point form. * fix(evidence): refuse unauthenticated or earlier-format records instead of reading them as absent - recognizeEvidence (evidenceValidation) replaces tryParseEvidence: input without an evidence_id is not Evidence (ok(undefined)); a record that names one but fails authentication or is from another format revision is an EvidenceIntegrityError carrying the recreate guidance, never undefined. - Direct analysis retains that refusal as a secondary failure instead of silently skipping source capture; cleanup projection, source-closure annotation and the flutter, debugger and release-exposure recoveries use the same owner (the last three previously read the unauthenticated schema). - A desktop capture.json from an earlier format is refused with the recreate guidance instead of "not desktop application capture Evidence". * fix(evidence): advertise revision 2 ledger examples and rank delivery omissions by serialized size - The obligation ledger and reconstruction coverage examples named evidence_format 1, which revision 2 refuses; they now use EVIDENCE_FORMAT_REVISION. - MCP delivery chose which unretained recovery to omit by a parsed-storage lower bound clipped at the response budget. Once revision 2 subjects made the source record's estimate cross the budget, both candidates tied at the clip and the smaller source was omitted ahead of the larger completed observation. Candidates are now ranked by serialized size, which is what the budget counts. * refactor(native): compare function snapshots by their Evidence target identity (#11450) Function snapshots carry the subject's file target identity instead of the duplicated subject declaration. Call paths and function comparisons compare targets through sameTargetIdentity, so the same bytes opened at a different raw entry point or ESP flash offset no longer count as one coordinate space: build_call_path refuses the mix, and compare_functions no longer matches entries by address across selections. Structural candidates and native function matching read the architecture and digest through evidenceFileTarget. Refs #11417 * refactor(artifacts): compare artifact and WASM summaries by their Evidence target identity (#11461) Artifact comparison authenticates a summary against its retained inventory through sameTargetIdentity and rebinds the alias with the whole target, selection included, so a flash-selected inventory summary taken under an alias path is no longer refused. WASM comparison, the analysis view artifact projection and the inventory root check read the digest, format and display path through the Evidence identity accessors. Refs #11417 * refactor(evidence): read record subjects through the identity accessors in JS, managed, ledger and bundle readers (#11470) JavaScript application graphs, runtime reconciliation, managed inspection and native verification sources, the record summary filter, the ledger's residual-unknown target and bundle scope selection read the subject digest, format and display path through evidenceFileTarget and evidenceSubjectDisplay. No comparison changes: each reader matches one record's facts against its own payload or a caller filter. Refs #11417 * refactor(evidence)!: name the Evidence subject only by its target identity (#11497) * refactor(evidence)!: name the Evidence subject only by its target identity The subject keeps `identity` and the display facts `name` and `local_path`. The duplicated `digest`, `format` and `architecture` members are removed; the format-owned declaration now validates the identity itself. Readers the type checker found move to the owner accessors; untyped reads in verify scripts, the efficiency harness and test matchers move to `subject.identity`. The `evidence-subject-declaration-read` text guard and its baseline are deleted. Fixes #11473 Refs #11417 BREAKING CHANGE: the Evidence subject no longer has `digest`, `format` or `architecture`; read `subject.identity.sha256`, `subject.identity.format` and `subject.identity.architecture`. A record that still carries them is refused. * test(evidence): give the Flutter verifier fixture the identity subject and check the DOL declaration without the ID * test(evidence): drop the removed subject members from the declaration matrix and tamper fixtures * feat(evidence)!: give every Evidence record an explicit subject identity (#11536) * feat(evidence)!: give every Evidence record an explicit subject identity A producer that cannot name a file passes an `unknown` target identity with a closed reason (derived-from-linked-evidence, not-observed, unsupported-subject) instead of no subject. The subject is non-null; unknown subjects have no display facts. The generic missing-subject limitation and `subjectUnavailableReason` are removed; producer-specific explanations are ordinary limitations. Comparison identity requires the derived unknown, and null-subject consumers ask the owner accessors. Refs #11417 BREAKING CHANGE: every Evidence record has a subject. A record without a file target names `subject.identity` `{ "kind": "unknown", "reason": … }` with `name` and `local_path` null, instead of `subject: null` and the limitation "Artifact identity is unavailable for this observation.". Their Evidence IDs change. * fix(evidence): name explicit unknown subjects in JavaScript callers and keep a managed graph's file subject The verification scripts are not type-checked, so five createEvidence callers still passed undefined (or a missing first target) after the subject became required. They now pass unknownTarget("not-observed"). A managed application graph chose the first present input subject. Every subject is now present, so an unknown artifact subject hid a file subject on the member or boundary Evidence. The graph now takes the first input subject that names a file. * test(evidence): assert the subject kind instead of a presence the type now guarantees Every Evidence record has a subject after this change, so test guards and assertions that checked it for null always passed. Each now checks that the fixture subject names a file, or is removed where a later fileIdentity, fileSubjectTarget or fileSubjectDisplay call already requires that. Non-null assertions on Evidence subjects are removed; analysis-view inputs, whose subject is optional, keep an undefined check. * test(evidence): expect the Evidence subject format under its identity Two boundary tests still matched subject.format, which slice 2e moved into subject.identity. toMatchObject is not type-checked against the Evidence shape, so they failed only when run (the signature test on macOS).
424 lines
15 KiB
Markdown
424 lines
15 KiB
Markdown
# Reconstruction obligation ledgers
|
|
|
|
`build_reconstruction_obligation_ledger` turns authenticated Evidence records
|
|
into a deterministic list of reconstruction claims. The same workflow
|
|
is available as:
|
|
|
|
- MCP tool: `build_reconstruction_obligation_ledger`
|
|
- CLI command: `rea build-reconstruction-obligation-ledger`
|
|
|
|
The ledger is conservative by design. Static Application Graph facts create
|
|
candidate obligations; they do not prove runtime or process behavior. A required
|
|
obligation closes only when one manifest binding supplies a unique owner, any
|
|
required parser/schema/domain type, every required case fixture, and a passing
|
|
verifier whose authority is comparable to the original observation. The
|
|
verifier must enumerate the obligation ID and its result must be present in the
|
|
input Evidence bundle. Contradictions, duplicate definitions or owners,
|
|
residual unknowns, missing dependencies, and unavailable authority keep closure
|
|
open or failed.
|
|
|
|
Original process authority requires observed `controlled-replay` Evidence with
|
|
a supported process-capture provider and a valid capture payload. A matching
|
|
operation or predicate alone does not establish that authority, including for
|
|
reviewed obligations and manifest original cases.
|
|
|
|
Every fixture and verifier proof must bind its outcome to the exact owner
|
|
implementation digest and obligation revision being evaluated. See
|
|
[proof applicability](#proof-applicability) for the caller-produced contract.
|
|
|
|
## Complete CLI request
|
|
|
|
This empty request is useful for checking client integration. It is valid and
|
|
returns an `unknown` ledger with zero obligations; absence of source Evidence
|
|
never claims closure:
|
|
|
|
```sh
|
|
rea build-reconstruction-obligation-ledger \
|
|
'{
|
|
"evidence_bundle": {
|
|
"evidence_format": 2,
|
|
"artifacts": [],
|
|
"providers": [],
|
|
"environments": [],
|
|
"scenarios": [],
|
|
"captures": [],
|
|
"unknowns": [],
|
|
"records": []
|
|
},
|
|
"reviewed_obligations": [],
|
|
"manifest": {
|
|
"bindings": [],
|
|
"contradictions": []
|
|
}
|
|
}' \
|
|
--json
|
|
```
|
|
|
|
For a real investigation, export an Evidence bundle from the session and replace
|
|
the empty bundle. Application Graph and process capture records generate
|
|
conservative candidates automatically. Add reviewed obligations when a required
|
|
claim is not represented by those sources.
|
|
|
|
## Reviewed obligation examples
|
|
|
|
Each example below is a complete `reviewed_obligations` element. Replace the
|
|
sample Evidence ID with an authenticated review record already present in
|
|
`evidence_bundle.records`. Stable IDs and versions make changes reviewable.
|
|
|
|
### CLI parsing
|
|
|
|
```json
|
|
{
|
|
"obligation_id": "cli.config.invalid-option",
|
|
"obligation_version": 1,
|
|
"title": "Reject an invalid configuration option with the supported CLI error",
|
|
"application_layer": "cli",
|
|
"family": "argument-parsing",
|
|
"target": {
|
|
"artifact_sha256": null,
|
|
"application_node_id": null,
|
|
"semantic_node_id": null,
|
|
"location": "rea --unknown-option"
|
|
},
|
|
"required": true,
|
|
"required_case_kinds": ["positive", "negative", "malformed"],
|
|
"required_original_authority": "process",
|
|
"required_fixture_authority": "packaged-process",
|
|
"required_verifier_authority": "packaged-process",
|
|
"requires_parser_type": true,
|
|
"dependency_obligation_ids": [],
|
|
"residual_unknown_ids": [],
|
|
"unavailable_authority": [],
|
|
"required_next_evidence": ["Capture the installed CLI for all three cases."],
|
|
"disposition": "active",
|
|
"review_evidence_ids": [
|
|
"ev_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
]
|
|
}
|
|
```
|
|
|
|
### Protocol handler
|
|
|
|
```json
|
|
{
|
|
"obligation_id": "protocol.rpc.cancel",
|
|
"obligation_version": 1,
|
|
"title": "Cancel an in-flight request and emit one terminal response",
|
|
"application_layer": "protocol",
|
|
"family": "request-response",
|
|
"target": {
|
|
"artifact_sha256": null,
|
|
"application_node_id": null,
|
|
"semantic_node_id": null,
|
|
"location": "JSON-RPC request cancellation"
|
|
},
|
|
"required": true,
|
|
"required_case_kinds": ["positive", "negative", "malformed", "cancellation"],
|
|
"required_original_authority": "external",
|
|
"required_fixture_authority": "protocol",
|
|
"required_verifier_authority": "protocol",
|
|
"requires_parser_type": true,
|
|
"dependency_obligation_ids": [],
|
|
"residual_unknown_ids": [],
|
|
"unavailable_authority": [],
|
|
"required_next_evidence": [
|
|
"Record request, cancellation, and terminal response IDs."
|
|
],
|
|
"disposition": "active",
|
|
"review_evidence_ids": [
|
|
"ev_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
|
|
]
|
|
}
|
|
```
|
|
|
|
### Electron startup and background behavior
|
|
|
|
```json
|
|
{
|
|
"obligation_id": "electron.background.startup",
|
|
"obligation_version": 1,
|
|
"title": "Start the background process before exposing the renderer bridge",
|
|
"application_layer": "electron",
|
|
"family": "startup",
|
|
"target": {
|
|
"artifact_sha256": null,
|
|
"application_node_id": null,
|
|
"semantic_node_id": null,
|
|
"location": "main process startup"
|
|
},
|
|
"required": true,
|
|
"required_case_kinds": ["positive", "negative", "teardown"],
|
|
"required_original_authority": "runtime",
|
|
"required_fixture_authority": "renderer",
|
|
"required_verifier_authority": "renderer",
|
|
"requires_parser_type": false,
|
|
"dependency_obligation_ids": [],
|
|
"residual_unknown_ids": [],
|
|
"unavailable_authority": [],
|
|
"required_next_evidence": [
|
|
"Observe main/renderer ordering and application shutdown."
|
|
],
|
|
"disposition": "active",
|
|
"review_evidence_ids": [
|
|
"ev_cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
|
|
]
|
|
}
|
|
```
|
|
|
|
### Persistence migration
|
|
|
|
```json
|
|
{
|
|
"obligation_id": "persistence.profile.migrate-v2",
|
|
"obligation_version": 1,
|
|
"title": "Migrate a version-one profile without losing unknown fields",
|
|
"application_layer": "persistence",
|
|
"family": "migration",
|
|
"target": {
|
|
"artifact_sha256": null,
|
|
"application_node_id": null,
|
|
"semantic_node_id": null,
|
|
"location": "profile schema v1 to v2"
|
|
},
|
|
"required": true,
|
|
"required_case_kinds": ["positive", "negative", "malformed"],
|
|
"required_original_authority": "runtime",
|
|
"required_fixture_authority": "integration",
|
|
"required_verifier_authority": "integration",
|
|
"requires_parser_type": true,
|
|
"dependency_obligation_ids": [],
|
|
"residual_unknown_ids": [],
|
|
"unavailable_authority": [],
|
|
"required_next_evidence": [
|
|
"Compare pre-migration and committed storage snapshots."
|
|
],
|
|
"disposition": "active",
|
|
"review_evidence_ids": [
|
|
"ev_dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"
|
|
]
|
|
}
|
|
```
|
|
|
|
### Native ABI
|
|
|
|
```json
|
|
{
|
|
"obligation_id": "native-abi.helper.status",
|
|
"obligation_version": 1,
|
|
"title": "Preserve the helper status-code and output-buffer contract",
|
|
"application_layer": "native-abi",
|
|
"family": "ffi",
|
|
"target": {
|
|
"artifact_sha256": null,
|
|
"application_node_id": null,
|
|
"semantic_node_id": null,
|
|
"location": "helper_status(const uint8_t *, size_t, uint8_t *, size_t *)"
|
|
},
|
|
"required": true,
|
|
"required_case_kinds": ["positive", "negative", "malformed"],
|
|
"required_original_authority": "process",
|
|
"required_fixture_authority": "native-abi",
|
|
"required_verifier_authority": "native-abi",
|
|
"requires_parser_type": true,
|
|
"dependency_obligation_ids": [],
|
|
"residual_unknown_ids": [],
|
|
"unavailable_authority": [],
|
|
"required_next_evidence": [
|
|
"Run the ABI harness against the shipped and reconstructed libraries."
|
|
],
|
|
"disposition": "active",
|
|
"review_evidence_ids": [
|
|
"ev_eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
|
]
|
|
}
|
|
```
|
|
|
|
## Manifest and closure
|
|
|
|
A manifest binding names one owner and a caller-supplied `owner_sha256`. Both
|
|
`original_cases` and the reconstruction fixture list must cover every
|
|
`required_case_kinds` value with authenticated, comparable Evidence.
|
|
`parser_type` is mandatory when `requires_parser_type` is true.
|
|
|
|
The ledger does not read `module_path`, execute `verifier.command`, or compute
|
|
the implementation digest. The owner fields do not specify whether the digest
|
|
covers module bytes, a symbol representation, or a multi-file implementation.
|
|
The proof producer must document the exact hashed inputs and any canonicalization
|
|
so another verifier can reproduce that commitment; a path or symbol name alone
|
|
does not define it.
|
|
|
|
```json
|
|
{
|
|
"obligation_id": "protocol.rpc.cancel",
|
|
"owner": {
|
|
"module_path": "src/protocol/requestRouter.ts",
|
|
"symbol": "cancelRequest",
|
|
"owner_sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
|
},
|
|
"parser_type": {
|
|
"parser": "parseCancelRequest",
|
|
"schema": "cancelRequestSchema",
|
|
"domain_type": "CancelRequest"
|
|
},
|
|
"original_cases": [
|
|
{
|
|
"kind": "positive",
|
|
"evidence_id": "ev_6666666666666666666666666666666666666666666666666666666666666666",
|
|
"location": "/captures/positive"
|
|
},
|
|
{
|
|
"kind": "negative",
|
|
"evidence_id": "ev_7777777777777777777777777777777777777777777777777777777777777777",
|
|
"location": "/captures/negative"
|
|
},
|
|
{
|
|
"kind": "malformed",
|
|
"evidence_id": "ev_8888888888888888888888888888888888888888888888888888888888888888",
|
|
"location": "/captures/malformed"
|
|
},
|
|
{
|
|
"kind": "cancellation",
|
|
"evidence_id": "ev_9999999999999999999999999999999999999999999999999999999999999999",
|
|
"location": "/captures/cancellation"
|
|
}
|
|
],
|
|
"fixtures": [
|
|
{
|
|
"fixture_id": "rpc.cancel.positive",
|
|
"case_kind": "positive",
|
|
"authority": "protocol",
|
|
"evidence_ids": [
|
|
"ev_1111111111111111111111111111111111111111111111111111111111111111"
|
|
]
|
|
},
|
|
{
|
|
"fixture_id": "rpc.cancel.negative",
|
|
"case_kind": "negative",
|
|
"authority": "protocol",
|
|
"evidence_ids": [
|
|
"ev_2222222222222222222222222222222222222222222222222222222222222222"
|
|
]
|
|
},
|
|
{
|
|
"fixture_id": "rpc.cancel.malformed",
|
|
"case_kind": "malformed",
|
|
"authority": "protocol",
|
|
"evidence_ids": [
|
|
"ev_3333333333333333333333333333333333333333333333333333333333333333"
|
|
]
|
|
},
|
|
{
|
|
"fixture_id": "rpc.cancel.cancellation",
|
|
"case_kind": "cancellation",
|
|
"authority": "protocol",
|
|
"evidence_ids": [
|
|
"ev_4444444444444444444444444444444444444444444444444444444444444444"
|
|
]
|
|
}
|
|
],
|
|
"verifier": {
|
|
"verifier_id": "rpc.cancel.conformance",
|
|
"claim_id": "protocol.rpc.cancel.v1",
|
|
"command": "npm run test:protocol -- cancel",
|
|
"authority": "protocol",
|
|
"status": "pass",
|
|
"result_evidence_id": "ev_5555555555555555555555555555555555555555555555555555555555555555",
|
|
"enumerated_obligation_ids": ["protocol.rpc.cancel"],
|
|
"nondeterminism": {
|
|
"mode": "partial-order",
|
|
"specification": "cancel precedes the single terminal response"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
A ready ledger requires every retained Evidence reference to resolve in the
|
|
bundle, including references on optional case kinds. Unresolved references stay
|
|
visible in the ledger and produce diagnostics; they cannot close the obligation.
|
|
A green unit test cannot close a `packaged-process` obligation. A static-only
|
|
source cannot close a runtime or process claim. Marking a claim `blocked` or
|
|
`out-of-scope` records the disposition but does not silently count it as verified.
|
|
|
|
### Proof applicability
|
|
|
|
Keep three checks separate:
|
|
|
|
- **Authenticity:** the retained Evidence passes its integrity checks.
|
|
- **Authority:** the observation has the kind and strength required by the claim.
|
|
- **Applicability:** the proof describes the implementation and obligation
|
|
revision currently being evaluated.
|
|
|
|
Proof producers supply observed Evidence with predicate type
|
|
`rea.reconstruction-proof`, operation `verify_reconstruction_obligations`, and
|
|
the following `normalized_result` shape, defined by
|
|
`reconstructionObligationProofSchema`. REA evaluates retained results; this
|
|
operation label does not expose a proof executor or run the manifest command.
|
|
|
|
```json
|
|
{
|
|
"bindings": [
|
|
{
|
|
"obligation_id": "protocol.rpc.cancel",
|
|
"obligation_version": 1,
|
|
"owner_sha256": "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
|
"fixtures": [
|
|
{
|
|
"fixture_id": "fixture.cancel.positive",
|
|
"case_kind": "positive",
|
|
"passed": true
|
|
}
|
|
],
|
|
"verifiers": [
|
|
{
|
|
"verifier_id": "verifier.cancel",
|
|
"claim_id": "claim.cancel",
|
|
"passed": true
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
`owner_sha256` is the same lowercase 64-hex SHA-256 commitment supplied by the
|
|
implementation owner in the manifest. The proof producer computes it from the
|
|
same documented inputs and canonicalization described above; REA compares the
|
|
commitments and does not recompute them. The proof's `obligation_version` must
|
|
exactly equal the evaluated obligation version, including for generated
|
|
obligations. Increase that version when revising a reviewed requirement.
|
|
|
|
Within one matching obligation/owner/revision binding, fixture proof must name
|
|
the exact `(fixture_id, case_kind)` pair, and verifier proof the exact
|
|
`(verifier_id, claim_id)` pair. Every selected claim must report `passed: true`;
|
|
a matching failed claim cannot be hidden by a duplicate passing claim.
|
|
Claims may share a record, but identities or outcomes from different bindings
|
|
are never joined. Fixture and verifier Evidence authority must also satisfy the
|
|
existing authority requirements.
|
|
|
|
Changing the owner digest or obligation version makes retained proof
|
|
inapplicable. Missing identity, including legacy ID-array proof records, keeps
|
|
the ledger open with `inapplicable-fixture-proof` or
|
|
`inapplicable-verifier-proof`; details distinguish malformed or missing metadata
|
|
(`invalid-proof`), `owner-mismatch`, `revision-mismatch`, and `claim-mismatch`.
|
|
An applicable false outcome produces `fixture-failed` or `verifier-failed` and
|
|
a failed required ledger. An unknown, unsupported, or skipped verifier declaration
|
|
produces `verifier-unavailable` and keeps closure open. Replace fixture and
|
|
verifier Evidence after implementation or requirement changes. Old Evidence
|
|
remains valid provenance and cannot establish current applicability.
|
|
|
|
The `summary` counts obligations. `by_status`, `by_application_layer`, and
|
|
`by_source_state` place each obligation in exactly one bucket.
|
|
`by_evidence_authority` groups obligations by the Evidence `authority` of their
|
|
`authority_references`: an obligation counts once under each distinct authority
|
|
it cites, so those counts can exceed `total`. A reference's own `state` and the
|
|
obligation's `source_state` do not affect its authority bucket.
|
|
|
|
The tool returns every obligation inline. Its `ledger_id` and `closure_digest`
|
|
identify the complete result, including summaries, reports, ownership and
|
|
dependency graphs, Evidence links, and limitations. A new `closure_digest`
|
|
identifies a changed ledger; it does not establish that a verifier ran again.
|
|
Applicability is checked against the retained proof's explicit bindings.
|
|
|
|
For named boundaries with explicit verifier contracts and package-proof kinds,
|
|
see [reconstruction coverage](../reconstruction-coverage.md).
|