[PR #4428] [MERGED] fix(snapshot): count newly retained workflow bindings on import #6235

Closed
opened 2026-10-31 01:12:54 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4428
Author: @jiwonsudo
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/21/2026
Merged by: @morluto

Base: main ← Head: fix/snapshot-workflow-import-count


📝 Commits (1)

  • 338d423 fix(snapshot): count newly retained workflow bindings on import

📊 Changes

2 files changed (+75 additions, -9 deletions)

View changed files

📝 src/application/binary/AnalysisSnapshotCache.test.ts (+74 -9)
📝 src/application/binary/AnalysisSnapshotCache.ts (+1 -0)

📄 Description

Summary

Fixes #4377. AnalysisSnapshotCache.stage should return the number of new entries, but it only counted direct entries. New workflow entries (like trace_feature) were saved but not counted, so a snapshot with only workflow entries returned 0.

Problem and expected behavior

When I stage a snapshot with one new workflow entry into an empty cache, the entry is saved but stage returns 0. It should return 1, the same as for direct entries. Replaced entries and entries skipped because the cache is full should still not be counted.

Change and scope

I added one line to the workflow loop in stage(). It increases imported when the workflow query ID is new, the same way the direct entry loop already does. Callers that don't use the return value are not affected.

Follow the contribution scope. This is a small bug fix inside existing code, so a maintainer scope decision is not needed.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/application/binary/AnalysisSnapshotCache.ts, snapshot staging
  • Contribution scope fit and linked maintainer decision: bug fix, not applicable
  • CLI and MCP/tool-catalog contract: none
  • Provider, bridge, target-format, or platform compatibility: none
  • Evidence, artifact, provenance, or reconstruction contract: none. Saved entries are the same, only the returned count changes.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none

Expected effects: none of these. The change only affects an in-memory counter.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: I added counts newly retained direct and workflow bindings when staging. It exports a snapshot with one direct entry and one trace_feature entry, serializes and parses it, then stages it into new caches. Workflow only returns 1, both entries return 2, and staging the same snapshot again returns 0. I also added a check to the existing capacity test that a workflow entry skipped because the cache is full returns 0.
  • Base reproduction or other evidence: I ran the new test without the fix and it failed with AssertionError: expected +0 to be 1.
  • User-visible CLI/MCP output (if applicable): not applicable. The current callers don't use the count.
  • Remaining proof gaps: I did not run the full npm run check:pr locally.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Node v22.22.0, Linux:

  • npx vitest run src/application/binary/AnalysisSnapshotCache.test.ts: 25 passed (1 failed without the fix)
  • npx tsc --noEmit: passed
  • npx oxlint on the changed files: no issues
  • npx oxfmt --check src/application/binary/: passed
  • npm run verify:test-discovery: passed, all 1415 test files found once

Compatibility, safety, and release

  • Breaking changes or migration steps: none
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable, the change doesn't depend on a provider
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: none

Author readiness

Human owner: @jiwonsudo

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output. (N/A, no CLI or MCP change)
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/4428 **Author:** [@jiwonsudo](https://github.com/jiwonsudo) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/21/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/snapshot-workflow-import-count` --- ### 📝 Commits (1) - [`338d423`](https://github.com/morluto/rea/commit/338d4237b498a6ddc1c6a45ffffd4140581becd2) fix(snapshot): count newly retained workflow bindings on import ### 📊 Changes **2 files changed** (+75 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/application/binary/AnalysisSnapshotCache.test.ts` (+74 -9) 📝 `src/application/binary/AnalysisSnapshotCache.ts` (+1 -0) </details> ### 📄 Description ## Summary Fixes #4377. `AnalysisSnapshotCache.stage` should return the number of new entries, but it only counted direct entries. New workflow entries (like `trace_feature`) were saved but not counted, so a snapshot with only workflow entries returned `0`. ## Problem and expected behavior When I stage a snapshot with one new workflow entry into an empty cache, the entry is saved but `stage` returns `0`. It should return `1`, the same as for direct entries. Replaced entries and entries skipped because the cache is full should still not be counted. ## Change and scope I added one line to the workflow loop in `stage()`. It increases `imported` when the workflow query ID is new, the same way the direct entry loop already does. Callers that don't use the return value are not affected. Follow the [contribution scope](https://github.com/morluto/rea/blob/main/CONTRIBUTING.md#contribution-scope). This is a small bug fix inside existing code, so a maintainer scope decision is not needed. ## Contract and boundary impact - Semantic owner and earliest changed stage: `src/application/binary/AnalysisSnapshotCache.ts`, snapshot staging - Contribution scope fit and linked maintainer decision: bug fix, not applicable - CLI and MCP/tool-catalog contract: none - Provider, bridge, target-format, or platform compatibility: none - Evidence, artifact, provenance, or reconstruction contract: none. Saved entries are the same, only the returned count changes. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none Expected effects: none of these. The change only affects an in-memory counter. - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: I added `counts newly retained direct and workflow bindings when staging`. It exports a snapshot with one direct entry and one `trace_feature` entry, serializes and parses it, then stages it into new caches. Workflow only returns `1`, both entries return `2`, and staging the same snapshot again returns `0`. I also added a check to the existing capacity test that a workflow entry skipped because the cache is full returns `0`. - Base reproduction or other evidence: I ran the new test without the fix and it failed with `AssertionError: expected +0 to be 1`. - User-visible CLI/MCP output (if applicable): not applicable. The current callers don't use the count. - Remaining proof gaps: I did not run the full `npm run check:pr` locally. For evidence-bearing changes: - [ ] Observed, derived, and inferred claims remain distinguishable. - [ ] Artifact identity, source provenance, and failed attempts remain preserved. - [ ] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Node v22.22.0, Linux: - `npx vitest run src/application/binary/AnalysisSnapshotCache.test.ts`: 25 passed (1 failed without the fix) - `npx tsc --noEmit`: passed - `npx oxlint` on the changed files: no issues - `npx oxfmt --check src/application/binary/`: passed - `npm run verify:test-discovery`: passed, all 1415 test files found once ## Compatibility, safety, and release - Breaking changes or migration steps: none - Real Hopper/Ghidra, browser, or OS coverage: not applicable, the change doesn't depend on a provider - Package or release metadata impact: none - Security, privacy, process, or containment review: none ## Author readiness Human owner: @jiwonsudo - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. (N/A, no CLI or MCP change) - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:12:54 +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#6235
No description provided.