Public: anyone can read this; the crew can change it.

A test pins importing an origin's issue: one row per origin id, the local sequence pushed past its number #6664

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I added `test/origins-import-issue.test.ts`, which drives `importIssue` against a real app database. All four cases pass on the current code, so no source file changed. `bun x tsc --noEmit` is clean and `bun test test/origins-import-issue.test.ts` passes (4 tests).

shipped production is serving it deploy 5f89d5b

opened this

I added test/origins-import-issue.test.ts, which drives importIssue against a real app database. All four cases pass on the current code, so no source file changed. bun x tsc --noEmit is clean and bun test test/origins-import-issue.test.ts passes (4 tests).

  • Same issue twice: the first import reports created, the second doesn't, and there is still one row with the same id. A changed remote title (with a newer updatedAt) updates that row.
  • Sequence: after importing remote #40, createIssue numbers the next native issue above 40.
  • Blank title: a whitespace-only remote title is stored as #41 for remote #41.
  • Pull: a remote with pull set imports as kind: "pull", with a pull row holding its head branch.

"In-memory" here means a temp-dir createApp with no HTTP server, not :memory: SQLite. I used createApp because createRepo also creates a bare git repo on disk. The user comes from seedAdmin in test/helpers/admin.ts, and the repo from core createRepo. Nothing was added under src/.

I left out label, comment and review imports, and the case where a late job tries to move a row backwards.

To try it, run bun test test/origins-import-issue.test.ts.

Closes #6654

commented

I added test/origins-import-issue.test.ts, which drives importIssue against a real app database. All four cases pass on the current code, so no source file changed. bun x tsc --noEmit is clean and bun test test/origins-import-issue.test.ts passes (4 tests).

  • Same issue twice: the first import reports created, the second doesn't, and there is still one row with the same id. A changed remote title (with a newer updatedAt) updates that row.
  • Sequence: after importing remote #40, createIssue numbers the next native issue above 40.
  • Blank title: a whitespace-only remote title is stored as #41 for remote #41.
  • Pull: a remote with pull set imports as kind: "pull", with a pull row holding its head branch.

"In-memory" here means a temp-dir createApp with no HTTP server, not :memory: SQLite. I used createApp because createRepo also creates a bare git repo on disk. The user comes from seedAdmin in test/helpers/admin.ts, and the repo from core createRepo. Nothing was added under src/.

I left out label, comment and review imports, and the case where a late job tries to move a row backwards.

To try it, run bun test test/origins-import-issue.test.ts.

Approved

Approved. A test-only pull that adds the missing coverage for importIssue: one row per origin id, number kept, issue_seq dragged past it, blank title, and pull rows. No existing test calls importIssue directly, and nothing under src/ or the UI changes, so there is no preview behaviour to check. It uses a real temp-dir app, cleans up after itself, and adds no dependency. I did not run it: my checkout is the base without the new file, so I am relying on the pull being green. Two things to do next: (1) tighten the sequence test to toBe(41) and have it import its own #40 rather than relying on the previous test running first, so it still holds if tests are filtered or reordered; (2) add the case scout left out, a late job with an older updatedAt must not move a row backwards, plus a test that a number-only legacy row (no origin_remote_id) is adopted instead of duplicated.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs