[PR #473] [MERGED] refactor(domain): encode comparison and lifecycle states exactly #2019

Closed
opened 2026-10-16 21:13:25 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/473
Author: @morluto
Created: 8/11/2026
Status: ✅ Merged
Merged: 8/11/2026
Merged by: @morluto

Base: main ← Head: agent/encode-domain-states


📝 Commits (7)

  • c07a7c2 refactor(domain): encode comparison states exactly
  • f523005 refactor(domain): make evidence lifecycles explicit
  • 715af80 refactor(browser): parse capture states once
  • 8a401fa test: prefer behavior over implementation seams
  • 21fd5e3 chore: refresh schema-derived metadata
  • 33bb8b4 test(process): preserve lifecycle cleanup coverage
  • 2cf98de test(hopper): bind rename cache coverage to dispatch

📊 Changes

43 files changed (+1728 additions, -776 deletions)

View changed files

📝 docs/product-catalog.json (+2 -2)
📝 docs/verification/managed-conformance-manifest.json (+2 -2)
📝 skills/reverse-engineer-anything/SKILL.md (+1 -1)
📝 src/browser/WebSourceMapFetcher.ts (+67 -54)
📝 src/domain/callPath.test.ts (+18 -3)
📝 src/domain/callPath.ts (+118 -152)
➕ src/domain/callPathSchemas.ts (+194 -0)
📝 src/domain/changedBehavior.test.ts (+11 -0)
📝 src/domain/changedBehavior.ts (+68 -24)
📝 src/domain/conformanceReplay.ts (+55 -21)
📝 src/domain/conformanceTrustGate.ts (+22 -12)
📝 src/domain/functionComparison.test.ts (+26 -0)
📝 src/domain/functionComparisonResults.ts (+23 -14)
📝 src/domain/functionComparisonSchemas.ts (+45 -19)
📝 src/domain/investigationWorkspace.ts (+76 -43)
📝 src/domain/javascriptApplicationVersionComparison.ts (+43 -22)
📝 src/domain/javascriptApplicationVersionComparisonSchemas.ts (+191 -74)
📝 src/domain/javascriptApplicationVersionItems.ts (+171 -63)
📝 src/domain/javascriptApplicationVersionKeys.ts (+43 -16)
📝 src/domain/processTraceComparison.test.ts (+7 -0)

...and 23 more files

📄 Description

Description

Replace loosely correlated status, nullable, candidate, coverage, and count fields with boundary-parsed discriminated values across comparison, evidence, lifecycle, and browser-capture workflows. Contradictory states now fail at the owning schema instead of surviving into downstream logic and requiring repeated checks.

The refactor covers:

  • call-path, changed-behavior, function, and JavaScript application-version comparisons;
  • conformance replay/trust gates, investigation runs, process traces, reconstruction verification, and reference-source graphs;
  • web source-map collection and browser capture diffs.

Schema-only concerns are separated from traversal and comparison logic where that gives each concept one owner. Tests assert rejected impossible states and observable lifecycle behavior, including MCP notifications, provider capability mutation resistance, request cleanup, and Hopper rename-cache invalidation.

No tools or provider authorities are added or removed. Storage formats retain their legacy migration branches, the 116-tool inventory remains stable, and valid caller behavior is unchanged. The caller-visible schema projection is narrower only for combinations that contradicted their own status, coverage, evidence, or lifecycle fields.

Suggested review order:

  1. Comparison state owners: c07a7c28.
  2. Evidence and lifecycle owners: f5230054.
  3. Browser source-map and capture boundaries: 715af808.
  4. Behavior-focused test cleanup and lifecycle coverage: 8a401fa4, 33bb8b45, 2cf98dee.
  5. Generated catalog and provenance refresh: 21fd5e3c.

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Refactoring (valid behavior preserved)
  • Tool contract change (MCP schema narrowing)

Testing Performed

  • Unit and boundary tests added or updated
  • npm run check:pr — typecheck, lint, formatting, Knip, metadata, 338 test files / 1,699 tests, TypeDoc, and generated-document checks passed
  • Focused post-review lifecycle suites — 53 tests passed
  • Focused Hopper cache-dispatch suite — 10 tests passed
  • npm pack --dry-run — 739 files, 1.1 MB package
  • Pre-push npm run check:fast — typecheck and lint passed
  • npm run verify:package — reached the packaged Linux Hopper platform check, then stopped because Xvfb is unavailable on this host
  • Real Hopper, Ghidra, browser, replay, and managed-provider verification performed

Tool Contract Impact

The canonical 116-tool inventory is unchanged. Output schemas now reject mismatched comparison endpoints, invalid match basis/confidence pairs, contradictory coverage and pagination counts, impossible lifecycle checkpoints, inconsistent conformance aggregates, invalid reference-source content states, and source-map/capture statuses that do not match retained evidence.

Generated MCP catalog, product catalog, bundled skill identity, and managed conformance provenance were refreshed and pass the repository drift checks.

No linked issue.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/473 **Author:** [@morluto](https://github.com/morluto) **Created:** 8/11/2026 **Status:** ✅ Merged **Merged:** 8/11/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `agent/encode-domain-states` --- ### 📝 Commits (7) - [`c07a7c2`](https://github.com/morluto/rea/commit/c07a7c2840b9eec16d69b27aeaabbde73f282349) refactor(domain): encode comparison states exactly - [`f523005`](https://github.com/morluto/rea/commit/f523005454abdbd391f03ef80b1132c57c4bc1f8) refactor(domain): make evidence lifecycles explicit - [`715af80`](https://github.com/morluto/rea/commit/715af808fd486cd00c07f706a86f878f543c72e5) refactor(browser): parse capture states once - [`8a401fa`](https://github.com/morluto/rea/commit/8a401fa41e874a3f0cd9e3a0c0eb1aa9e99ab194) test: prefer behavior over implementation seams - [`21fd5e3`](https://github.com/morluto/rea/commit/21fd5e3c385ba48db4921bcfece4e23eb506b6a2) chore: refresh schema-derived metadata - [`33bb8b4`](https://github.com/morluto/rea/commit/33bb8b45a720b3d7e84b97d49e175f74cfc5ece7) test(process): preserve lifecycle cleanup coverage - [`2cf98de`](https://github.com/morluto/rea/commit/2cf98deec03f99295aca2e4fcaae0e2b0f73c11e) test(hopper): bind rename cache coverage to dispatch ### 📊 Changes **43 files changed** (+1728 additions, -776 deletions) <details> <summary>View changed files</summary> 📝 `docs/product-catalog.json` (+2 -2) 📝 `docs/verification/managed-conformance-manifest.json` (+2 -2) 📝 `skills/reverse-engineer-anything/SKILL.md` (+1 -1) 📝 `src/browser/WebSourceMapFetcher.ts` (+67 -54) 📝 `src/domain/callPath.test.ts` (+18 -3) 📝 `src/domain/callPath.ts` (+118 -152) ➕ `src/domain/callPathSchemas.ts` (+194 -0) 📝 `src/domain/changedBehavior.test.ts` (+11 -0) 📝 `src/domain/changedBehavior.ts` (+68 -24) 📝 `src/domain/conformanceReplay.ts` (+55 -21) 📝 `src/domain/conformanceTrustGate.ts` (+22 -12) 📝 `src/domain/functionComparison.test.ts` (+26 -0) 📝 `src/domain/functionComparisonResults.ts` (+23 -14) 📝 `src/domain/functionComparisonSchemas.ts` (+45 -19) 📝 `src/domain/investigationWorkspace.ts` (+76 -43) 📝 `src/domain/javascriptApplicationVersionComparison.ts` (+43 -22) 📝 `src/domain/javascriptApplicationVersionComparisonSchemas.ts` (+191 -74) 📝 `src/domain/javascriptApplicationVersionItems.ts` (+171 -63) 📝 `src/domain/javascriptApplicationVersionKeys.ts` (+43 -16) 📝 `src/domain/processTraceComparison.test.ts` (+7 -0) _...and 23 more files_ </details> ### 📄 Description ## Description Replace loosely correlated status, nullable, candidate, coverage, and count fields with boundary-parsed discriminated values across comparison, evidence, lifecycle, and browser-capture workflows. Contradictory states now fail at the owning schema instead of surviving into downstream logic and requiring repeated checks. The refactor covers: - call-path, changed-behavior, function, and JavaScript application-version comparisons; - conformance replay/trust gates, investigation runs, process traces, reconstruction verification, and reference-source graphs; - web source-map collection and browser capture diffs. Schema-only concerns are separated from traversal and comparison logic where that gives each concept one owner. Tests assert rejected impossible states and observable lifecycle behavior, including MCP notifications, provider capability mutation resistance, request cleanup, and Hopper rename-cache invalidation. No tools or provider authorities are added or removed. Storage formats retain their legacy migration branches, the 116-tool inventory remains stable, and valid caller behavior is unchanged. The caller-visible schema projection is narrower only for combinations that contradicted their own status, coverage, evidence, or lifecycle fields. Suggested review order: 1. Comparison state owners: `c07a7c28`. 2. Evidence and lifecycle owners: `f5230054`. 3. Browser source-map and capture boundaries: `715af808`. 4. Behavior-focused test cleanup and lifecycle coverage: `8a401fa4`, `33bb8b45`, `2cf98dee`. 5. Generated catalog and provenance refresh: `21fd5e3c`. ## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Documentation update - [ ] Performance improvement - [x] Refactoring (valid behavior preserved) - [x] Tool contract change (MCP schema narrowing) ## Testing Performed - [x] Unit and boundary tests added or updated - [x] `npm run check:pr` — typecheck, lint, formatting, Knip, metadata, 338 test files / 1,699 tests, TypeDoc, and generated-document checks passed - [x] Focused post-review lifecycle suites — 53 tests passed - [x] Focused Hopper cache-dispatch suite — 10 tests passed - [x] `npm pack --dry-run` — 739 files, 1.1 MB package - [x] Pre-push `npm run check:fast` — typecheck and lint passed - [ ] `npm run verify:package` — reached the packaged Linux Hopper platform check, then stopped because Xvfb is unavailable on this host - [ ] Real Hopper, Ghidra, browser, replay, and managed-provider verification performed ## Tool Contract Impact The canonical 116-tool inventory is unchanged. Output schemas now reject mismatched comparison endpoints, invalid match basis/confidence pairs, contradictory coverage and pagination counts, impossible lifecycle checkpoints, inconsistent conformance aggregates, invalid reference-source content states, and source-map/capture statuses that do not match retained evidence. Generated MCP catalog, product catalog, bundled skill identity, and managed conformance provenance were refreshed and pass the repository drift checks. ## Related Issues No linked issue. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:13:25 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2019
No description provided.