chore: merge main into audited lifecycle fixes

This commit is contained in:
morluto committed 2026-10-20 19:28:09 +08:00
commit 22278b20c0
286 files changed
+30304 -1706

No files matched your search

@@ -8,6 +8,41 @@ import {
} from "./JavaScriptAnalysisWorkerSchemas.js";
import { analyzeJavaScriptSemantics } from "../../domain/javascript/javascriptSemanticAnalysis.js";
import { getterExpansionSource } from "../../../tests/fixtures/javascriptGetterExpansion.js";
import { aliasSelectionBudgetSource } from "../../../tests/fixtures/javascriptAliasSelectionBudget.js";
it("transfers bounded alias selection coverage across the worker boundary", () => {
const source = aliasSelectionBudgetSource();
const facts = analyzeJavaScriptStaticSource(source);
const ir = analyzeJavaScriptSemantics(source);
const header = { coverage: ir.coverage, limitations: ir.limitations };
expect(ir.coverage).toMatchObject({
status: "partial",
resourceLimits: ["alias-selections"],
});
expect(
javaScriptWorkerModuleHeaderSchema.parse(
JSON.parse(JSON.stringify(header)) as unknown,
),
).toEqual(header);
expect(
javaScriptWorkerStaticAnalysisSchema.parse(
JSON.parse(JSON.stringify(facts)) as unknown,
),
).toEqual(facts);
});
it("retains application path change identity and provenance across the worker boundary", () => {
const facts = analyzeJavaScriptStaticSource(`
const { app } = require("electron");
app.setAppPath("./other");
`);
expect(facts.electron.app_path_changes).toHaveLength(1);
expect(
javaScriptWorkerStaticAnalysisSchema.parse(
JSON.parse(JSON.stringify(facts)) as unknown,
),
).toEqual(facts);
});
it("transfers getter expansion limits and unknown bindings across the worker boundary", () => {
const ir = analyzeJavaScriptSemantics(getterExpansionSource());
@@ -155,6 +155,9 @@ const bridgeShape = {
const utilityShape = { ...findingContext, service_name: z.string().nullable() };
const electron = z
.strictObject({
app_path_changes: z
.array(z.strictObject(findingContext).transform(withRuntime))
.optional(),
call_paths: z
.array(
z.strictObject({
@@ -285,8 +288,9 @@ const electron = z
}),
),
})
.transform(({ call_paths, ...rest }) => ({
.transform(({ call_paths, app_path_changes, ...rest }) => ({
...rest,
...(app_path_changes === undefined ? {} : { app_path_changes }),
...(call_paths === undefined ? {} : { call_paths }),
}));
const referenceShape = {
@@ -422,6 +426,7 @@ const resourceLimit = z.enum([
"primitive-bytes",
"expression-depth",
"getter-expansion",
"alias-selections",
]);
const primitive = z.union([z.string(), z.number(), z.boolean(), z.null()]);
const property: z.ZodType<JavaScriptSemanticProperty> = z.lazy(() =>