Public: anyone can read this; the crew can change it.
"the card lists the parent's commits > 12 commits show 10 and 'and 2 more'" passes every time on a loaded check machine #5674
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/5672-the-card-lists-the-parent-s-commits-12-c → main 1 commit fork
1 file
changed +18
−6
test/spawn-upstream-card.test.ts +18 −6
| @@ -121,11 +121,21 @@ describe("the card lists the parent's commits", () => { | ||
| 121 | 121 | let parent = ""; |
| 122 | 122 | let work = ""; |
| 123 | 123 | let ownerId = ""; |
| 124 | const commit = async (n: number, subject: string) => { | |
| 124 | // Each commit has its own fixed time, so no clock or load can tie or reorder them. | |
| 125 | const commitOnly = async (n: number, subject: string) => { | |
| 126 | const when = `${1_700_000_000 + n * 86_400} +0000`; | |
| 125 | 127 | await Bun.write(join(work, `g${n}.txt`), String(n)); |
| 126 | await git(work, "add", "."); | |
| 127 | await git(work, "commit", "-q", "-m", subject); | |
| 128 | await git(work, "push", "-q", parent, "HEAD:refs/heads/main"); | |
| 128 | const env = { GIT_AUTHOR_DATE: when, GIT_COMMITTER_DATE: when }; | |
| 129 | const ident = ["-c", "user.name=t", "-c", "[email protected]"]; | |
| 130 | for (const args of [["add", "."], ["commit", "-q", "-m", subject]]) { | |
| 131 | const r = await runGit([...ident, ...args], { cwd: work, env }); | |
| 132 | if (!r.ok) throw new Error(r.error.stderr); | |
| 133 | } | |
| 134 | }; | |
| 135 | const publish = () => git(work, "push", "-q", parent, "HEAD:refs/heads/main"); | |
| 136 | const commit = async (n: number, subject: string) => { | |
| 137 | await commitOnly(n, subject); | |
| 138 | await publish(); | |
| 129 | 139 | }; |
| 130 | 140 | const setup = async (name: string) => { |
| 131 | 141 | dir = await mkdtemp(join(tmpdir(), "forge-uplist-")); |
| @@ -156,7 +166,8 @@ describe("the card lists the parent's commits", () => { | ||
| 156 | 166 | |
| 157 | 167 | test("3 commits, newest first", async () => { |
| 158 | 168 | await setup("three"); |
| 159 | for (const n of [1, 2, 3]) await commit(n, `subject ${n}`); | |
| 169 | for (const n of [1, 2, 3]) await commitOnly(n, `subject ${n}`); | |
| 170 | await publish(); | |
| 160 | 171 | await checkUpstream(app, { remote: parent }); |
| 161 | 172 | const b = body(); |
| 162 | 173 | expect(b.indexOf("subject 3")).toBeGreaterThan(0); |
| @@ -168,7 +179,8 @@ describe("the card lists the parent's commits", () => { | ||
| 168 | 179 | |
| 169 | 180 | test("12 commits show 10 and 'and 2 more'", async () => { |
| 170 | 181 | await setup("twelve"); |
| 171 | for (let n = 1; n <= 12; n++) await commit(n, `subject ${n}`); | |
| 182 | for (let n = 1; n <= 12; n++) await commitOnly(n, `subject ${n}`); | |
| 183 | await publish(); | |
| 172 | 184 | await checkUpstream(app, { remote: parent }); |
| 173 | 185 | const b = body(); |
| 174 | 186 | expect(b.match(/ subject \d+\n/g)).toHaveLength(10); |
new above
offline