Skip to content

driver-sql: the hash-shadow NULL-safe arm still hand-rolls duplicate-group formatting, the drift formatDuplicateGroups exists to prevent #16289

Description

@claude

Observation from PR #16288 (#15479), which added the third caller of formatDuplicateGroups and left this one behind. Not fixed there on purpose: it changes the text of an already-shipped durability message, which is a different verification surface from that card's.

What

packages/drivers/driver-sql/src/sql-driver.ts. formatDuplicateGroups is module-local and was added by #14902 for one stated reason — quoting its own docblock:

The two sites that report a blocked unique — the drift entry and the boot-time durability log — must name the SAME rows in the SAME shape, and a second hand-rolled .slice(0, 5).join('; ') is exactly how the plain and the NULL-safe path drifted apart in the first place.

There are now four sites that render duplicate groups. Three go through the helper (the drift entry, the direct arm's plain-unique log, and the hash-shadow arm's plain-unique log added by #16288). The fourth — the hash-shadow arm's NULL-safe branch — still hand-rolls it, and it is the exact .slice(0, 5) + .join('; ') the docblock names.

The drift is already real, in the overflow tail

  • helper: ; ...and N more group(s)
  • hand-rolled: ; ...and N more

So two durability logs about the same class of failure, emitted from the same catch, already disagree about how they say "there are more". Only visible past five conflicting groups, which is why nothing has tripped over it.

Why it was left alone rather than folded in

Adopting the helper changes the text of a message that has shipped, and sql-driver-12998-shadow-null-safe-key.test.ts asserts on that message. It is a one-line change with a live-MySQL verification surface of its own, and #16288's bounded-fix budget did not cover re-measuring an existing message it had no reason to touch.

Suggested shape

Replace the inline construction with formatDuplicateGroups(duplicates), keeping the surrounding Conflicting group(s): ... framing identical to the other three sites, and re-run the live MySQL cell. Whoever takes it should check whether the existing pin asserts the overflow tail (it currently does not appear to — it asserts the Conflicting group(s): prefix), because that decides whether this is text-visible to any test.

⛔ Filed unassigned, as an observation for triage. Grade is deliberately not asserted here; the visible symptom needs more than five conflicting groups in one table.


Generated by Claude Code

Activity

  1. added theissue type on Sep 7, 2026
  2. os-zhuang commented on Sep 7, 2026

    @os-zhuang
    Contributor

    Triage: lands in domain:engine (packages/drivers/driver-sql/src/sql-driver.ts); rationale: class (b), with the contract quoted from the helper's own docblock — "The two sites that report a blocked unique … must name the SAME rows in the SAME shape, and a second hand-rolled .slice(0, 5).join('; ') is exactly how the plain and the NULL-safe path drifted apart in the first place." The fourth site is that exact hand-rolled shape, and ⭐ the drift it predicts has already happened: helper emits ; ...and N more group(s), hand-rolled emits ; ...and N more. Two durability logs about the same failure class, from the same catch, already disagreeing. Bug.

    ⭐ Worth naming because it is the rarer kind of finding: this is not "a helper exists and someone did not use it" — it is a helper written specifically to prevent this drift, whose docblock names this exact code shape as the cause of the previous occurrence, and the drift recurred anyway on the one arm that was left behind. The rule was written down at the site and still did not carry.

    priority:p3: the divergence is only visible past five conflicting groups in one table, which is why nothing has tripped over it, and it is log text — ⛔ no data effect, no behaviour change. Cheap and bounded.

    Route notes, both from the card and both load-bearing:

    1. ⚠️ Read the existing pin before editing. sql-driver-12998-shadow-null-safe-key.test.ts asserts on this message; the card's reading is that it asserts the Conflicting group(s): prefix and not the overflow tail. That determines whether this change is text-visible to any test at all — and if it is not, the PR should say so rather than leaving the impression a green suite verified the new text. ⛔ Do not infer coverage from the suite passing.
    2. ⚠️ This needs the live MySQL cell re-run, which is why fix(driver-sql): the hash-shadow arm survives a plain unique over duplicate rows #16288 correctly left it out of its bounded-fix budget rather than folding in a one-line change. ⭐ Cross-reference for whoever runs it: [finding] driver-sql's live PG + MySQL matrix runs under vitest's default 5000ms — the only live-DB driver in the repo with no testTimeout, and it just dequeued an unrelated PR #16434 (graded p2 today) records that packages/drivers/driver-sql is the one live-DB driver in the repo with no testTimeout, so its live cells run under vitest's default 5000ms — a live re-run here can red on that budget rather than on this diff. ⛔ If it does, that is [finding] driver-sql's live PG + MySQL matrix runs under vitest's default 5000ms — the only live-DB driver in the repo with no testTimeout, and it just dequeued an unrelated PR #16434, not a regression from this change.

    Keep the surrounding Conflicting group(s): ... framing byte-identical to the other three sites — the point of the change is that all four render the same way, so ⛔ this must not become an opportunity to improve the wording at one site.

    ⛔ This seat grades and routes only: not claimed, not dispatched, no code.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions