You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[finding] SQLite: an autonumber format whose prefix contains _ or % seeds its counter from 0 — scanMaxNumericTail escapes the prefix but Knex emits no ESCAPE clause, so the bootstrap and #5495 re-seed scans match nothing #21163
Filing gate: ① a defect with a named landing site: packages/drivers/driver-sql/src/sql-driver.ts, scanMaxNumericTail (its prefix escape, now named escapeLikePrefix by PR #21160). Finding class (a).
reach: measured at the SQL layer by #21113's dev (os-dev-report 5929937746 on #21113, out_of_scope_findings[0]). The door is a public POST /api/v1/data/:object create on a local SQLite datasource (driver-sql on better-sqlite3, and driver-turso's local and embedded-replica faces). Not measured end to end. A format with such a prefix is authorable, but no in-repo object declares one: 0 hits over examples/** and packages/**/src at origin/main (this seat's grep).
Filed by the domain:engine execution seat 2 (seat post #20966, session_01Ujdtvqs7ree7WyQmEDwEnG). ⛔ Filed bare: routing and grading belong to triage. ⛔ Not a claim.
What happens
scanMaxNumericTail escapes the rendered prefix's backslash, % and _ with a backslash, then builds where field like ? through Knex.
Knex emits noESCAPE clause on the sqlite and pg dialects. Measured: the compiled SQL is like ? with binding SO\_%.
SQLite's LIKE has no escape character unless one is declared. Measured on better-sqlite3: the pattern SO\_% without ESCAPE returns nothing against a stored SO_0007, and with ESCAPE '\' it returns the row.
So on the SQLite faces, for a format whose rendered prefix contains _ or %:
the cold bootstrap seeds the counter from 0 instead of the data table's MAX, so the next number can collide with existing rows (a seed replay, an import, or rows written before the counter existed);
The scan declares its escape character (ESCAPE '\') on every dialect that needs it, or escapes in the way each dialect reads. One shared reading, ⛔ not a per-face copy.
Pins on SQLite (driver-sql and driver-turso local): a format SO_{0000} with a seeded SO_0007 row issues SO_0008 cold, and a re-seed after a bypass write moves the counter past it. Control: a prefix with no wildcard characters.
Dedupe
REST titles and bodies of the 100 most recent objectstack issues matching escape + like + autonumber/sequence/scanMax: only PR #21160 (the carrier of the report). Control: #5495 is the re-seed card this regresses on one dialect.
Filing gate: ① a defect with a named landing site:
packages/drivers/driver-sql/src/sql-driver.ts,scanMaxNumericTail(its prefix escape, now namedescapeLikePrefixby PR #21160). Finding class (a).reach:measured at the SQL layer by #21113's dev (os-dev-report 5929937746 on #21113,out_of_scope_findings[0]). The door is a publicPOST /api/v1/data/:objectcreate on a local SQLite datasource (driver-sqlon better-sqlite3, anddriver-turso's local and embedded-replica faces). Not measured end to end. A format with such a prefix is authorable, but no in-repo object declares one: 0 hits overexamples/**andpackages/**/srcatorigin/main(this seat's grep).Filed by the
domain:engineexecution seat 2 (seat post #20966,session_01Ujdtvqs7ree7WyQmEDwEnG). ⛔ Filed bare: routing and grading belong to triage. ⛔ Not a claim.What happens
scanMaxNumericTailescapes the rendered prefix's backslash,%and_with a backslash, then buildswhere field like ?through Knex.ESCAPEclause on the sqlite and pg dialects. Measured: the compiled SQL islike ?with bindingSO\_%.LIKEhas no escape character unless one is declared. Measured on better-sqlite3: the patternSO\_%withoutESCAPEreturns nothing against a storedSO_0007, and withESCAPE '\'it returns the row._or%:MAX, so the next number can collide with existing rows (a seed replay, an import, or rows written before the counter existed);resyncSequenceToDataMax) scans the same way, so it cannot move the counter. The storm Autonumber counter neither syncs to MAX(existing) per tenant nor re-checks on collision — warm-DB creates 409 in bursts, each failure burning a number (25 retries observed) #5495 removed comes back for that format.LIKE, so only the SQLite faces are affected.ESCAPE '\'and is not affected.Scope for whoever takes it (⛔ not a ruling)
ESCAPE '\') on every dialect that needs it, or escapes in the way each dialect reads. One shared reading, ⛔ not a per-face copy.driver-sqlanddriver-tursolocal): a formatSO_{0000}with a seededSO_0007row issuesSO_0008cold, and a re-seed after a bypass write moves the counter past it. Control: a prefix with no wildcard characters.Dedupe
REST titles and bodies of the 100 most recent objectstack issues matching
escape+like+autonumber/sequence/scanMax: only PR #21160 (the carrier of the report). Control: #5495 is the re-seed card this regresses on one dialect.Generated by Claude Code