Keep runtime data out of Next's output file tracing
next build warned that the env-dependent registry and credential-store paths made Turbopack trace the whole project (vrek iss-jvxcd1n). Marking only the readFile calls cleared the warning, but it still traced .data/cameras.json and the encrypted .data/credentials.json, which a standalone deployment would copy from the build machine. A /* turbopackIgnore: true */ on each default path.join(process.cwd(), ".data", ...) fixes both. The traced files for every route now include nothing from src/, public/ or .data/. The env-var overrides the tests use still work. Refreshes the vrek export. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4931c3af83
commit
a174d7a2d6
@ -258,3 +258,7 @@
|
||||
{"id":"evt-2xzed3xn0deh","type":"edge.added","subject":"ver-ata01qf","actor":"prn-q80g8mz","actor_kind":"agent","session":null,"payload":{"kind":"evidence_for","from":"ver-ata01qf","to":"iss-zjpc22k"},"at":"2026-09-19T14:17:42.238Z","parents":["evt-m1kfa935btnf"],"hash":"78885766ed2ce868f7a734174ff90de45073c05061ccc499b76221e2076ef182"}
|
||||
{"id":"evt-3prszpdhev6p","type":"verification.recorded","subject":"ver-ata01qf","actor":"prn-q80g8mz","actor_kind":"agent","session":null,"payload":{"result":"pass","evidence":"2026-09-19: `npm run coverage` exit=0 at 99.77% lines. `npx vitest run --coverage --coverage.thresholds.lines=100` exit=1 with \"ERROR: Coverage for lines (99.77%) does not meet global threshold (100%)\", which shows the check fails the run."},"at":"2026-09-19T14:17:42.239Z","parents":["evt-2xzed3xn0deh"],"hash":"0a506113db391f0bc0cda852d58e807b5a4e4a5bceca7d689171c28fdf807ea3"}
|
||||
{"id":"evt-3s0p3p5jac04","type":"node.status_changed","subject":"iss-zjpc22k","actor":"prn-q80g8mz","actor_kind":"agent","session":null,"payload":{"from":"open","to":"done"},"at":"2026-09-19T14:17:43.311Z","parents":["evt-3prszpdhev6p"],"hash":"af762768a2a8b2255f400662c7a83742c5f9e4039fdb7aa498de25fc922a0425"}
|
||||
{"id":"evt-8x1b7dp5t0f0","type":"node.created","subject":"ver-bnbvcep","actor":"prn-q80g8mz","actor_kind":"agent","session":null,"payload":{"kind":"verification","title":"`next build` shows no tracing warnings, and the traced files for /, /api/discover and /api/cameras/[id]/{info,snapshot,credentials} include nothing from src/, public/ or .data/; the env-var path overrides still work (store tests pass).","body":"","status":"pending","owner":"prn-q80g8mz","attrs":{}},"at":"2026-09-19T14:23:23.401Z","parents":["evt-3s0p3p5jac04"],"hash":"6fdea2b6bb0cf260b3255c9183addad0ae5dfaa1cdb4bccabcbd696e09742059"}
|
||||
{"id":"evt-bez2zz3sb8xn","type":"edge.added","subject":"ver-bnbvcep","actor":"prn-q80g8mz","actor_kind":"agent","session":null,"payload":{"kind":"evidence_for","from":"ver-bnbvcep","to":"iss-jvxcd1n"},"at":"2026-09-19T14:23:23.405Z","parents":["evt-8x1b7dp5t0f0"],"hash":"cd4b45af93b765ba2bbfa6a665b3b63cea2bc067db740bd6609acd4678b1ca26"}
|
||||
{"id":"evt-8pf21y5tkn3y","type":"verification.recorded","subject":"ver-bnbvcep","actor":"prn-q80g8mz","actor_kind":"agent","session":null,"payload":{"result":"pass","evidence":"2026-09-19: `npx next build` gives 0 'Dynamic filesystem access' warnings. The .next/server/app/**.nft.json for all five routes have 0 src/, 0 public/ and 0 .data/ entries. Before, the whole project was traced; with only readFile ignored, .data/cameras.json and .data/credentials.json were still traced, which would have copied the local camera registry and encrypted logins into a standalone bundle. Fix: a /* turbopackIgnore: true */ on the default path.join(process.cwd(), '.data', ...) in camera-registry.ts and credential-store.ts, which alone also clears the readFile warning. Full suite 200/200, coverage 99.77%, tsc and eslint clean."},"at":"2026-09-19T14:23:23.406Z","parents":["evt-bez2zz3sb8xn"],"hash":"c1c680a72c02c6076893f6d942a4a8a1a445fcf6d50fc2f264e16d2f2eb9625c"}
|
||||
{"id":"evt-mbng7jjqd16c","type":"node.status_changed","subject":"iss-jvxcd1n","actor":"prn-q80g8mz","actor_kind":"agent","session":null,"payload":{"from":"open","to":"done"},"at":"2026-09-19T14:23:24.548Z","parents":["evt-8pf21y5tkn3y"],"hash":"2e53812074a3a2ebaf7c5447d79c34f9ef8eed4387177d3d0e6ca4bef9c82b5f"}
|
||||
|
||||
@ -31,8 +31,12 @@ export interface CameraSummary {
|
||||
lastSeen: string;
|
||||
}
|
||||
|
||||
// Runtime data, not a build input. The ignore comment keeps it out of Next's output file
|
||||
// tracing, which would otherwise copy this machine's .data/ (or, for an env-dependent path,
|
||||
// the whole project) into the server bundle.
|
||||
const REGISTRY_PATH =
|
||||
process.env.CAMERA_REGISTRY_FILE ?? path.join(process.cwd(), ".data", "cameras.json");
|
||||
process.env.CAMERA_REGISTRY_FILE ??
|
||||
path.join(/* turbopackIgnore: true */ process.cwd(), ".data", "cameras.json");
|
||||
|
||||
const UUID_URN = /^urn:uuid:([0-9a-f-]{36})$/i;
|
||||
|
||||
|
||||
@ -17,8 +17,13 @@ export const credentialsSchema = z.object({
|
||||
|
||||
// Stored on the server's disk only, encrypted with CAMERA_CREDENTIALS_KEY. The API never
|
||||
// returns passwords; the web UI can only set, replace, or clear them.
|
||||
//
|
||||
// Runtime data, not a build input. The ignore comment keeps it out of Next's output file
|
||||
// tracing, which would otherwise copy this machine's .data/ (or, for an env-dependent path,
|
||||
// the whole project) into the server bundle.
|
||||
const STORE_PATH =
|
||||
process.env.CAMERA_CREDENTIALS_FILE ?? path.join(process.cwd(), ".data", "credentials.json");
|
||||
process.env.CAMERA_CREDENTIALS_FILE ??
|
||||
path.join(/* turbopackIgnore: true */ process.cwd(), ".data", "credentials.json");
|
||||
|
||||
type Store = Record<string, Credentials>;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user