Files
rea/src/application/JavaScriptArtifactAnalysisTypes.ts
T
morlutoandDevin e91c8c39c2 refactor(test): colocate pure-domain tests and reduce test debt (#471)
* refactor(test): colocate pure-domain tests and reduce test debt

Move focused immutable domain/contracts/adapter tests from
tests/composition/** beside their production owners under src/** as
colocated *.test.ts/*.fixture.ts, and relocate persistence-shaped
composition tests under tests/boundary/filesystem/**. Update import
paths, the Vitest project topology (shared worker context for pure
domain/contracts and recording-port service projects), the test
migration ledger, testing docs, and AGENTS.md to match.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* docs: remove test migration ledger

The cutover is complete and the ledger is no longer referenced anywhere
in source, scripts, or the docs gate. Drop the standalone artifact.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* docs: clean up stale migration artifacts

Remove empty directories left by the test migration and replace the
"final cutover" language in docs/testing.md with standing PR guidance
that no longer references the completed migration.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: repair CI failures from schema, knip, and stale generated artifacts

Three root causes fixed:

1. catalog-schemas.mjs: valuesAt only traversed anyOf from Zod's
   toJSONSchema, not oneOf. The webScreenshotDiffSchema change to a
   discriminated union produces oneOf, so the product catalog generator
   could not derive the web_screenshot_diff schema version. Add oneOf
   traversal.

2. conformancePackage.ts: the test rewrite removed the only imports of
   ScenarioManifest, ReplayPlan, ShimPlan, and ExpectedEvidence, making
   them unused exports that knip flags. Remove the dead type aliases.

3. Regenerate stale artifacts (product catalog, MCP tool catalog, skill
   metadata, conformance manifest) that drifted from the source changes.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-10 14:57:44 +08:00

125 lines
3.9 KiB
TypeScript

import type {
JavaScriptSourceRange,
JavaScriptStaticAnalysis,
} from "../domain/javascriptStaticAnalysisTypes.js";
import type {
JavaScriptSemanticIr,
JavaScriptSemanticLimits,
} from "../domain/javascriptSemanticIr.js";
import type { JavaScriptArtifactFile } from "./JavaScriptArtifactFiles.js";
interface JavaScriptStructuredObservation {
readonly path: string;
readonly sha256: string;
}
interface JavaScriptPackageValues {
readonly name: string | null;
readonly version: string | null;
readonly main: string | null;
readonly renderer: string | null;
}
/** Parsed package metadata used only for static entrypoint discovery. */
export type JavaScriptPackageObservation = JavaScriptStructuredObservation &
(
| (JavaScriptPackageValues & {
readonly status: "included";
readonly limitation: null;
})
| {
readonly status: "invalid" | "unavailable";
readonly name: null;
readonly version: null;
readonly main: null;
readonly renderer: null;
readonly limitation: string;
}
);
/** One HTML script source observed without building or executing a DOM. */
export interface JavaScriptHtmlScriptObservation {
readonly html_path: string;
readonly script_path: string;
readonly base_href: string | null;
readonly location: JavaScriptSourceRange;
}
/** One original source declared by an approved local source map. */
export interface JavaScriptSourceMapOriginal {
readonly source: string;
readonly content: string | null;
readonly content_sha256: string | null;
}
/** Bounded local source-map parse result. */
export type JavaScriptSourceMapObservation = JavaScriptStructuredObservation &
(
| {
readonly status: "included";
readonly sources: readonly JavaScriptSourceMapOriginal[];
readonly omitted_sources: 0;
readonly limitation: null;
}
| {
readonly status: "truncated";
readonly sources: readonly JavaScriptSourceMapOriginal[];
readonly omitted_sources: number | null;
readonly limitation: string;
}
| {
readonly status: "invalid" | "not-approved";
readonly sources: readonly [];
readonly omitted_sources: 0;
readonly limitation: string;
}
);
/** Bounded parse status for one inventoried JSON module. */
export type JavaScriptJsonModuleObservation = JavaScriptStructuredObservation &
(
| {
readonly status: "included";
readonly top_level_keys: readonly string[];
readonly omitted_top_level_keys: number;
readonly limitation: null;
}
| {
readonly status: "invalid";
readonly top_level_keys: readonly [];
readonly omitted_top_level_keys: 0;
readonly limitation: string;
}
| {
readonly status: "unavailable";
readonly top_level_keys: readonly [];
readonly omitted_top_level_keys: null;
readonly limitation: string;
}
);
/** One relevant file plus optional AST-only JavaScript facts. */
export interface AnalyzedJavaScriptArtifactFile {
readonly file: JavaScriptArtifactFile;
readonly javascript: JavaScriptStaticAnalysis | null;
readonly semantic: {
readonly ir: JavaScriptSemanticIr;
readonly limits: JavaScriptSemanticLimits;
} | null;
}
/** Complete bounded static-analysis projection before graph construction. */
export interface JavaScriptArtifactAnalysis {
readonly files: readonly AnalyzedJavaScriptArtifactFile[];
readonly packages: readonly JavaScriptPackageObservation[];
readonly json_modules: readonly JavaScriptJsonModuleObservation[];
readonly html_scripts: readonly JavaScriptHtmlScriptObservation[];
readonly source_maps: readonly JavaScriptSourceMapObservation[];
readonly visited_ast_nodes: number;
readonly findings: number;
readonly modules: number;
readonly parse_failures: number;
readonly truncated_scopes: number;
readonly limitations: readonly string[];
}