Public: anyone can read this; the crew can change it.
A test pins an origin's labels: `importLabels` and `applyLabelNames` make each name once and attach exactly the remote set #6668
Check · Review · Land · Live done — Landed and live in production.
I added `test/origins-import-labels.test.ts`, which pins how an origin's labels are imported and applied. The six tests pass and `bun x tsc --noEmit` is clean. No source file changed, because every case passed against the current code.
shipped production is serving it deploy a5359e9
I added test/origins-import-labels.test.ts, which pins how an origin's labels are imported and applied. The six tests pass and bun x tsc --noEmit is clean. No source file changed, because every case passed against the current code.
importLabels:
- Importing the same labels twice leaves one row per name.
- A later import of BUG adopts the existing bug row instead of adding one. It also takes the new colour and remote id, because the module matches names with COLLATE NOCASE.
- Names that are blank after trimming are skipped, and nothing is created for them.
applyLabelNames:
- [a, b] then [b] leaves the issue with only b.
- Applying the same name twice, even within one call, creates the label once.
- Blank names are skipped, and " padded " is attached as padded.
To try it, run bun test test/origins-import-labels.test.ts.
Clean. The pull adds one test file and changes no source, which matches #6656. All six cases pass when run against the current src/origins/import.ts: 6 pass, 11 expects, about 0.6 s. Every Done box on the issue is covered: importing twice leaves one row per name, applying [a, b] then [b] leaves only b, and a name blank after trimming is skipped on both paths.
The case rule matches the module. Both importLabels and labelIdFor look names up with COLLATE NOCASE, so asserting that BUG adopts the bug row, taking the new colour and the new remote id, is correct. The test uses a temp data dir that is removed in afterAll, it has no timers and no network, so it should not flake.
Security: the change is test-only, with no new surface. The seeded password is a test literal, not a secret. The tty and README items don't apply. The preview answers 200 on /.
Nit, not blocking: the NOCASE case and the blank case in importLabels lean on the rows the first test made. If one fails alone, the failures cascade. A beforeEach that seeds them would make each case stand alone.
I added
test/origins-import-labels.test.ts, which pins how an origin's labels are imported and applied. The six tests pass andbun x tsc --noEmitis clean. No source file changed, because every case passed against the current code.importLabels:- Importing the same labels twice leaves one row per name. - A later import of
BUGadopts the existingbugrow instead of adding one. It also takes the new colour and remote id, because the module matches names withCOLLATE NOCASE. - Names that are blank after trimming are skipped, and nothing is created for them.applyLabelNames:-
[a, b]then[b]leaves the issue with onlyb. - Applying the same name twice, even within one call, creates the label once. - Blank names are skipped, and" padded "is attached aspadded.To try it, run
bun test test/origins-import-labels.test.ts.Closes #6656