mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
refactor(javascript): own coverage facts and reuse block prefixes
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.
This commit is contained in:
1 parent
c8269ca497
commit
f62a2baad8
21 files changed
+898
-125
No files matched your search
@@ -3,6 +3,7 @@ import { applicationCoverageSchema } from "../javascript/javascriptApplicationEv
|
||||
import type { JavaScriptApplicationAnalysisResult } from "../javascript/javascriptApplicationAnalysis.js";
|
||||
import { javaScriptSemanticGraphInputSchema } from "../javascript/javascriptSemanticGraphSchemas.js";
|
||||
import { javaScriptSourceSelectionSchema } from "../javascript/javascriptSourceSelection.js";
|
||||
import { javaScriptStaticCoverageSchema } from "../javascript/javascriptStaticCoverage.js";
|
||||
|
||||
/** Source completeness is independent of exhausting a selected fact page. */
|
||||
export const javascriptApplicationSourceCoverageSchema = z.strictObject({
|
||||
@@ -37,3 +38,39 @@ export const javascriptApplicationSourceCoverage = (
|
||||
semantic_unknown_count: analysis.semantic_graph.unknowns.length,
|
||||
};
|
||||
};
|
||||
|
||||
/** Count only source-file observations; historical missing facts remain unmeasured. */
|
||||
export const javascriptStaticSourceCoverageSummary = (
|
||||
analysis: JavaScriptApplicationAnalysisResult,
|
||||
) => {
|
||||
const summary = {
|
||||
sources: 0,
|
||||
unmeasured_sources: 0,
|
||||
syntax: { complete: 0, recovered: 0, failed: 0, "not-examined": 0 },
|
||||
semantics: { unknown_sources: 0, unexamined_sources: 0 },
|
||||
examination: { complete: 0, limited: 0, "not-examined": 0 },
|
||||
electron_applicability: { observed: 0, unknown: 0 },
|
||||
};
|
||||
for (const node of analysis.graph.nodes) {
|
||||
for (const observation of node.observations) {
|
||||
if (observation.properties.file_kind !== "javascript") continue;
|
||||
summary.sources += 1;
|
||||
const parsed = javaScriptStaticCoverageSchema.safeParse(
|
||||
observation.properties.analysis_coverage,
|
||||
);
|
||||
if (!parsed.success) {
|
||||
summary.unmeasured_sources += 1;
|
||||
continue;
|
||||
}
|
||||
const coverage = parsed.data;
|
||||
summary.syntax[coverage.syntax.status] += 1;
|
||||
summary.examination[coverage.examination.status] += 1;
|
||||
summary.electron_applicability[coverage.applicability.electron] += 1;
|
||||
if (coverage.semantics.unknown_findings === null)
|
||||
summary.semantics.unexamined_sources += 1;
|
||||
else if (coverage.semantics.uncertainty.length > 0)
|
||||
summary.semantics.unknown_sources += 1;
|
||||
}
|
||||
}
|
||||
return summary;
|
||||
};
|
||||
Reference in new issue
Block a user