Skip to content

Preserve counterexample path metadata - #278

Open
DicksonWu654 wants to merge 1 commit into
stx-labs:masterfrom
DicksonWu654:fix-counterexample-path
Open

DicksonWu654 wants to merge 1 commit into
stx-labs:masterfrom
DicksonWu654:fix-counterexample-path

Conversation

@DicksonWu654

Copy link
Copy Markdown

fast-check 4 returns the shrink path as counterexamplePath, but Rendezvous
reads only the legacy path when reporting failures and omits the path from
saved regression records. This loses useful diagnostics for a failing run.

Prefer counterexamplePath, with path as a fallback for older callers,
and save it as an optional field. Existing records without the field still
load unchanged. The path is diagnostic shrink metadata, not an exact replay
trace; regression replay continues to use the saved seed and run count.

From a checkout with dependencies installed (npm ci), run this from the
repository root. The build and probe take less than a minute:

npm run build
node <<'NODE'
const { EventEmitter } = require("node:events");
const { mkdtempSync, rmSync } = require("node:fs");
const { tmpdir } = require("node:os");
const { join } = require("node:path");
const { reporter } = require("./dist/heatstroke.js");
const { persistFailure, loadFailures } = require("./dist/persistence.js");

const contract = "ST000000000000000000002AMW42H.path-demo";
const details = {
  failed: true,
  seed: 17,
  numRuns: 1,
  counterexamplePath: "0:1",
  counterexample: [{
    rendezvousContractId: contract,
    selectedTestFunction: {
      name: "test-demo", access: "private", outputs: { type: "bool" },
    },
    functionArgs: [],
    testCaller: ["wallet", "ST000000000000000000002AMW42H"],
  }],
};
const radio = new EventEmitter();
radio.on("logFailure", (message) => {
  if (message.startsWith("Path :")) console.log(message);
});
const baseDir = mkdtempSync(join(tmpdir(), "rv-path-"));
try {
  reporter(details, radio, "test", {});
  persistFailure(details, "test", contract, undefined, { baseDir });
  console.log(JSON.stringify(loadFailures(contract, "test", { baseDir })[0]));
} finally {
  rmSync(baseDir, { recursive: true, force: true });
}
NODE

reporter() prints Path : 0:1; the separate persistFailure() call saves
"counterexamplePath":"0:1" in the JSON record printed next. Before this
change, both are absent. Exit status 1 is expected for the reported failure.

Validation on Linux, Node 24.20.0 / npm 11.19.0:

  • npm run lint -- --deny-warnings: zero warnings and errors.
  • npm run fmt:check, npm run typecheck, and npm run build: passed.
  • npm test -- heatstroke.tests.ts persistence.tests.ts: 19 tests passed.
  • npm test: all 160 tests passed across 11 files; run once.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T19:06:11.094692Z e4a353e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant