Skip to content

feat(javascript): add filtered retained module reference views - #4097

Merged
N0zoM1z0 merged 3 commits into
mainfrom
feat/javascript-module-reference-views
Oct 15, 2026
Merged

N0zoM1z0 merged 3 commits into
mainfrom
feat/javascript-module-reference-views

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Expose canonical module identities, retained range counts and mixed observation
support through the shared analysis-view contract. Preserve source selection,
partial coverage, parent provenance and full-item access while paging only the
requested matching rows.

Verify public CLI/MCP parity on the shipped Obsidian ASAR and retain bounded
reproduction scripts, completed-query costs and measurement limitations.

Co-authored-by: Kaoru0822 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T12:51:33.123837Z 6fb4a8a New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge; no new blocking issue was found.

Summary

Adds filtered JavaScript module-reference pages to inspect_analysis_view.

  • JavaScript module views can return filtered reference facts in one page.
  • A verifier compares filtered module facts with the existing read workflow.

No new actionable issues were found in the changes since the previous review. Both supplied threads are unnumbered and fully addressed: the test asserts two repeated ranges and item-view agreement, and token counting now has a deadline with shared cleanup.

Review used source inspection; no tests were run. Whether another PR supersedes this one could not be checked because GitHub authentication was unavailable.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Retained or inline Evidence] --> B[Validated application graph]
  B --> C[Exact kind and path filters]
  C --> D[Page in retained order]
  D --> E[Identity, range count, support states]
  B --> F[Source coverage and unknown counts]
  E --> G[Typed reference view]
  F --> G
Loading

Reviews (3) · Last reviewed commit: "fix(verification): supervise tokenizer d..." · Reviewed by Greptile

…counts

Guard token accounting with a caller-selected wall-time deadline and preserve
spawn errors so stalled children cannot indefinitely delay Evidence cleanup.
Verify timeout cleanup against the real Obsidian workflow and retain updated
measurement records without pooling earlier samples.

Add a deterministic positive-count regression for repeated source ranges and
unavailable locations, cross-checked against the full item projection.

Co-authored-by: Kaoru0822 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83199b99d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…s ownership

Reuse owned-command supervision, private runtime files and shared verifier
cleanup. Preserve recovery ownership on incomplete cleanup. Record a real
Obsidian verification with a detached SIGTERM-ignoring tokenizer helper.

Co-authored-by: Kaoru0822 <[email protected]>
@N0zoM1z0
N0zoM1z0 merged commit ec394a2 into main Oct 15, 2026
43 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/javascript-module-reference-views branch October 15, 2026 13:05
@morluto morluto added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Query retained JavaScript module references without full item reads

2 participants