Release keys numbered after the highest number, not the count
Merges delete releases, so the count of a key's releases fell behind its numbers (83 releases up to key:129): the 20 numbers tried were all taken and the range's batch failed for good. Spot releases (spot:key) are not numbered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
293d9d4b52
commit
705f9c3897
2 files changed
+22
-2
No files matched your search
@@ -246,8 +246,16 @@ class BatchStore {
|
||||
}
|
||||
const fresh = part.filter((_, idx) => !joined.has(idx))
|
||||
if (fresh.length > 0) {
|
||||
// The first upload of a key keeps the key; later ones are key:2, key:3, …
|
||||
const { rows: counts } = await trx.rawQuery(`SELECT identity_key, count(*) AS n FROM releases WHERE identity_key = ANY(?) GROUP BY 1`, [[...new Set(fresh.map((r) => r.key))]])
|
||||
// The first upload of a key keeps the key; later ones are key:2, key:3, … after the highest number: merges
|
||||
// delete releases, and a count fell behind it (83 releases of a key up to key:129: 20 numbers tried, all
|
||||
// taken, the range's batch failed for good; LOG.md 2026-10-20 (89)). Spot releases (spot:key) aren't numbered.
|
||||
const { rows: counts } = await trx.rawQuery(
|
||||
`SELECT identity_key, max(CASE WHEN release_key = identity_key THEN 1
|
||||
WHEN left(release_key, length(identity_key) + 1) = identity_key || ':' AND substr(release_key, length(identity_key) + 2) ~ '^[0-9]{1,9}$'
|
||||
THEN substr(release_key, length(identity_key) + 2)::int END) AS n
|
||||
FROM releases WHERE identity_key = ANY(?) GROUP BY 1`,
|
||||
[[...new Set(fresh.map((r) => r.key))]]
|
||||
)
|
||||
const taken = new Map<string, number>(counts.map((c: { identity_key: string; n: string }) => [c.identity_key, Number(c.n)]))
|
||||
const numbered = (r: ReleaseChunk) => {
|
||||
const n = (taken.get(r.key) ?? 0) + 1
|
||||
|
||||
Reference in new issue
Block a user