[PR #4097] [MERGED] feat(javascript): add filtered retained module reference views #6055

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4097
Author: @N0zoM1z0
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @N0zoM1z0

Base: main ← Head: feat/javascript-module-reference-views


📝 Commits (3)

  • 6a8e3c3 feat(javascript): add filtered retained module reference views
  • 83199b9 fix(verification): bound tokenizer lifetime and cover retained range counts
  • 6fb4a8a fix(verification): supervise tokenizer descendants with shared process ownership

📊 Changes

14 files changed (+1950 additions, -29 deletions)

View changed files

📝 .agents/skills/reverse-engineer-anything/references/javascript-applications.md (+30 -0)
📝 docs/javascript-application-workflows.md (+41 -1)
➕ docs/verification/javascript-module-references-2026-10-15.json (+691 -0)
➕ docs/verification/javascript-module-references-2026-10-15.md (+123 -0)
📝 package.json (+1 -0)
➕ scripts/fixtures/tokenizer-family-wrapper.py (+36 -0)
➕ scripts/verify/javascript/module-references.mjs (+415 -0)
📝 src/contracts/analysisViewToolContracts.ts (+19 -1)
📝 src/domain/analysisView/analysisView.test.ts (+296 -0)
📝 src/domain/analysisView/analysisView.ts (+21 -0)
📝 src/domain/analysisView/javascriptApplicationView.ts (+120 -27)
➕ src/domain/analysisView/javascriptModuleReferences.ts (+61 -0)
📝 tests/boundary/cli/analysisViewCli.test.ts (+36 -0)
📝 tests/boundary/mcp/analysisViewMcp.test.ts (+60 -0)

📄 Description

Summary

Retrieve canonical JavaScript module identities, retained source-range counts and mixed observation support in one filtered, typed inspect_analysis_view page. A real Obsidian main.js question previously needed a page plus 23 full item reads; the new view returns the same selected facts in one call.

Fixes #4092. Part of #4027 and the decision in #4091 to prioritize shared data contracts while deferring code mode. Overlapping draft #4106 implements the same request/row schema for #4092; integrate only one implementation. This PR also shares legacy module selection and includes the saved real-application verifier/measurements.

Problem and expected behavior

Paths can identify several module nodes. Callers need exact canonical identities and supporting facts without repeatedly receiving unrelated observations. Filters preserve null, empty and duplicate paths; page exhaustion remains separate from partial/unknown source coverage. Existing module items provide full observations and exact locations.

Change and scope

Add view: {kind: "javascript", collection: "modules", projection: "references", where: {path, kind}, offset, limit} to the existing tool. Share module kind/path/paging ownership with legacy views, scan retained order once and retain only the requested page. No source reparsing, query cache, SDK or code host.

Contract and boundary impact

  • Semantic owner: the JavaScript application-view projector over validated producer graph facts.
  • Scope: existing offline/retained reads; a new execution/injection/mutation/protection-recovery scope decision is not applicable.
  • CLI/MCP: one additive canonical request/result variant and shared application workflow; existing calls remain compatible.
  • Evidence: exact node/parent/view identities, artifact digest, source selection, support states, coverage, limitations and unknown counts remain accessible. Counts describe retained observations, not unique references or runtime loading.
  • Generated metadata: regenerate ignored catalogs/packaged skill; no generated outputs or downloadable artifacts committed.

Expected effects:

  • Read existing files or captured data.

Evidence and regression coverage

Executed against official Obsidian 1.14.4 ASAR with package.json/main.js selected. Three alternating-order pairs returned identical 23-row facts; public CLI inline input and MCP retained input produced identical view/Evidence IDs. Existing 36 unselected files and partial/unknown coverage remained explicit.

Completed query: 24 → 1 calls, 325,201 → 22,158 structured bytes. Serialized cl100k_base costs including both selected schemas, common bootstrap and all requests/replies: 85,302 → 16,548; with the complete catalog: 272,771 → 204,017. These are static BPE counts, not model billing. No hosted-agent latency/success claim. The measured legacy item reads are serial; concurrent legacy requests and model-turn savings were not measured. The context/call-count comparison does not establish a speedup over an optimized parallel baseline. Initial analysis is shared preparation; CPU/memory were measured for the complete verifier, not isolated by arm. Shared-host latency variation and prior attempts are preserved.

Reproduction, exact samples, resource measurements and limits.

  • 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

  • npm run test:focused with the view domain/service, analysis-detail/example contracts, public CLI/MCP and SDK-converted schema-validity files: 112 passed on the initial implementation; after review, the expanded domain suite passed 32/32, including repeated positive ranges, unavailable locations and full-item parity.

  • npm run build:cached: passed.

  • npm run check: passed, including typecheck, lint, format, knip and architecture guards.

  • npm run docs:check: passed, including 5 consistency tests.

  • node scripts/verify/javascript/module-references.mjs with the real ASAR, selected sources, three rounds, CLI parity and tiktoken 0.12.0: passed. Final complete verifier: 35.797 s wall / 35.197 s CPU / 1,938,313,216 B peak cgroup memory; cleanup verified, no OOM. All local heavy work bounded to one CPU and 8 GiB; cgroup memory includes file cache.

  • Review follow-up: tokenizer commands now use shared owned-process supervision and private runtime files. After real Obsidian reads/CLI parity, a committed POSIX fixture forked a detached SIGTERM-ignoring helper. A 2,000 ms deadline produced the expected OwnedCommandFailure(timeout), no cleanup failure, an empty owned scope and no temporary verifier files. Cleanup failures preserve the primary error, command owner and recovery files. The normal tokenizer and three paired real queries passed again. Linux family cleanup was exercised; Windows/macOS family behavior is unverified here. Prior cohorts are retained separately.

Initial CI failed in unchanged service-worker restore (protocol_error) and an existing Windows CLI subprocess 15-second deadline. The final 6fb4a8ab head passed the browser and Windows lanes without changing those paths. Codex and Greptile completed final-head review with no new actionable findings; all three earlier findings were fixed, validated and resolved.

Compatibility, safety, and release

Additive contract; no migration or dependency changes. Verified on Linux x64 using static shipped-artifact analysis and actual CLI/MCP clients. The new view was verified using static shipped-artifact data; this does not establish live Electron/browser behavior or Windows/macOS live analysis.

Author readiness

Human owner: @N0zoM1z0

The session explicitly authorized continued implementation, validation, ready PRs and merging, including waiving manual declarations. The agent reviewed this diff and its evidence. A human final-diff review is not asserted; the human-review declarations below remain unchecked.

  • 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.

🔄 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/4097 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `feat/javascript-module-reference-views` --- ### 📝 Commits (3) - [`6a8e3c3`](https://github.com/morluto/rea/commit/6a8e3c379c71aba50fae52a7ab55b90bd53c927a) feat(javascript): add filtered retained module reference views - [`83199b9`](https://github.com/morluto/rea/commit/83199b99d57a47a13f1da597a1a5b2c3511cf31e) fix(verification): bound tokenizer lifetime and cover retained range counts - [`6fb4a8a`](https://github.com/morluto/rea/commit/6fb4a8ab98df4a4bcd4f470fc95c3f221ffe1ec6) fix(verification): supervise tokenizer descendants with shared process ownership ### 📊 Changes **14 files changed** (+1950 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `.agents/skills/reverse-engineer-anything/references/javascript-applications.md` (+30 -0) 📝 `docs/javascript-application-workflows.md` (+41 -1) ➕ `docs/verification/javascript-module-references-2026-10-15.json` (+691 -0) ➕ `docs/verification/javascript-module-references-2026-10-15.md` (+123 -0) 📝 `package.json` (+1 -0) ➕ `scripts/fixtures/tokenizer-family-wrapper.py` (+36 -0) ➕ `scripts/verify/javascript/module-references.mjs` (+415 -0) 📝 `src/contracts/analysisViewToolContracts.ts` (+19 -1) 📝 `src/domain/analysisView/analysisView.test.ts` (+296 -0) 📝 `src/domain/analysisView/analysisView.ts` (+21 -0) 📝 `src/domain/analysisView/javascriptApplicationView.ts` (+120 -27) ➕ `src/domain/analysisView/javascriptModuleReferences.ts` (+61 -0) 📝 `tests/boundary/cli/analysisViewCli.test.ts` (+36 -0) 📝 `tests/boundary/mcp/analysisViewMcp.test.ts` (+60 -0) </details> ### 📄 Description ## Summary Retrieve canonical JavaScript module identities, retained source-range counts and mixed observation support in one filtered, typed `inspect_analysis_view` page. A real Obsidian `main.js` question previously needed a page plus 23 full item reads; the new view returns the same selected facts in one call. Fixes #4092. Part of #4027 and the decision in #4091 to prioritize shared data contracts while deferring code mode. Overlapping draft #4106 implements the same request/row schema for #4092; integrate only one implementation. This PR also shares legacy module selection and includes the saved real-application verifier/measurements. ## Problem and expected behavior Paths can identify several module nodes. Callers need exact canonical identities and supporting facts without repeatedly receiving unrelated observations. Filters preserve null, empty and duplicate paths; page exhaustion remains separate from partial/unknown source coverage. Existing module items provide full observations and exact locations. ## Change and scope Add `view: {kind: "javascript", collection: "modules", projection: "references", where: {path, kind}, offset, limit}` to the existing tool. Share module kind/path/paging ownership with legacy views, scan retained order once and retain only the requested page. No source reparsing, query cache, SDK or code host. ## Contract and boundary impact - Semantic owner: the JavaScript application-view projector over validated producer graph facts. - Scope: existing offline/retained reads; a new execution/injection/mutation/protection-recovery scope decision is not applicable. - CLI/MCP: one additive canonical request/result variant and shared application workflow; existing calls remain compatible. - Evidence: exact node/parent/view identities, artifact digest, source selection, support states, coverage, limitations and unknown counts remain accessible. Counts describe retained observations, not unique references or runtime loading. - Generated metadata: regenerate ignored catalogs/packaged skill; no generated outputs or downloadable artifacts committed. Expected effects: - [x] Read existing files or captured data. ## Evidence and regression coverage Executed against official Obsidian 1.14.4 ASAR with `package.json`/`main.js` selected. Three alternating-order pairs returned identical 23-row facts; public CLI inline input and MCP retained input produced identical view/Evidence IDs. Existing 36 unselected files and partial/unknown coverage remained explicit. Completed query: **24 → 1 calls**, **325,201 → 22,158 structured bytes**. Serialized `cl100k_base` costs including both selected schemas, common bootstrap and all requests/replies: **85,302 → 16,548**; with the complete catalog: **272,771 → 204,017**. These are static BPE counts, not model billing. No hosted-agent latency/success claim. The measured legacy item reads are serial; concurrent legacy requests and model-turn savings were not measured. The context/call-count comparison does not establish a speedup over an optimized parallel baseline. Initial analysis is shared preparation; CPU/memory were measured for the complete verifier, not isolated by arm. Shared-host latency variation and prior attempts are preserved. [Reproduction, exact samples, resource measurements and limits](https://github.com/morluto/rea/blob/feat/javascript-module-reference-views/docs/verification/javascript-module-references-2026-10-15.md). - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused` with the view domain/service, analysis-detail/example contracts, public CLI/MCP and SDK-converted schema-validity files: **112 passed** on the initial implementation; after review, the expanded domain suite passed **32/32**, including repeated positive ranges, unavailable locations and full-item parity. - `npm run build:cached`: passed. - `npm run check`: passed, including typecheck, lint, format, knip and architecture guards. - `npm run docs:check`: passed, including **5 consistency tests**. - `node scripts/verify/javascript/module-references.mjs` with the real ASAR, selected sources, three rounds, CLI parity and tiktoken 0.12.0: passed. Final complete verifier: **35.797 s wall / 35.197 s CPU / 1,938,313,216 B peak cgroup memory**; cleanup verified, no OOM. All local heavy work bounded to one CPU and 8 GiB; cgroup memory includes file cache. - Review follow-up: tokenizer commands now use shared owned-process supervision and private runtime files. After real Obsidian reads/CLI parity, a committed POSIX fixture forked a detached SIGTERM-ignoring helper. A **2,000 ms** deadline produced the expected `OwnedCommandFailure(timeout)`, no cleanup failure, an empty owned scope and no temporary verifier files. Cleanup failures preserve the primary error, command owner and recovery files. The normal tokenizer and three paired real queries passed again. Linux family cleanup was exercised; Windows/macOS family behavior is unverified here. Prior cohorts are retained separately. Initial CI failed in unchanged service-worker restore (`protocol_error`) and an existing Windows CLI subprocess 15-second deadline. The final `6fb4a8ab` head passed the browser and Windows lanes without changing those paths. Codex and Greptile completed final-head review with no new actionable findings; all three earlier findings were fixed, validated and resolved. ## Compatibility, safety, and release Additive contract; no migration or dependency changes. Verified on Linux x64 using static shipped-artifact analysis and actual CLI/MCP clients. The new view was verified using static shipped-artifact data; this does not establish live Electron/browser behavior or Windows/macOS live analysis. ## Author readiness Human owner: @N0zoM1z0 The session explicitly authorized continued implementation, validation, ready PRs and merging, including waiving manual declarations. The agent reviewed this diff and its evidence. A human final-diff review is not asserted; the human-review declarations below remain unchecked. - [ ] 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 - [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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:11:30 +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#6055
No description provided.