Repository navigation
Structured worker result in the lead's wake notice, rendered as a card (#1427) #1606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
currentbits
merged 1 commit into
main
from
coder/p2-structured-worker-result-in-the-lead--7e14e2
Oct 12, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| const { describe, it, beforeEach, afterEach } = require("node:test"); | ||
| const assert = require("node:assert/strict"); | ||
| const fs = require("node:fs"); | ||
| const os = require("node:os"); | ||
| const path = require("node:path"); | ||
| const { execFileSync } = require("node:child_process"); | ||
| const { | ||
| workerResultBlock, | ||
| WORKER_RESULT_MAX, | ||
| } = require("../runner-orch-notices.js"); | ||
| const { rmTree } = require("./support/rmTree.js"); | ||
|
|
||
| function git(cwd, args) { | ||
| return execFileSync("git", args, { cwd, encoding: "utf8" }).trim(); | ||
| } | ||
|
|
||
| describe("workerResultBlock (#1427)", () => { | ||
| let repo; | ||
| let base; | ||
|
|
||
| beforeEach(() => { | ||
| repo = fs.mkdtempSync(path.join(os.tmpdir(), "worker-result-")); | ||
| git(repo, ["init", "-q", "-b", "main"]); | ||
| git(repo, ["config", "user.email", "t@t"]); | ||
| git(repo, ["config", "user.name", "t"]); | ||
| fs.mkdirSync(path.join(repo, "core/dist"), { recursive: true }); | ||
| fs.writeFileSync(path.join(repo, "core/dist/index.js"), "x\n"); | ||
| git(repo, ["add", "-A"]); | ||
| git(repo, ["commit", "-qm", "base"]); | ||
| base = git(repo, ["rev-parse", "HEAD"]); | ||
| git(repo, ["checkout", "-qb", "worker"]); | ||
| }); | ||
|
|
||
| afterEach(() => rmTree(repo)); | ||
|
|
||
| function worker(extra) { | ||
| return { | ||
| id: "w1", | ||
| worktreePath: repo, | ||
| branch: "worker", | ||
| leadSnapshotSha: base, | ||
| ...extra, | ||
| }; | ||
| } | ||
|
|
||
| it("includes the create mode 120000 line for a branch that adds a symlink", () => { | ||
| git(repo, ["rm", "-rq", "core/dist"]); | ||
| fs.mkdirSync(path.join(repo, "core"), { recursive: true }); | ||
| fs.symlinkSync("../../elsewhere/dist", path.join(repo, "core/dist")); | ||
| git(repo, ["add", "-A"]); | ||
| git(repo, ["commit", "-qm", "symlink"]); | ||
| const block = workerResultBlock( | ||
| worker({ | ||
| verifyCommand: "npm test", | ||
| verify: { ok: false, exitCode: 1, command: "npm test" }, | ||
| hypotheses: [ | ||
| { claim: "cache it", status: "invalidated", reason: "stale" }, | ||
| { claim: "kept", status: "validated" }, | ||
| ], | ||
| }), | ||
| ); | ||
| assert.match(block, /^\n\[worker result w1\]\n/); | ||
| assert.match(block, /create mode 120000 core\/dist/); | ||
| assert.match(block, /Verify: failed \(exit 1\): npm test/); | ||
| assert.match(block, /Ruled out:\n- cache it — stale/); | ||
| assert.doesNotMatch(block, /kept/); | ||
| assert.ok(block.endsWith("\n[/worker result]")); | ||
| }); | ||
|
|
||
| it("lists review-itinerary risks as open items", () => { | ||
| fs.mkdirSync(path.join(repo, ".solenta/review-itinerary"), { recursive: true }); | ||
| fs.writeFileSync( | ||
| path.join(repo, ".solenta/review-itinerary/w1.json"), | ||
| JSON.stringify({ chunks: [{ area: "ipc", risks: ["race"] }], risks: ["untested"] }), | ||
| ); | ||
| const block = workerResultBlock(worker()); | ||
| assert.match(block, /Open review items:\n- ipc: race\n- untested/); | ||
| }); | ||
|
|
||
| it("truncates the body at the cap", () => { | ||
| for (let i = 0; i < 40; i++) { | ||
| fs.writeFileSync(path.join(repo, `file-with-a-long-name-${i}.txt`), "y\n"); | ||
| } | ||
| git(repo, ["add", "-A"]); | ||
| git(repo, ["commit", "-qm", "many"]); | ||
| const block = workerResultBlock( | ||
| worker({ | ||
| hypotheses: Array.from({ length: 30 }, (_, i) => ({ | ||
| claim: `idea ${i} ${"z".repeat(60)}`, | ||
| status: "invalidated", | ||
| })), | ||
| }), | ||
| ); | ||
| const body = block.split("\n").slice(2, -1).join("\n"); | ||
| assert.ok(body.length <= WORKER_RESULT_MAX, `body ${body.length} chars`); | ||
| assert.match(body, /… \(truncated\)$/); | ||
| assert.ok(block.endsWith("\n[/worker result]")); | ||
| }); | ||
|
|
||
| it("is empty when there is nothing to report", () => { | ||
| assert.equal(workerResultBlock({ id: "w2" }), ""); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the common worker without a verify command,
afterSuccessfulTurnstartsmaybeCreateCheckpointwithout awaiting it and immediately callsfinishSuccessfulTurn(electron/runner-verify-gate.js:127-133). This commit-to-commit diff therefore runs while the worker's just-finished changes are still uncommitted—indeed, the synchronousgitTryprevents the asynchronous checkpoint from completing first—so the permanent result card can reportChanges ...: noneor omit files such as a symlink replacement. Await the checkpoint before queuing the notice, or include the working tree in the summary.Useful? React with 👍 / 👎.