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

* refactor(analysis-view): break the analysis view hub cycle

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>

* fix(analysis-view): check inferred projector results

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.

* fix(analysis-view): close IL2CPP and Android symbol view inputs

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: morluto <morluto@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-10-30 05:41:58 +08:00
1 parent 4a8d8f72b3
commit 940d71a45a
59 files changed
+2915 -2319

No files matched your search

+15 -12
View File
@@ -3,13 +3,13 @@ import {
pythonPycSchema,
type PythonPycCodeObject,
} from "../python/pythonPyc.js";
import type { AnalysisError } from "../analysisErrorBase.js";
import { err, ok, type Result } from "../result.js";
import type {
AnalysisViewParent,
AnalysisViewRequest,
UnsignedAnalysisView,
} from "./analysisView.js";
import { err, ok } from "../result.js";
import type { AnalysisViewParent } from "./analysisViewParent.js";
import {
ownedView,
type AdmittedView,
type SummaryAnalysisView,
} from "./analysisViewShape.js";
import { analysisViewInputError } from "./analysisViewErrors.js";
import { createAnalysisViewResultReader } from "./analysisViewParent.js";
import {
@@ -62,9 +62,12 @@ const readReport = createAnalysisViewResultReader(pythonPycSchema);
/** Project code-constant references from historical facts, without reopening the pyc. */
export const projectPythonPycView = (
parent: AnalysisViewParent,
view: AnalysisViewRequest,
): Result<UnsignedAnalysisView, AnalysisError> => {
if (view.kind !== "summary" && view.kind !== "python-pyc")
admitted: AdmittedView,
) => {
const view = ownedView<
SummaryAnalysisView | z.output<typeof pythonPycViewRequestSchema>
>(admitted, "summary", "python-pyc");
if (view === undefined)
return err(
analysisViewInputError([
{
@@ -96,7 +99,7 @@ export const projectPythonPycView = (
if (view.kind === "summary")
return ok({
...shared,
kind: "summary",
kind: "summary" as const,
view,
summary,
coverage: completeWithinViewCoverage(
@@ -132,7 +135,7 @@ export const projectPythonPycView = (
);
return ok({
...shared,
kind: "python-pyc",
kind: "python-pyc" as const,
view,
pyc: summary,
items: selected.rows,