Skip to content

refactor(analysis-view): break the analysis view hub cycle - #8061

Merged
morluto merged 3 commits into
mainfrom
cursor/analysis-view-cycle-a8f1
Oct 29, 2026
Merged

morluto merged 3 commits into
mainfrom
cursor/analysis-view-cycle-a8f1

Conversation

@morluto

@morluto morluto commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Break the 49-file import cycle around src/domain/analysisView/analysisView.ts. Projectors no longer import the module that imports them. The dispatcher checks each inferred projector result against the unsigned result union before sealing it. The public inspect_analysis_view schemas stay exported from analysisView.ts.

Problem and expected behavior

analysisView.ts imported every projector, and those projectors imported AnalysisViewParent, AnalysisViewRequest, and UnsignedAnalysisView back from it. Under verbatimModuleSyntax the back-edges are type-only, but they still form one strongly connected component, so a view change loads the whole hub. Moving AnalysisViewParent alone does not break the cycle, because the request and unsigned-result aliases are outputs of schemas that lived in the hub.

The first split accepted Result<unknown> and cast the value to UnsignedAnalysisView. A missing field or a wrong kind then failed only inside sealAnalysisView. The cycle guard also matched import text with a regex, so a commented import looked like an edge and a side-effect import was missed.

Projection behavior is unchanged: the same request schema admits a view, the same projector runs, and sealAnalysisView still attaches view_digest.

Change and scope

  • analysisViewShape.ts owns the shared request fragments (summary, facet, item, page, native), GroupingViewKind, and the admitted-view narrowing helpers.
  • analysisViewRequest.ts owns the request union and inspect_analysis_view input schema.
  • analysisViewResult.ts owns the result union.
  • analysisViewParent.ts owns AnalysisViewParent.
  • analysisView.ts keeps dispatch and re-exports the public schemas. sealProjected and retain require Result<UnsignedAnalysisView, AnalysisError> and do not cast the result.
  • API-surface and environment-manifest field schemas moved to leaves so accumulators can type their results without importing the hub.
  • analysisViewCycles.test.ts parses imports with Babel, using the same node kinds as scripts/lib/module-boundaries.mjs.

Projectors narrow an admitted view to the schema they own after the existing kind check. They do not re-parse the request and do not import the result union, so the cycle stays broken. Schema literals that ok() would widen (kind, parent_operation, collection, facet, and the same class of fields) stay literal so the inferred object is checked against the union. JNI summary and page objects are returned directly instead of being stored as Record<string, unknown>. IL2CPP and Android symbol projectors take AdmittedView. Their tests check selections against the owning request schemas before the call.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: analysisView.ts remains the projection dispatcher. Request and result schemas moved to sibling modules and are re-exported. Superseded hub-local copies of AnalysisViewParent and the request fragments were removed.
  • Contribution scope fit and linked maintainer decision: not applicable. This is a structural split of the existing analysis-view contract.
  • CLI and MCP/tool-catalog contract: none. inspect_analysis_view input and result schemas are re-exported from the same module.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none. Sealed view digests still use canonical JSON of the same projection.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • 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: analysisViewCycles.test.ts parses imports with Babel and fails if analysisView.ts re-enters an import cycle or a new cycle appears. The new case covers a side-effect import and import-like text in a line comment, a block comment, and a string. Three pre-existing environment-state cycles are allow-listed by exact file membership. artifactInventoryView.test.ts and managedMemberView.test.ts narrow page results with in checks because the projector return is no longer the full result union. IL2CPP and Android symbol tests type selections with the owning request schema.
  • Base reproduction or other evidence: source-derived import graph. Before this change the production SCC was 49 files, all through analysisView.ts. After the change that file is in no SCC. A missing field or wrong kind now fails when the projector is registered or sealed, which is a compiler check rather than a runtime-only failure.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: no linked issue; this is the analysis-view slice of the architecture audit. Result schemas still live in analysisViewResult.ts. Projectors are checked by inference at the dispatcher rather than by a local z.output annotation.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

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

  • npm run format:check — passed.
  • npm run check:fast — passed. Typecheck and lint both succeeded.
  • npm run lint — 5978 files, 0 errors. verify:module-boundaries passed for 3405 source files.
  • npm run test:focused -- src/domain/analysisView/*.test.ts — 66 files, 1467 tests passed.
  • The pre-push hook ran npm run check:fast again and it passed.
  • Closed IL2CPP and Android symbol view inputs (bd4b68897): npm run format:check passed, npm run check:fast passed, and focused tests for those projectors plus the cycle guard passed 57 tests. The pre-push hook ran check:fast again.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. Callers that import schemas and projectAnalysisView from analysisView.ts keep those exports.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable. No provider session was run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: not applicable. No target execution, injection, or cleanup change.

Author readiness

Human owner: @morluto

  • 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.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
Open in Web Open in Cursor 

Move request fragments, the request union, and the result union out of
analysisView.ts so projectors no longer import the module that imports them.
The dispatcher re-exports the public schemas and seals projector results.

Co-authored-by: morluto <morluto@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 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 ⚠️ Failed 2026-10-29T21:22:35.877003Z
We couldn’t complete this review. Comment @codex review to try again.
bd4b688 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.

@cursor

cursor Bot commented Oct 29, 2026

Copy link
Copy Markdown

@gensokyo-dev @dandgabr This splits the analysis-view hub so projectors no longer import the module that imports them. The public inspect_analysis_view schemas stay re-exported from analysisView.ts. Projection behavior is unchanged; analysisViewCycles.test.ts locks the import graph.

@greptile-apps

greptile-apps Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issue remains.

Summary

Splits shared types and schemas out of analysisView.ts so projectors no longer import the dispatcher.

  • Analysis views keep their public entry point while their shared contracts move out of the dispatcher.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Hub["analysisView.ts: dispatch and public exports"] --> Request["analysisViewRequest.ts"]
  Hub --> Result["analysisViewResult.ts"]
  Hub --> Projectors["Projectors"]
  Request --> Projectors
  Result --> Projectors
  Projectors --> Shape["analysisViewShape.ts"]
  Projectors --> Parent["analysisViewParent.ts"]
  Projectors --> Leaves["Producer-owned schemas"]
Loading

Reviews (3) · Last reviewed commit: "fix(analysis-view): close IL2CPP and And..." · Reviewed by Greptile

Comment thread src/domain/analysisView/analysisView.ts Resolved
Require each projector result to match the unsigned result union before
sealing it, and parse the cycle guard's imports with Babel so comments
and side-effect imports are not misread.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

Admit those projectors through AdmittedView and check test selections
against their request schemas, so misspelled fields fail at the call site.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto
morluto merged commit 940d71a into main Oct 29, 2026
44 checks passed
@morluto
morluto deleted the cursor/analysis-view-cycle-a8f1 branch October 29, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants