test(driver-turso): 双传输各跑一遍 FILTER_LOGIC / PAGINATION 共享 case-set,清掉三条 DEBT (#5590) - #5656
Merged
Merged
Conversation
…on BOTH transports, clearing the three DEBT cells (#5590) `TursoDriver` is dual-transport. Local/replica inherits SqlDriver's filter compiler and its paged-read tie-breaker; remote does not go through knex at all -- `src/remote-transport.ts` carries its own `buildWhereSQL` and its own ORDER BY / LIMIT / OFFSET assembly. That is the independent Nth backend objectstack#3774 and objectstack#4363 wrote the shared case-sets for, so each cell takes two suites, one per transport, in the shape the temporal pair in this package already established: turso-filter-logic-conformance.test.ts local, :memory: turso-remote-filter-logic-conformance.test.ts remote, sqlite stub turso-pagination-conformance.test.ts local, :memory: turso-remote-pagination-conformance.test.ts remote, sqlite stub All four are hermetic -- the remote half runs over `libsql-sqlite-stub.testkit.ts`, so no network and no credentials -- and all four are green, which is what lets the three DEBT entries leave the ledger in this same commit (25 covered cells, 0 DEBT). The remote PAGINATION half passes WITHOUT the mechanism the contract names: `buildSelectSQL` maps the caller's `orderBy` verbatim and appends no unique column, so the cases hold on a twelve-row better-sqlite3 table rather than by a promise the transport makes. Filed as objectstack#5653 and stated plainly in both the suite's module doc and the gate's ledger note; two `records the measured mechanism` tests pin the current no-tie-breaker behaviour so it cannot go quiet under a green cell. Per this issue's boundary the transport itself is untouched here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WyvqvKMG6asi9aXjKE6xtx
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckNo hand-written docs reference the 0 changed package(s). ✅ |
os-zhuang
marked this pull request as ready for review
August 5, 2026 22:28
This was referenced Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5590
做了什么
给
packages/drivers/driver-turso补四个套件,从@objectstack/spec/data导入并驱动FILTER_LOGIC_CASES/PAGINATION_CASES/PAGINATION_UNORDERED_CASES,每格两面——照同包 temporal 那对套件的形状:turso-filter-logic-conformance.test.ts:memory:(better-sqlite3 + knex)turso-remote-filter-logic-conformance.test.tslibsql-sqlite-stub.testkit.tsturso-pagination-conformance.test.ts:memory:turso-remote-pagination-conformance.test.tslibsql-sqlite-stub.testkit.ts四个都 hermetic:不要网络、不要凭据、CI 默认跑。四个全绿,所以同一个 commit 里把
scripts/check-driver-conformance.mjs的三条 DEBT 条目删干净(⛔ 判定函数一行未动,只动LEDGER数组与它的说明注释)。为什么"继承所以没问题"不成立——这也是套件的内容主张
TursoDriver是双传输的。local/replica 继承SqlDriver;remote 完全不走 knex,src/remote-transport.ts自带buildWhereSQL(组合子嵌套、算子词表、比较值拒收、空组合子的布尔单位元)和自己的 ORDER BY / LIMIT / OFFSET 拼装。这就是 #3774 / #4363 设共享 case-set 要压的"独立实现的第 N 个后端"。反向验证(先定方向再跑,三个都按预测走):
buildWhereSQL的顶层clauses.join(' AND ')改成' OR '(driver-sql:$orbranch contents are OR-ed instead of AND-ed, widening every$orfilter #3774 那个缺陷的形状)→ 预测 remote 套件红、local 套件绿。实测 remote 16 红、local 全绿,例如multi-key $or branch ANDs its own keys: expected [ '1', '2', '3' ] to deeply equal [ '1' ]。buildSelectSQL只在非分页读上拼 ORDER BY → 预测 remote 分页套件红、local 绿。实测 remote 6 红(5 条page boundaries are invisible+ 机制 pin),local 全绿。TursoDriver.find的 local 分支里把调用方orderBy丢掉(打的是本包自己的传输路由层,正是 local 套件模块注释声称在钉的东西)→ 预测 local 分页套件红、remote 绿。实测 local 5 红,remote 全绿。三次都是"一面红另一面绿",正好把 issue 的前提——两条传输是两套实现,一面的套件看不见另一面的回归——直接测了出来。
(顺带记一个诚实的强度边界:第 2 个 mutation 下
visits every row exactly once仍然绿,因为丢掉 ORDER BY 后 rowid 序仍是一个 partition。这正是 case-set 自己说的"性质"和"那条子句"是两回事,所以page boundaries are invisible与机制 pin 才是这两个套件里带牙的断言。)remote 分页这两格是绿的,但请连着这段一起读
buildSelectSQL把调用方的orderBy原样透传、不追加唯一列;local 面走的是SqlDriver.orderKeysFor(),按 #4363 的三态表补idtie-breaker。实测 remote 面ORDER BY status ASC的并列组内是插入序而非 id 序,无序分页读则是 rowid 序:也就是说:remote 面满足了这些 case,但不是靠契约点名的那个机制——是靠 stub 那张 12 行内存表计划固定。真实 endpoint 上并列行的排布不被 SQLite 承诺在两条语句之间一致,而
pagination-conformance.ts自己的模块注释就写明无序读是同一缺陷的满强度形态、driver-memory那条"存储顺序稳定"的豁免针对的是 JS 数组不是 SQL 计划。按本单边界(套件里不修实现、不给自己发准考证),这条缺陷另开单:#5653。remote 套件里留了两条
records the measured mechanism测试把当前"没有 tie-breaker"的事实钉住——#5653 落地那天它们会红并随之改写,而不是让这条分叉在一个绿格子底下悄悄躺着。gate 注释里也记了同一件事(放注释而不是 LEDGER 条目:格子确实已覆盖,给已覆盖的格子留条目会判 RECONCILED 红)。验证
query-options 类型:四个新套件的 query 从第一行就是正确类型,没有一处
as any(find/count的签名本就any,直接传字面量即可),所以 267 天花板纹丝不动。边界
LEDGER的三条 + 改它的说明注释。orderKeysFor)分叉,IDataDriver.find 的确定性分页 MUST 在 remote 面不成立 #5653)。packages/drivers/driver-turso/src/(4 个新文件)+scripts/check-driver-conformance.mjs。Changeset
测试 + gate ledger,不发布任何包 → 按
pr-automation.yml的路线 2,请挂skip-changeset标签。🤖 Generated with Claude Code
https://claude.ai/code/session_01WyvqvKMG6asi9aXjKE6xtx
Generated by Claude Code