Lines 1-24typescript
1// The candor-spec conformance cases in TypeScript — paired by bare function name with the Rust and
2// Java fixtures; the expected effect sets are conformance/expected.json (the SAME oracle).
3import * as fsm from "node:fs";
4import * as netm from "node:net";
5import * as cp from "node:child_process";
6import * as cryptom from "node:crypto";
7import { DatabaseSync } from "node:sqlite";
8import * as winstonm from "winston";
10// --- one function per std-only effect ---
11export function fs_read(): void { try { fsm.readFileSync("/tmp/x"); } catch {} }
12export function net_connect(): void { try { netm.connect(1, "h"); } catch {} }
13export function exec_spawn(): void { try { cp.spawn("x"); } catch {} }
14// Exec-cliff refinement (spec §4 ⟨0.5⟩): a known literal head adds its effect; all engines must agree.
15export function exec_curl(): void { try { cp.spawn("curl"); } catch {} }
16// Exec-refinement reads the HEAD (argv[0]) only: a dynamic program with a literal ARGUMENT keeps the
17// bare cliff — "curl" in the args array must NOT fabricate Net (spec §4 ⟨0.5⟩: the head is argv[0]).
18export function exec_dyn_head(tool: string): void { try { cp.spawn(tool, ["curl"]); } catch {} }
19export function env_read(): void { void process.env.X; }
20export function clock_now(): void { void Date.now(); }
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
Cases.tsView on unpkg · L3 21// Rand: node:crypto's CSPRNG. candor-ts is syntactic (AST), so the builtin need not resolve at scan time.
22export function rand_gen(): void { void cryptom.randomBytes(16); }
23// Db: node:sqlite's DatabaseSync.exec is the store round-trip (named import — candor-ts tracks the symbol).
24export function db_query(): void { void new DatabaseSync(":memory:").exec("SELECT 1"); }