Repository navigation
refactor(analysis-view): break the analysis view hub cycle - #8061
Conversation
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>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@gensokyo-dev @dandgabr This splits the analysis-view hub so projectors no longer import the module that imports them. The public |
[Medium impact] The PR appears safe to merge; no blocking issue remains. SummarySplits shared types and schemas out of
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"]
Reviews (3) · Last reviewed commit: "fix(analysis-view): close IL2CPP and And..." · Reviewed by Greptile |
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.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Admit those projectors through AdmittedView and check test selections against their request schemas, so misspelled fields fail at the call site.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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 publicinspect_analysis_viewschemas stay exported fromanalysisView.ts.Problem and expected behavior
analysisView.tsimported every projector, and those projectors importedAnalysisViewParent,AnalysisViewRequest, andUnsignedAnalysisViewback from it. UnderverbatimModuleSyntaxthe back-edges are type-only, but they still form one strongly connected component, so a view change loads the whole hub. MovingAnalysisViewParentalone 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 toUnsignedAnalysisView. A missing field or a wrong kind then failed only insidesealAnalysisView. 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
sealAnalysisViewstill attachesview_digest.Change and scope
analysisViewShape.tsowns the shared request fragments (summary,facet,item,page,native),GroupingViewKind, and the admitted-view narrowing helpers.analysisViewRequest.tsowns the request union andinspect_analysis_viewinput schema.analysisViewResult.tsowns the result union.analysisViewParent.tsownsAnalysisViewParent.analysisView.tskeeps dispatch and re-exports the public schemas.sealProjectedandretainrequireResult<UnsignedAnalysisView, AnalysisError>and do not cast the result.analysisViewCycles.test.tsparses imports with Babel, using the same node kinds asscripts/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 asRecord<string, unknown>. IL2CPP and Android symbol projectors takeAdmittedView. 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
analysisView.tsremains the projection dispatcher. Request and result schemas moved to sibling modules and are re-exported. Superseded hub-local copies ofAnalysisViewParentand the request fragments were removed.inspect_analysis_viewinput and result schemas are re-exported from the same module.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; 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.
Evidence and regression coverage
analysisViewCycles.test.tsparses imports with Babel and fails ifanalysisView.tsre-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.tsandmanagedMemberView.test.tsnarrow page results withinchecks because the projector return is no longer the full result union. IL2CPP and Android symbol tests type selections with the owning request schema.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.analysisViewResult.ts. Projectors are checked by inference at the dispatcher rather than by a localz.outputannotation.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
For evidence-bearing changes:
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-boundariespassed for 3405 source files.npm run test:focused -- src/domain/analysisView/*.test.ts— 66 files, 1467 tests passed.npm run check:fastagain and it passed.bd4b68897):npm run format:checkpassed,npm run check:fastpassed, and focused tests for those projectors plus the cycle guard passed 57 tests. The pre-push hook rancheck:fastagain.Compatibility, safety, and release
projectAnalysisViewfromanalysisView.tskeep those exports.Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.