fix(javascript): trace nested Electron bridge members (#2745)

* fix(javascript): trace nested Electron bridge members

* fix(javascript): preserve shallow Electron bridge paths

* fix(javascript): preserve exact Electron bridge member paths

* fix(javascript): preserve exact Electron bridge paths

* fix(javascript): preserve bridge entry ownership

* fix(javascript): preserve bridge path identity

* fix(javascript): normalize typed feature seeds before tracing

* test(javascript): normalize direct selector seed inputs

* refactor(javascript): consume normalized feature seed defaults

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Avocado
2026-10-14 01:16:44 +11:00
committed by GitHub
parent c9982ad8bf
commit f0b8ae1fc8
14 changed files with 643 additions and 51 deletions
@@ -11,7 +11,10 @@ import {
} from "./javascriptApplicationGraph.fixture.js";
import { findApplicationFeatureSeeds } from "./javascriptFeatureSeed.js";
import { traceApplicationFeature } from "./javascriptFeatureTrace.js";
import type { ApplicationFeatureSeed } from "./javascriptFeatureTraceSchemas.js";
import {
applicationFeatureSeedSchema,
type ApplicationFeatureSeed,
} from "./javascriptFeatureTraceSchemas.js";
import { analyzeJavaScriptStaticSource } from "./javascriptStaticAnalysis.js";
import type { JsonValue } from "../jsonValue.js";
@@ -268,6 +271,32 @@ describe("feature seed selection controls", () => {
});
describe("public feature trace from contextBridge source members", () => {
it.each(["openProject", "missingProject"])(
"normalizes optional seed defaults before deriving trace identity for %s",
(value) => {
const input = {
sourceEvidenceId,
graph: contextBridgeGraph(),
nativeEvidence: [],
direction: "both" as const,
};
const omitted = traceApplicationFeature({
...input,
seed: { kind: "api", value },
});
const explicit = traceApplicationFeature({
...input,
seed: {
kind: "api",
value,
match: null,
case_sensitive: false,
},
});
expect(omitted).toEqual(explicit);
},
);
it("traces one exact member seed through the public feature workflow", () => {
const mode = {
value: "openProject",
@@ -381,12 +410,13 @@ const sourceEvidenceId = `ev_${"b".repeat(64)}`;
const seed = (
kind: ApplicationFeatureSeed["kind"],
value = "openProject",
): ApplicationFeatureSeed => ({
kind,
value,
match: "exact",
case_sensitive: true,
});
): ApplicationFeatureSeed =>
applicationFeatureSeedSchema.parse({
kind,
value,
match: "exact",
case_sensitive: true,
});
const memberNode = (
kind: ApplicationNode["kind"],