seat: fetch a role clone that is on another branch or dirty (#1611)
Row 117. At a launch, update() kept a clone that was on another branch
or dirty and ran no git in it, so its refs/remotes/origin/* stayed as
old as the last clean launch. Now those two reasons get the clean
path's fetch, with the same arguments and environment, and no merge.
The result is a new outcome, fetched, with the reason, the clone's
branch and HEAD, and origin { branch, commit } after the fetch. Every
earlier check still keeps the clone with no fetch. The launcher writes
a checkout-fetched launch-log line, and the bundle prompt names a
fetched clone's branch, commit and origin. Nothing in unsafe(),
allowed(), gitEnv() or SAFE changed.
Candidate manifest 9fa839edfb2bd04771bbac1913b142cb16aef227a1265120e0d318fb64d6a502
from Darkwing's round 1 packet (17d801f48), on BASE 559ef2287. Dewey
approved in 28443. Sage reran the full gate at the landing target with
the candidate applied.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -281,12 +281,14 @@ test("the PM launches a coder through its launch tool; the coder answers; refusa
|
||||
});
|
||||
|
||||
// Row 91 (#1585): the project clone in each workspace.
|
||||
test("each launch makes sure the workspace has a clone of the project: cloned, fast-forwarded, or kept and logged", { skip, timeout: 60000 }, async (t) => {
|
||||
// Row 117 (#1611): and a dirty one is fetched, not merged, and logged.
|
||||
test("each launch makes sure the workspace has a clone of the project: cloned, fast-forwarded, or fetched and logged", { skip, timeout: 60000 }, async (t) => {
|
||||
const given = prepare(t);
|
||||
const project = given.f.doc.projects.stack.root;
|
||||
const clone = join(workspaceDir(given.f.dataRoot, "acme", "pm"), "stack");
|
||||
const prompt = (run) => readFileSync(join(given.f.dataRoot, "launches", "acme", run, "bundle", "prompt.md"), "utf8");
|
||||
const kept = () => log(given.f).filter((e) => e.event === "checkout-kept");
|
||||
const fetched = () => log(given.f).filter((e) => e.event === "checkout-fetched");
|
||||
|
||||
// The first launch clones the root's branch, with the root as origin.
|
||||
const first = await setup(t, undefined, given);
|
||||
@@ -311,18 +313,22 @@ test("each launch makes sure the workspace has a clone of the project: cloned, f
|
||||
assert.equal(gitIn(clone, "rev-parse", "HEAD"), two);
|
||||
assert.ok(prompt(pm2.run).includes(`- Project clones: stack at ${clone}, on branch main at commit ${two} when this session started. `));
|
||||
assert.deepEqual(kept(), []);
|
||||
assert.deepEqual(fetched(), []);
|
||||
await second.client.call("role.release");
|
||||
assert.equal(await second.close(), 0);
|
||||
|
||||
// A clone with the session's own work in it is kept, and the log says why.
|
||||
// A clone with the session's own work in it is fetched and not merged,
|
||||
// and the log says why.
|
||||
writeFileSync(join(clone, "notes.txt"), "mine\n");
|
||||
const three = commit(project, "three");
|
||||
const third = await setup(t, undefined, given);
|
||||
const pm3 = await third.launcher.launchPm();
|
||||
assert.equal(gitIn(clone, "rev-parse", "HEAD"), two);
|
||||
assert.equal(gitIn(clone, "rev-parse", "refs/remotes/origin/main"), three);
|
||||
assert.equal(readFileSync(join(clone, "notes.txt"), "utf8"), "mine\n");
|
||||
assert.deepEqual(kept().map(({ instance, project: p, reason }) => ({ instance, project: p, reason })), [{ instance: "pm", project: "stack", reason: "dirty" }]);
|
||||
assert.ok(prompt(pm3.run).includes(`- Project clones: stack at ${clone}, not updated at this launch (dirty). `));
|
||||
assert.deepEqual(fetched().map(({ instance, project: p, reason }) => ({ instance, project: p, reason })), [{ instance: "pm", project: "stack", reason: "dirty" }]);
|
||||
assert.deepEqual(kept(), []);
|
||||
assert.ok(prompt(pm3.run).includes(`- Project clones: stack at ${clone}, on branch main at commit ${two} when this session started, fetched but not fast-forwarded at this launch (dirty), with origin/main at commit ${three}. `));
|
||||
assert.equal(await third.close(), 0);
|
||||
|
||||
// The root was never written: its branch, head and tree are the test's.
|
||||
|
||||
Reference in New Issue
Block a user