mirror of
https://github.com/morluto/rea.git
synced 2026-11-22 14:35:45 +00:00
perf(ci): optimize semantic graph construction, directory containment checks, gate checkouts, and boundary stragglers (#11851)
* perf(javascript): avoid redundant semantic graph validation and node hashing * perf(resources): deduplicate directory containment checks and root lstat calls * perf(ci): trace script fixture modules, sparse-checkout gate jobs, and parallelize built doc checks * perf(tests): memoize live MCP doctor expectations and reuse CLI and verifier compilation * fix(ci): enforce containment after skipped entries, validate interned contexts, and supervise doc and verifier teardowns * fix(docs): decode buffered check output once to preserve multi-byte UTF-8
This commit is contained in:
1 parent
015f726a9e
commit
84ee604c6d
25 files changed
+1650
-259
No files matched your search
@@ -5,6 +5,66 @@ import type { JsonValue } from "../../domain/jsonValue.js";
|
||||
|
||||
const INFERENCE_LIMITATION =
|
||||
"This relationship is a conservative static candidate; it does not prove runtime execution or causal flow.";
|
||||
const CANDIDATE_BUILTIN_LIMITATION =
|
||||
"The built-in identity or its mutation state is unproven; this operation is conditional.";
|
||||
const UNKNOWN_SYNTAX_LIMITATION =
|
||||
"Dynamic syntax prevents an exact static relationship.";
|
||||
|
||||
const SEMANTIC_EXTRACTOR: ApplicationGraphEvidence["extractor"] = Object.freeze(
|
||||
{
|
||||
name: "rea-javascript-semantic-analysis",
|
||||
version: "1",
|
||||
operation: "analyze_javascript_application",
|
||||
executable_sha256: null,
|
||||
},
|
||||
);
|
||||
|
||||
const EMPTY_LIMITS = Object.freeze(
|
||||
[],
|
||||
) as unknown as ApplicationGraphEvidence["coverage"]["limits"];
|
||||
|
||||
const COMPLETE_COVERAGE: ApplicationGraphEvidence["coverage"] = Object.freeze({
|
||||
status: "complete",
|
||||
truncated: false,
|
||||
omitted_count: 0,
|
||||
limits: EMPTY_LIMITS,
|
||||
});
|
||||
|
||||
const EMPTY_STRINGS: readonly string[] = Object.freeze([]);
|
||||
const INFERENCE_LIMITATIONS: readonly string[] = Object.freeze([
|
||||
INFERENCE_LIMITATION,
|
||||
]);
|
||||
const CANDIDATE_BUILTIN_LIMITATIONS: readonly string[] = Object.freeze([
|
||||
INFERENCE_LIMITATION,
|
||||
CANDIDATE_BUILTIN_LIMITATION,
|
||||
]);
|
||||
const UNKNOWN_LIMITATIONS: readonly string[] = Object.freeze([
|
||||
UNKNOWN_SYNTAX_LIMITATION,
|
||||
]);
|
||||
|
||||
type AvailableArtifactReference = Extract<
|
||||
ApplicationGraphEvidence["artifact"],
|
||||
{ readonly available: true }
|
||||
>;
|
||||
|
||||
const cachedFileArtifacts = new WeakMap<
|
||||
JavaScriptArtifactFile,
|
||||
AvailableArtifactReference
|
||||
>();
|
||||
|
||||
const observedFileArtifact = (
|
||||
file: JavaScriptArtifactFile,
|
||||
): AvailableArtifactReference => {
|
||||
const cached = cachedFileArtifacts.get(file);
|
||||
if (cached !== undefined && cached.sha256 === file.sha256) return cached;
|
||||
const created: AvailableArtifactReference = Object.freeze({
|
||||
available: true,
|
||||
artifact_id: `art_${file.sha256}`,
|
||||
sha256: file.sha256,
|
||||
});
|
||||
cachedFileArtifacts.set(file, created);
|
||||
return created;
|
||||
};
|
||||
|
||||
/** Exact artifact-backed syntax evidence for one semantic graph node. */
|
||||
export const observedSemanticEvidence = (
|
||||
@@ -14,11 +74,7 @@ export const observedSemanticEvidence = (
|
||||
authority: "ast-static-analysis",
|
||||
state: "observed",
|
||||
confidence: "exact",
|
||||
artifact: {
|
||||
available: true,
|
||||
artifact_id: `art_${file.sha256}`,
|
||||
sha256: file.sha256,
|
||||
},
|
||||
artifact: observedFileArtifact(file),
|
||||
location:
|
||||
location === null
|
||||
? { available: true, value: { kind: "artifact-path", path: file.path } }
|
||||
@@ -26,20 +82,10 @@ export const observedSemanticEvidence = (
|
||||
available: true,
|
||||
value: { kind: "source-range", source: file.path, ...location },
|
||||
},
|
||||
extractor: {
|
||||
name: "rea-javascript-semantic-analysis",
|
||||
version: "1",
|
||||
operation: "analyze_javascript_application",
|
||||
executable_sha256: null,
|
||||
},
|
||||
coverage: {
|
||||
status: "complete",
|
||||
truncated: false,
|
||||
omitted_count: 0,
|
||||
limits: [],
|
||||
},
|
||||
limitations: [],
|
||||
evidence_ids: [],
|
||||
extractor: SEMANTIC_EXTRACTOR,
|
||||
coverage: COMPLETE_COVERAGE,
|
||||
limitations: EMPTY_STRINGS as string[],
|
||||
evidence_ids: EMPTY_STRINGS as string[],
|
||||
});
|
||||
|
||||
/** Conservative static relationship evidence derived from one syntax node. */
|
||||
@@ -50,7 +96,7 @@ export const inferredSemanticEvidence = (
|
||||
authority: "static-relationship-inference",
|
||||
state: "inferred",
|
||||
confidence: "high",
|
||||
limitations: [INFERENCE_LIMITATION],
|
||||
limitations: INFERENCE_LIMITATIONS as string[],
|
||||
});
|
||||
|
||||
/** Static relationship evidence anchored at the syntax that proves the link. */
|
||||
@@ -62,24 +108,20 @@ export const inferredSemanticEvidenceAt = (
|
||||
authority: "static-relationship-inference",
|
||||
state: "inferred",
|
||||
confidence: "high",
|
||||
limitations: [INFERENCE_LIMITATION],
|
||||
limitations: INFERENCE_LIMITATIONS as string[],
|
||||
});
|
||||
|
||||
/** A built-in operation whose identity is conditional on loader or mutation facts. */
|
||||
export const candidateBuiltinSemanticEvidence = (
|
||||
file: JavaScriptArtifactFile,
|
||||
location: JavaScriptSourceRange,
|
||||
): ApplicationGraphEvidence => {
|
||||
const evidence = inferredSemanticEvidenceAt(file, location);
|
||||
return {
|
||||
...evidence,
|
||||
confidence: "low",
|
||||
limitations: [
|
||||
...evidence.limitations,
|
||||
"The built-in identity or its mutation state is unproven; this operation is conditional.",
|
||||
],
|
||||
};
|
||||
};
|
||||
): ApplicationGraphEvidence => ({
|
||||
...observedSemanticEvidence(file, location),
|
||||
authority: "static-relationship-inference",
|
||||
state: "inferred",
|
||||
confidence: "low",
|
||||
limitations: CANDIDATE_BUILTIN_LIMITATIONS as string[],
|
||||
});
|
||||
|
||||
type SemanticBuiltinOperation = {
|
||||
readonly builtinAuthority?: "candidate" | undefined;
|
||||
@@ -160,5 +202,5 @@ export const unknownSemanticEvidence = (
|
||||
authority: "unknown",
|
||||
state: "unknown",
|
||||
confidence: "unknown",
|
||||
limitations: ["Dynamic syntax prevents an exact static relationship."],
|
||||
limitations: UNKNOWN_LIMITATIONS as string[],
|
||||
});
|
||||
Reference in new issue
Block a user