Scenario

An exit code of zero that was not a pass

L4StaffIncident30 minDebuggingDesign reviewSystem design

RolesAI Evaluation and ReliabilityAgent Systems Engineering

Engine
rea 6.7.0 at 27dc42d with the Ghidra provider
Model
no model; the fixtures are the ledger binaries built at -O1 and -O2
Hardware
one aarch64 Mac

Situation

A team keeps Evidence bundles of a shipped binary in version control. A nightly job analyses the current build with rea, exports a bundle, runs rea compare against the bundle of the night before, and posts "no change" to the team channel when the command exits 0. It has posted "no change" every night for three weeks. Then a release went out with a different optimization level, and the job still posted "no change". A reviewer opened the two bundles by hand and found that not one record was shared between them.

Two more things went wrong in the same week. The job also keeps a digest of each bundle file to detect edits, and a colleague's export of the same records produced a different digest. And after the upgrade from the 6.5.0 release, an archived bundle that nobody had touched was refused at import. You are asked to say what the job measured for three weeks and to redesign it.

Questions

  1. The compare command exited 0 on two bundles with no record in common. What did the job read, and what should it have read?
  2. Every change is classified unknown with the kind unresolved_branch, and records_removed is 0. Why does rea not call a record that is on one side only a removal?
  3. Two exports of the same eight records have different digests and byte counts. Which digest belongs in the archive, and how do you check that two files hold the same evidence?
  4. The old bundle was refused with retryable: false. Which record failed, why that one, and what does the team do with evidence it saved under the old release?
  5. Write the aggregation rule for the nightly job, and say which tool answers the question it was trying to ask.

Commit to a cause after each listing. Write it down before you read the next one.

Evidence

1/7

the import and compare commands with their exit codes

Two imports and one compare. Only the import of the old bundle exits 1.

evidence/the-three-commands.txt
$ rea evidence-import out/11-bundle-O1.json --format json
[exit 0] (0.6 s) -> 13-evidence-import.json

$ rea evidence-import fixtures/bundle-rea-6.5.0-O1.json --format json
[exit 1] (0.6 s) -> 13-evidence-import-rea-6.5.0.json

$ rea compare out/11-bundle-O1.json out/11-bundle-O2.json --format json
[exit 0] (0.6 s) -> 14-compare-bundles.json

Source: manuals/reverse-engineering-101/capture/out/00-commands.txt, lines 55-62

2/7

the head of the compare result

Read status first, then the unresolved count against the four records_ counters.

