fix(plugins): harness-watch-w1 recheck: with no digest on either record the version stands in only when both records have one, so a timeout or a throw (no version) between two unknown passes is no transition (N1); README says the stored surfaces are redacted and so are for display and comparison, with fit rules run inside the module on the text the binary printed (N2), and that pi's "can't be checked" is read after its lookup label (#1873, lane harness-watch-w1)
This commit was merged in pull request #2013.
This commit is contained in:
1 parent
af8c2f9777
commit
4a7815d29e
3 files changed
+24
-4
No files matched your search
@@ -398,7 +398,8 @@ there. `signal` aborts when the watch stops waiting. `pi` returns its fit
|
||||
check (`packages/harness/src/pi-fit.mjs`), called exactly as `preflight`
|
||||
calls it, so the two share one cache and one running check. Its digest is
|
||||
that check's digest of the binary's files; a failed check gives none. A
|
||||
failure whose line says "can't be checked" is `fit: "unknown"`.
|
||||
failure whose line, after pi's lookup label, starts with "can't be checked"
|
||||
is `fit: "unknown"`.
|
||||
`claude-code` returns the sha256 of the binary's real file and the first
|
||||
line of `--version`, and captures `--help` as the `help` surface, both run
|
||||
from that same real file with only PATH and a scratch HOME. Its lookup for
|
||||
@@ -436,7 +437,16 @@ get the same treatment. A record also carries `via` (`inspect` or
|
||||
(`{ harness, at, from, to, failed, line }`, with `from` null on a first
|
||||
sight) is given only when the state or the binary is not the last record's.
|
||||
The digest names the binary; when neither record has one (pi gives none for
|
||||
a failed check), the version label stands in for it.
|
||||
a failed check), the version label stands in for it, and only when both
|
||||
records have a version: a timeout or a throw knows none, and is not a new
|
||||
binary. So unknown 2.0, a timeout, then unknown 2.1, all with no digest,
|
||||
gives no transition for the version; W1 keeps no last known version.
|
||||
|
||||
The redaction applies to the stored surfaces too, so a surface is for
|
||||
display and comparison, not for fit rules: with USER set to `model`, the
|
||||
stored `help` reads `--<user>` where claude printed `--model`. A fit rule
|
||||
(slice W2's flag check, for one) runs inside the module on the text the
|
||||
binary printed and puts its answer in `fit`, `failed` and `line`.
|
||||
|
||||
## Transcript usage source (row 124)
|
||||
|
||||
|
||||
@@ -80,11 +80,13 @@ export async function watchHarnesses({ last = [], env = process.env, scratch = n
|
||||
// The latest digest the last record knew: its own, or the one it carried forward.
|
||||
const known = (prior) => [prior?.digest, prior?.lastDigest].find((d) => typeof d === "string" && DIGEST.test(d)) ?? null;
|
||||
// Whether two records are of the same binary. The digest decides; when neither record has one
|
||||
// (pi gives none for a failed check), the version label stands in for it.
|
||||
// (pi gives none for a failed check), the version label stands in for it, but only when both
|
||||
// records have one: a pass that timed out or threw knows no version, which is not a new binary.
|
||||
function sameBinary(prior, record) {
|
||||
const was = typeof prior.digest === "string" ? prior.digest : null;
|
||||
if (was !== null || record.digest !== null) return was === record.digest;
|
||||
return (typeof prior.version === "string" ? prior.version : null) === record.version;
|
||||
const before = typeof prior.version === "string" ? prior.version : null;
|
||||
return before === null || record.version === null || before === record.version;
|
||||
}
|
||||
|
||||
const brief = (r) => ({ state: STATES.includes(r.state) ? r.state : "unknown", version: typeof r.version === "string" ? r.version : null, digest: typeof r.digest === "string" ? r.digest : null });
|
||||
|
||||
@@ -171,6 +171,14 @@ test("W1 a new binary first seen through an unknown, red or missing record still
|
||||
assert.deepEqual(b.transitions.map((x) => [x.from.version, x.to.version, x.line]), [["2.0.0", "2.1.0", "lacks --no-mcp"]]);
|
||||
const c = await pass({ h: red("2.1.0", "lacks --no-mcp") }, { last: b.records });
|
||||
assert.deepEqual(c.transitions, []);
|
||||
// A pass that knows no version (a timeout or a throw) is not a new binary: unknown with 2.0,
|
||||
// then a timeout, then unknown with 2.0 again, then a throw gives no transition after the first.
|
||||
const d = await pass({ h: none }, { last: [] });
|
||||
const e = await pass({ h: "hang" }, { last: d.records, timeoutMs: 200 });
|
||||
const f = await pass({ h: { ...none, version: "2.0.0" } }, { last: e.records });
|
||||
const g = await pass({ h: "throw" }, { last: f.records });
|
||||
assert.deepEqual([d, e, f, g].map((x) => x.transitions.length), [1, 0, 0, 0]);
|
||||
assert.deepEqual([e, g].map((x) => byName(x).h.version), [null, null]);
|
||||
});
|
||||
|
||||
test("W1 an answer that throws when read, a Proxy or inherited fields is unknown, and the other harnesses still get records", async (t) => {
|
||||
|
||||
Reference in new issue
Block a user