mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
Separate syntax, semantic uncertainty, examination limits and observed Electron applicability at the static producer, then preserve them through worker, graph and retained/inline summary views. Derive the established parse_status from the same facts and leave historical measurements unknown. Give semantic resource-limit classifications one schema owner. Replace repeated block-prefix searches and copies with collector-scoped syntax indexes. Keep invocation environments separate, charge indexing/replay to the existing work budget and yield during prefix work. Remove the superseded synchronous collector entrypoint. Validated producer, worker, CLI/MCP, historical and partial-coverage regressions, plus actual cancellation during indexing. Bounded authored 128/256-call controls preserved all prior facts while replacing repeated search/copy work with one index pass; this is not a throughput or agent-token benchmark.
73 lines
2.4 KiB
TypeScript
73 lines
2.4 KiB
TypeScript
import { z } from "zod";
|
|
import { javaScriptSemanticResourceLimitSchema } from "./javascriptSemanticValueTypes.js";
|
|
|
|
/** Independent observations from one inert static pass; no runtime completeness claim. */
|
|
export const javaScriptStaticCoverageSchema = z.strictObject({
|
|
syntax: z.discriminatedUnion("status", [
|
|
z.strictObject({
|
|
status: z.literal("complete"),
|
|
error_count: z.literal(0),
|
|
}),
|
|
z.strictObject({
|
|
status: z.literal("recovered"),
|
|
error_count: z.int().positive(),
|
|
}),
|
|
z.strictObject({ status: z.literal("failed"), error_count: z.null() }),
|
|
z.strictObject({
|
|
status: z.literal("not-examined"),
|
|
error_count: z.null(),
|
|
}),
|
|
]),
|
|
semantics: z.strictObject({
|
|
unknown_findings: z.int().nonnegative().nullable(),
|
|
uncertainty: z.array(
|
|
z.enum([
|
|
"dynamic-findings",
|
|
"returned-reference-widening",
|
|
"type-only-module-side-effect",
|
|
]),
|
|
),
|
|
}),
|
|
examination: z.strictObject({
|
|
status: z.enum(["complete", "limited", "not-examined"]),
|
|
semantic_resource_limits: z.array(javaScriptSemanticResourceLimitSchema),
|
|
electron_call_paths_limited: z.boolean(),
|
|
}),
|
|
applicability: z.strictObject({ electron: z.enum(["observed", "unknown"]) }),
|
|
unexamined_reason: z.string().min(1).exactOptional(),
|
|
});
|
|
|
|
export type JavaScriptStaticCoverage = z.infer<
|
|
typeof javaScriptStaticCoverageSchema
|
|
>;
|
|
|
|
/** Preserve the established conservative summary, independently of finer facts. */
|
|
export const javaScriptStaticParseStatus = (
|
|
coverage: JavaScriptStaticCoverage,
|
|
): "complete" | "partial" | "failed" =>
|
|
coverage.syntax.status === "failed" ||
|
|
coverage.syntax.status === "not-examined"
|
|
? "failed"
|
|
: coverage.syntax.status === "recovered" ||
|
|
(coverage.semantics.unknown_findings ?? 0) > 0 ||
|
|
coverage.examination.semantic_resource_limits.includes(
|
|
"alias-selections",
|
|
)
|
|
? "partial"
|
|
: "complete";
|
|
|
|
/** Unperformed work has no measured syntax, finding count or framework applicability. */
|
|
export const unexaminedJavaScriptStaticCoverage = (
|
|
reason: string,
|
|
): JavaScriptStaticCoverage => ({
|
|
syntax: { status: "not-examined", error_count: null },
|
|
semantics: { unknown_findings: null, uncertainty: [] },
|
|
examination: {
|
|
status: "not-examined",
|
|
semantic_resource_limits: [],
|
|
electron_call_paths_limited: false,
|
|
},
|
|
applicability: { electron: "unknown" },
|
|
unexamined_reason: reason,
|
|
});
|