mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- The determinism attestation demoted on Date/perf_hooks/process libCalls that had no manifest entry, so the ask-5 §4 invariant (compiles under full fences => deterministic) could not be stated and the spec's own worked-example prefix stdlib.date. refused as unknown; AMBIENT_SURFACE_FNS now projects those families as permanent manifest ids (stdlib.date.*, node-builtin.perf_hooks.performance.now, node-builtin.process.*) with reach-witnessing detectors. - BUILTIN_MODULE_FN_ALIASES folds the special-cased alternate spellings into their member detectors: the fs Buffer/fd/options/withFileTypes/watch-listener variants, the JS-ladder mkdtempSyncChk and lchmodSyncChk, crypto's composed randomBytesToString, and os.userInfo's userHomedir/userShell scalars. - A parity test holds the two scans together over the exhaustive IrLibFn registry: every spelling LIB_NONDETERMINISTIC_PREFIXES demotes on must be deniable through a manifest-id fence, with the library-mode-refused and validate-then-fence residue pinned by name with reasons. - The §4 invariant fixture and K14's worked fences now cover every attestation-known family, and a new K14 case pins the teeth: Date.now / process.env reads under the full-fence profile refuse SC4008 naming the entry instead of attesting deterministic: false post hoc. - Sampling probes cover the new static entries (Date.now, process.pid, performance.now); surface-manifest.json regenerated (18 new entries, 336 total).
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
// The ask-5 §4 invariant fixture: the worked-example determinism profile
|
|
// (translated into this release's real manifest ids, extended to fence
|
|
// EVERY ambient family the attestation demotes on — the Date compositions,
|
|
// the process global's ambient slice, and perf_hooks included) over a
|
|
// program that COMPILES under it. Every fence is present and unreached,
|
|
// and the sidecar's computed attestation must come out `deterministic:
|
|
// true` — with fences covering the ambient-nondeterminism surfaces,
|
|
// determinism holds by construction for whatever compiles, so a program
|
|
// that compiles under full fences yet attests false is a bug in one of
|
|
// the two scans, never ambiguity.
|
|
|
|
export interface Model {
|
|
total: number;
|
|
label: string;
|
|
}
|
|
|
|
export type Msg = { kind: "add"; value: number } | { kind: "label_set"; value: string };
|
|
|
|
export function init(): Model {
|
|
return { total: 0, label: "start" };
|
|
}
|
|
|
|
export function update(m: Model, msg: Msg): Model {
|
|
switch (msg.kind) {
|
|
case "add":
|
|
return { total: m.total + msg.value, label: m.label };
|
|
default:
|
|
return { total: m.total, label: msg.value };
|
|
}
|
|
}
|
|
|
|
let state: Model = init();
|
|
|
|
export function boot(delta: number): number {
|
|
state = update(state, { kind: "add", value: Math.floor(delta) });
|
|
return state.total;
|
|
}
|
|
|
|
console.log("fences-attest ready");
|