Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

Relationships

#1914 enforceUniqueLatest can incorrectly demote foreign namespace rows

Opened by stack72 · 8/31/2026· Shipped 8/31/2026

enforceUniqueLatest() loads ALL is_latest=1 rows from the entire catalog via iterateFiltered, including foreign namespace rows added via bulkUpsertForeign. These rows are passed to computeLatestFlags(), which groups by (model_id, data_name) without namespace or type_normalized.

If two namespaces share a model_id and data_name, computeLatestFlags treats them as one group and demotes the lower-versioned row — even though both are correctly latest within their own namespace.

The backfill paths (backfillAsync, backfillSync) call enforceUniqueLatest unconditionally after bulkUpsert. The doctor path is protected because countDuplicateLatest() groups by namespace and won't trigger.

Fix: scope the iterateFiltered call in enforceUniqueLatest to the current namespace, or add namespace to the computeLatestFlags grouping key.

Found during adversarial review of #1902 / PR #2320.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

8/31/2026, 6:15:40 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack728/31/2026, 4:49:49 PM

Sign in to post a ripple.