Files
hyperframes/packages/studio/tests/e2e/edit-accuracy/trace.mjs
Miguel Ángel 58552ede4b test(studio): record each edit-accuracy shard's file writes and reloads when HF_WRITE_TRACE is set (#6532)
* test(studio): record each edit-accuracy shard's file writes and reloads when HF_WRITE_TRACE is set

* style(studio): format the write trace

* fix(core): hash the write trace with sha256

* style(studio): wrap the trace hash helper

* style(studio): format the trace hash helper

* fix(studio): turn the reload log on in the Studio page the trace watches
2026-10-27 11:50:20 +00:00

13 lines
488 B
JavaScript

// Bench-side lines for the write trace (HF_WRITE_TRACE), in the same file as the server's.
import { appendFileSync } from "node:fs";
import { createHash } from "node:crypto";
export const traceBench = (kind, data = {}) => {
if (process.env.HF_WRITE_TRACE)
appendFileSync(
process.env.HF_WRITE_TRACE,
JSON.stringify({ t: Date.now(), kind, ...data }) + "\n",
);
};
export const hashOf = (text) => createHash("sha256").update(String(text)).digest("hex").slice(0, 8);