evidence/compare-status-and-summary.txt
{
  "status": "unknown",
  "left_bundle_sha256": "47160c2de738f54a9f9e496d0552b290f34c789ea63523c985c33787d9d30be9",
  "right_bundle_sha256": "e0a9fe04ebbcaf90eda63c731d9cf9c13b59c41eb8b1995a0204d8015d44fe20",
  "summary": {
    "records_unchanged": 0,
    "records_added": 0,
    "records_removed": 0,
    "records_changed": 0,
    "unknowns_unchanged": 0,
    "unknowns_added": 0,
    "unknowns_removed": 0,
    "unknowns_advanced": 0,
    "unknowns_diverged": 0,
    "unresolved": 10
  },

Source: manuals/reverse-engineering-101/capture/out/14-compare-bundles.json, lines 1-16

3/7

the first of the ten changes

One side has the record and the other side has nothing, and the limitation says why that is not a removal.

evidence/one-unresolved-record.txt
  "changes": [
    {
      "entity": "evidence",
      "key": "ev_142cc943d8259d42ce5d62ad5eb0417fcde4de4ee9a20afbfe1fdbc51ed3d259",
      "classification": "unknown",
      "conclusion_kind": "unresolved_branch",
      "left_evidence_ids": [],
      "right_evidence_ids": [
        "ev_142cc943d8259d42ce5d62ad5eb0417fcde4de4ee9a20afbfe1fdbc51ed3d259"
      ],
      "left_digest": null,
      "right_digest": "142cc943d8259d42ce5d62ad5eb0417fcde4de4ee9a20afbfe1fdbc51ed3d259",
      "limitations": [
        "EvidenceBundle has no inventory completeness marker; one-sided membership may reflect incomplete capture."
      ]
    },

Source: manuals/reverse-engineering-101/capture/out/14-compare-bundles.json, lines 17-32

4/7

the limitation at the end of the result

One sentence that applies to the whole comparison.

evidence/the-closing-limitation.txt
  "limitations": [
    "EvidenceBundle has no inventory completeness marker; one-sided membership remains unknown."
  ]

Source: manuals/reverse-engineering-101/capture/out/14-compare-bundles.json, lines 169-171

5/7

the MCP export and the CLI export of the same records

Different digests and byte counts, the same JSON content.

evidence/two-exports-one-content.txt
94fca3db18f93cfbc1c2d11a3d26b9e46fd19dec677b06976199d6981a477247  178398  export_evidence_bundle over MCP, out/11-bundle-O1.json
47160c2de738f54a9f9e496d0552b290f34c789ea63523c985c33787d9d30be9  178397  evidence-export over the CLI, $WORK/canonical-O1.json
same bytes as the MCP export: no
same JSON content as the MCP export: yes

Source: manuals/reverse-engineering-101/capture/out/12-evidence-export.txt

6/7

the import counts of the bundle that this release wrote

The counts of a bundle that validates.

evidence/import-of-the-current-bundle.txt
{
  "imported": 8,
  "unknowns_added": 0,
  "total": 8
}

Source: manuals/reverse-engineering-101/capture/out/13-evidence-import.json

7/7

the import of the bundle that the old release wrote

Read the code, the path in the message, and the retryable flag.

evidence/old-bundle-refused.txt
{
  "error": "Analysis failed",
  "code": "evidence_integrity_mismatch",
  "category": "integrity_mismatch",
  "message": "Evidence bundle does not match the bundle schema at records.3.evidence_id: Evidence semantic identifier does not match its record. Supply an unmodified bundle written by export_evidence_bundle or rea evidence-export.",
  "retryable": false,

Source: manuals/reverse-engineering-101/capture/out/13-evidence-import-rea-6.5.0.json, lines 1-6

The answer

Show the walkthrough
  1. Read the exit codes against the results. The command record shows rea compare with exit 0. The import of the current bundle also exits 0. Only the import of the old bundle exits 1. A zero exit from rea compare means that the comparison ran, not that it found two equal sets. The job treated the process status as the verdict and never parsed the output.
  2. Read the status and the summary. The result says status: "unknown". Every records_ counter is 0, and unresolved is 10. So the two bundles share no record, nothing was classified as unchanged, and nothing was classified as changed either. The job's "no change" message described a comparison that compared nothing.
  3. Read one change. The first change has a right-side id and an empty left side. Its classification is unknown and its conclusion kind is unresolved_branch. The limitation on the change says that a bundle has no inventory completeness marker, so one-sided membership may reflect incomplete capture. rea cannot tell a record that was removed from a record that was never captured on that side, because the bundle format does not say whether a capture was complete.
  4. Read the closing limitation. The same sentence closes the whole result: one-sided membership remains unknown. The two bundles were made from two builds. No evidence_id can match across them, because the id is a hash of the record's semantic content and the content describes a different file. rea compare answers "what changed in this evidence set" for two bundles of one build. For two builds the question goes to compare_functions, one function at a time.
  5. Read the two exports. The MCP export and the CLI export hold the same JSON content and different bytes: 178398 against 178397 bytes. The one byte is the newline that the capture kit added to its copy. The canonical digest is the one from rea evidence-export, and the compare result names that digest as its left bundle digest. A job that compares file digests must canonicalize both files first, or compare the JSON content.
  6. Read the two imports. The import of the current bundle reports 8 imported of 8. The import of the old bundle stops with evidence_integrity_mismatch at records.3.evidence_id and retryable: false. The bytes are the bytes that the old release wrote. The hash rule changed: the current release includes a null relationship_coverage in the identity of a record, and the old release left it out. Records 0 to 2 are dossiers with a coverage object, so their ids still verify. Record 3 is the first record without coverage, so it is the first id that fails.
Show the resolution

For three weeks the job measured whether rea compare could start. It never read the status. The redesign reads the JSON and applies one rule: a result with status unknown, or with unresolved above 0, is not a pass, and the message names the count. A pass requires status unchanged with every record classified. The job compares bundles of one build only. When the build changes, it opens both builds and calls compare_functions for each function of interest, and it reads the eight dimensions of each record, as the manual shows for _percent_change and _total.

The archive stores the canonical digest from rea evidence-export next to each bundle, and the rea version that wrote it. The team does not migrate saved evidence. For the old bundles it keeps the old release available to read them, and it regenerates the evidence it still needs with the current release. The first nightly run after the change posted a result with unresolved: 10 and a red mark, which is what the two builds deserved.

Show the wrong turns
  • “Exit 0 means the comparison passed.”

    The exit code says that the command completed. The verdict is in status, and here it was unknown.

  • “Ten unresolved records on the right and none on the left means ten records were added.”

    A bundle carries no completeness marker, so rea cannot say whether the left side was captured completely. It says unknown, and so must you.

  • “Fix the old bundle by recomputing the ids and importing it.”

    The refusal is not retryable, and rea does not migrate evidence. An id you compute yourself is no longer evidence that the tool wrote.

  • “Compare the file digests to detect a change.”

    Two valid exports of the same records differed by one trailing newline. Compare canonical digests or JSON content.

Show the general rule

A tool that can say "I do not know" needs a reader that can hear it. Any pipeline that turns a result into a pass or fail must read the field that carries the verdict and treat every value other than pass as not a pass, including unknown, unresolved and skipped. Record the version of the tool next to every artifact it wrote, because the identity rules of a format can change between releases, and compare canonical forms, never raw files.

Taught in

The compare page of Reverse Engineering 101 reads this result, the bundles page explains the two exports and the refused import, the errors reference lists the results that refuse a conclusion and exit 0, and the failure modes lesson shows why a pipeline that tags only crashes misses most failures.