refactor(javascript): consume normalized feature seeds

Require parsed seed facts in the pure trace projection and leave raw request defaults at the shared workflow boundary. Remove the redundant seed parse, unused raw-seed alias and duplicate seed-match binding.

Move omitted-versus-explicit defaults and full Evidence identity checks to compiled CLI/MCP acceptance. Reuse the owned MCP fixture and request files in the tests. Matching, native handoff, empty-literal, coverage and immutability checks remain covered; public schemas and successful outputs are unchanged.
This commit is contained in:
morluto committed 2026-10-23 10:22:07 +08:00
1 parent f4b2ba1313
commit 71a024c789
4 files changed
+96 -91

No files matched your search

@@ -12,8 +12,7 @@ import type {
} from "./javascriptApplicationGraphSchemas.js";
import {
applicationFeatureTraceResultSchema,
applicationFeatureSeedSchema,
type ApplicationFeatureSeedInput,
type ApplicationFeatureSeed,
type ApplicationFeatureTraceResult,
type TraceApplicationFeatureInput,
} from "./javascriptFeatureTraceSchemas.js";
@@ -32,23 +31,18 @@ export interface ApplicationFeatureTraceProjectionInput {
readonly sourceEvidenceId: string;
readonly graph: JavaScriptApplicationGraph;
readonly nativeEvidence: readonly Evidence[];
readonly seed: ApplicationFeatureSeedInput;
readonly seed: ApplicationFeatureSeed;
readonly direction: TraceApplicationFeatureInput["direction"];
}
/** Trace a literal feature through its complete reachable, authority-preserving JAG. */
export const traceApplicationFeature = (
source: ApplicationFeatureTraceProjectionInput,
input: ApplicationFeatureTraceProjectionInput,
): ApplicationFeatureTraceResult => {
const input = {
...source,
seed: applicationFeatureSeedSchema.parse(source.seed),
};
const allSeedMatches = findApplicationFeatureSeeds(
const seedMatches = findApplicationFeatureSeeds(
input.graph.nodes,
input.seed,
);
const seedMatches = allSeedMatches;
if (seedMatches.length === 0) return noMatchResult(input);
const traversal = traverseApplicationFeature(
input.graph,
@@ -86,7 +80,7 @@ export const traceApplicationFeature = (
coverage: {
status: traceCoverageStatus(input.graph),
source_graph_status: input.graph.coverage.status,
total_seed_matches: allSeedMatches.length,
total_seed_matches: seedMatches.length,
},
evidence_links: evidenceLinks,
limitations: traceLimitations(input.graph),