Skip to content

Protocol-19 form switch has no path on the Turso remote face: applyStoredFormsOf refuses (no transactions), so hosted tenants with old-shape forms stay 404 #39197

Todo

Description

@objectstack-fleet

repo:cloud#3 · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

Filing category ① (class b): a measured defect, filed under cross-repo rule 1. Source: objectstack-ai/cloud#5381, dev report 7361699745 on that card, and cloud PR #5390, which carries the tests that measure it.

维护者速读

  • 问题:框架升到协议 19 后,旧格式存下的表单要先跑一次「切换」才能打开,否则一直是 404。但切换要么全做、要么不做,必须在事务里完成。托管租户库用的 Turso 远程连接不支持事务,所以框架直接拒绝切换(NO-ROLLBACK)。结果是:托管租户里凡是有旧格式表单的,现在没有任何办法让它们恢复。
  • 改法:框架给远程连接提供一条切换路径。比如把切换做成一次 libSQL 批量写入,或者改用 Hrana 交互式事务。云端不应该绕开框架自己去改。
  • 要你做什么:无。先等云端跑完普查(cloud#5381 的 --rows 探针),看实际有多少租户受影响,再定优先级。

Measured

In cloud PR #5390, protocol-switch.e2e.test.ts runs at pin b706ec6e against libSQL behind TursoDriver's remote face:

  • the census reads NO-ROLLBACK;
  • apply is refused and writes nothing, and the form stays 404;
  • with the guard ablated, applyStoredFormsOf itself fails, answering 500.

The same flow on SQLite switches and serves the form again.

Seam

spec: ADR-0159 D7's switch (FORM_TYPE_SWITCH_MIGRATION_ID, os migrate protocol --to 19 --apply), consumed by runtime: metadata-protocol's storedFormRunRefusal and applyStoredFormsOf, and the driver-turso remote transport (transactionsUnsupported).

f42afe7 (#38957) says moved forms are served again "including hosts that assemble their own kernel", but no switch path exists for the transport every hosted tenant uses.

Also (same seam, not a defect)

The framework exports no host-side switch orchestration, so cloud re-spells the CLI's order: census, refusal, ceremony, census, recordDataMigrationRun. An exported switchStoredFormsOf(protocol, engine) would remove the copy and the drift risk.

Acceptance

  • On the Turso remote face, the protocol-19 switch either moves old-shape forms with an all-or-nothing guarantee or refuses with a documented operator remedy.
  • A test covers it on libSQL's remote transport.

Dedupe: objectstack applyStoredFormsOf turso 0.

Activity

  1. added
    bug
    priority:p2
    on Dec 2, 2026
  2. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@os-warren · os-warren · session_01JQwxbZzZ2f5mzcvJbRrRNZ

    First touch · 2026-12-03T00:04Z

    定级:area:cloud · Bug · p2 · 托管租户库(Turso 远程连接无事务)跑不了协议 19 表单切换,旧格式表单一直 404 且无路可恢复 · 实测(cloud PR #5390 的测试)

    • 作者定级保留,补 domain:data(驱动无事务)、类型 Bug,进 pm:queue。
  3. added
    pm:queue
    on Dec 3, 2026
  4. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud@zhuangjianguo · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

    Claim: PM loop round 7 · 2026-12-03T04:54Z
    Ruling-ref: the maintainer, in the cloud seat's session, put objectstack's open pm:queue + area:cloud p1/p2 cards in this seat's lane: 「这些任务也应该归你处理 is:issue state:open label:pm:queue label:priority:p2,priority:p1 label:area:cloud」, 「objectstack 仓库的 …」.
    Scope: give the protocol-19 stored-form switch a path on the Turso remote face. Either the move runs all-or-nothing there (for example as one libSQL batch, or as an interactive transaction if the transport offers one), or it refuses with a documented operator remedy. Add a test on libSQL's remote transport. Optional, same seam: export host-side switch orchestration, but only if it falls out with no new contract. Cloud's call site is not touched here.
    Session: session_01TsNV8Bsjqmw7aXCo2QuLU1
    Account: zhuangjianguo
    Branch: claude/issue-39197-turso-form-switch
    Worktree: objectstack-issue-39197
    Domain: domain:data
    Seat: repo:cloud@zhuangjianguo
    File surface: packages/metadata-protocol/src/, packages/drivers/driver-turso/src/ (reason: the switch runner and the remote transport the card measures)
    Container & model: L, mode:subagent, model: default (dispatch-gates --tier: no mandate), effort: high (reason: an all-or-nothing data migration on a transport without transactions; a partial move strands tenant forms)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the protocol-19 stored-form switch on the Turso remote transport | f42afe7 (#38957) | every hosted tenant with old-shape forms (they stay 404 with no path back)
    Thread-read: 7361699745
    Premise: holds (cloud PR #5390's protocol-switch.e2e.test.ts at pin b706ec6e: census NO-ROLLBACK, apply refused, form stays 404)
    Serial constraints cleared: none

  5. added
    pm:dispatched
    and removed
    pm:queue
    on Dec 3, 2026
  6. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud@zhuangjianguo · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1
    os-dev-report

    {
      "issue": 39197,
      "status": "needs_decision",
      "branch": "claude/issue-39197-turso-form-switch",
      "pr": null,
      "session": "session_01TsNV8Bsjqmw7aXCo2QuLU1",
      "premise_still_valid": true,
      "summary": "The defect holds at origin/main 93e035410. Every file the card names is byte-equal to pin b706ec6e (git diff --stat b706ec6e 93e035410 over protocol-stored-form-apply.ts, turso-driver.ts, remote-transport.ts, cli stored-forms.ts, core migration-journal.ts and spec driver.zod.ts is empty). The remote face declares transactionsUnsupported (turso-driver.ts:1971), so engineCanRollBack answers false. The census says NO-ROLLBACK (cli stored-forms.ts:45) and the ceremony refuses before writing (protocol-stored-form-apply.ts:268). The transport does offer atomic primitives: libSQL batch is one transaction (hrana.js executeHranaBatch: BEGIN, conditional steps, COMMIT, ROLLBACK on failure), and HttpClient.transaction() opens an interactive transaction over a Hrana stream (http.js:155). The dispatch's assumed mechanism is FALSIFIED: the switch's writes cannot be precomputed into one batch. Every repo.put/delete reads between its writes: resolveWriteHead, nextItemVersion (MAX of history), nextEventSeq, appendHistoryRow's seq re-derivation (sys-metadata-repository.ts:1349-1489, 1653-1677), and step 3 reads each copy back and requires its hash (protocol-stored-form-apply.ts:346). A captured batch would hand every put the same event_seq and fail the read-back, unless the repository's write logic were forked into SQL. The only atomic route left is real interactive transactions on the remote face. That is not scoped to the switch: it flips the face's transaction declaration for every hosted engine.transaction caller. Any switch-scoped variant needs a new driver contract (Clause-② yes). So this is a fork between architectures, and I stopped before writing code (os-dev.md, when to stop). No commit, no PR. Only the empty probe branch was pushed. The dispatch carried no decision axes, so the per-axis analysis is owed once the PM supplies them.",
      "tests": "No code change, so no suite ran. A transport reading at 93e035410, on @libsql/client 0.18.0's native file client (node probe script in the scratchpad, exit 0): (1) batch(['INSERT a','INSERT a'],'write') gave SQLITE_CONSTRAINT and 0 rows after the failed batch, so the batch is all or nothing; (2) transaction('write'): an insert was seen inside the tx (count 1), and after rollback the count was 0. The Hrana/HTTP behaviour is from reading http.js:155 and hrana.js:214-242, not a network measurement. No sqld binary is in the container (which sqld/turso: none). No ablation: no tested behaviour changed.",
      "gates": "NOT MEASURED: no diff, so dispatch-gates.mjs --commands has nothing to derive and no family is owed. No PR, so there are no check-runs to cite.",
      "mcp_calls": "0",
      "api_writes": "2 - git push of the empty probe branch claude/issue-39197-turso-form-switch (dev-worktree.sh --probe, at origin/main 93e035410); this os-dev-report comment via post-stamped.mjs (POST /repos/objectstack-ai/objectstack/issues/39197/comments)",
      "classifier_refusals": [],
      "open_questions": [
        {
          "question": "The switch's writes cannot be one libSQL batch (repo.put reads between its writes, and step 3 reads each copy back). Which route should give hosted (Turso remote) tenants a path through the protocol-19 stored-form switch?",
          "options": [
            "A: Real interactive transactions on the Turso remote face. Remote beginTransaction() returns a handle over client.transaction('write'). Each remote arm that refuses options.transaction today (21 sites in turso-driver.ts), plus the autonumber helper, routes the handle to a RemoteTransport bound to that libSQL transaction (all its SQL goes through sendStatement/sendBatch, remote-transport.ts:2415-2441). commit/rollback call the libSQL transaction, and supports.transactionsUnsupported becomes false on remote. The census and the ceremony then work unchanged, and the guarantee is real. Cost: every engine.transaction on a hosted tenant becomes a real interactive write transaction that holds the tenant DB's write lock across network round trips (grep reading at 93e035410: 31 '.transaction(' call sites in 15 non-test source files, an approximate count). Discovery's transactionalBatch flips to true for hosted tenants. Turso documents a timeout on interactive transactions, not measured here. The ceremony (roughly 15 round trips per moved form) may exceed it on large tenants: still all or nothing, but the run fails. This completes the work turso-driver.ts records as deferred ('Implementing transactions on this transport is a separate piece of work'). Work: L to XL, its own card, measured against a real sqld/Turso endpoint before landing.",
            "B: Refuse with a documented operator remedy. Keep NO-ROLLBACK, and reword the census sentence (cli stored-forms.ts:45) and the ceremony refusal (protocol-stored-form-apply.ts:270) to name a remedy that exists for a remote database, documented in the upgrade docs. Cost: S in code. But the remedy is an operator procedure nobody has measured, for example: export the tenant DB to a local SQLite file, run 'os migrate protocol --to 19 --apply' against it, then re-import it. That needs downtime and cloud tooling, and forms stay 404 until an operator runs it.",
            "C: A switch-scoped atomic path through a new driver capability, either a declared scoped-transaction member or a batch-capture API the ceremony reads. That is a new published contract (Clause-② yes). The capture variant is not feasible without forking the repository's write logic (event_seq, version and read-back are each read between writes).",
            "D: Relax all or nothing on the remote face to an ordered, resumable run: write copies and read them back first, take old rows after, and a re-run is idempotent (already true). This overturns the ADR-0159 D7 all-or-nothing ruling, so it needs a maintainer ruling and an ADR amendment."
          ],
          "recommendation": "A, gated on one measurement first: the ceremony on a real sqld/Turso endpoint, checking the lock and timeout against the ceremony's round-trip count. A is the only route that is atomic without a new contract or a ruling reversal, and it fixes the same false-atomicity for every hosted transaction caller, not only the switch. If the measurement shows the timeout bites at realistic form counts, fall back to B with a cloud-owned procedure. Axis analysis: the dispatch carried no decision axes (os-dev.md: the axes come verbatim from pm-dispatch SKILL.md, and the dev does not draft its own). PM, please send them, and I will grade each option on them."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": [
        "carrier: objectstack#39197 (card owner) · noted, not filed: the card's 'Also' item. An exported switchStoredFormsOf(protocol, engine) would remove cloud's copy of the CLI's order (census, refusal, ceremony, census, recordDataMigrationRun). Out of scope per the dispatch unless the card's owner rules otherwise. It would be a new published export (Clause-② yes).",
        "carrier: cloud#5381 · noted: whichever route is chosen, cloud's protocol-switch e2e (PR #5390, Turso remote case) is the downstream pin that flips from NO-ROLLBACK to a moved form."
      ]
    }
  7. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud@zhuangjianguo · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

    Dev stopped at an architecture fork → needs-user-decision · 2026-12-03T05:04Z

    Dev report 7368326827, at origin/main 93e035410. Every file the card names is byte-equal to pin b706ec6e, so the defect holds. No code was written.

    Measured / read:

    • libSQL's batch is all or nothing (probe: a failed batch leaves 0 rows).
    • transaction('write') is real on the libSQL client, and the Hrana HTTP client opens interactive transactions over a stream (http.js:155).
    • The switch's writes cannot be precomputed into one batch. Every repo.put / delete reads between its writes (write head, nextItemVersion, nextEventSeq, history seq), and step 3 reads each copy back and checks its hash. A captured batch would give every put the same event_seq.

    维护者速读

    • 问题: 托管租户的库(Turso 远程连接)跑不了协议 19 的表单切换。原以为可以打包成一次批量写入,实测不行:切换过程中每一步写之前都要先读。剩下的路都要动更大的东西。
    • 请在下面选一个:
      • A: 让 Turso 远程连接真正支持事务。切换代码本身不用改,所有一致性都由数据库保证。代价是工作量 L 到 XL。所有托管租户上用到事务的地方(约 15 个文件)都会变成持锁的交互式事务。Turso 对交互式事务有超时限制,表单多的租户可能超时,超时后整体回滚、切换失败,但不会留下半截数据。落地前必须先在真实 Turso / sqld 上测一次。
      • B: 继续拒绝,但改拒绝提示,并在升级手册里写清运维怎么处理(例如把租户库导出成本地 SQLite,切换后再导回去)。代码改动小(S)。代价是需要停机,这个导出导入的流程没人实测过,切换之前这些表单一直打不开(404)。
      • C: 新增一个只给切换用的驱动能力。这是新的公开合约(Clause-② yes),而且批量捕获的做法要把仓库的写入逻辑复制一份成 SQL,不可行。
      • D: 在远程连接上放弃「全做或全不做」,改成按顺序写、可以重跑。这要推翻 ADR-0159 D7 的裁决并修订 ADR。
    • 我的建议:先等普查,再在 A 和 B 之间选。 普查就是 cloud#5381 的 --rows,由维护者执行。
      • 没有租户存着旧格式表单:选 B。小改动,先把拒绝提示改成运维看得懂的;A 另开卡排期,作为长期正解。
      • 有:选 A。先测真实 Turso 的超时,测下来超时会卡住才退回 B。
      • 不建议 C 和 D。

    Out of scope (noted): the card's "Also" item, an exported switchStoredFormsOf, would be a new published export (Clause-② yes) and needs its own ruling. Cloud's protocol-switch e2e (cloud PR #5390, Turso remote case) is the downstream pin that flips once a route lands.

  8. added
    needs-user-decision
    and removed
    pm:dispatched
    on Dec 3, 2026
  9. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    director#1 · hotlong · session_f4c42f815d5e47b39de5e9fb0d6d7864

    普查读数到了(cloud#5381 评论 7371379303,2026-12-03T07:55Z):生产 50 个租户库里 3 个在用环境有 active 旧格式表单(7 行,另 1 行草稿);staging 51 个里 2 个在用、4 个归档。维护者据此裁定生产的 objectos 部署先缓(cloud#5381 本席记录),所以本卡现在挡着协议 19 的生产部署。优先级要不要上调,已呈维护者。

  10. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    director#1 · hotlong · session_f4c42f815d5e47b39de5e9fb0d6d7864

    更正(2026-12-03T08:05Z):受影响的旧格式行经核实全是内部记录表单,没有公开链接,也没有操作指向它们,部署后用户看不到变化。维护者已把生产部署改回照常部署(cloud#5381 本席改判记录)。本卡不再挡生产部署,不需要因此上调优先级。

  11. objectstack-fleet commented on Dec 3, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:cloud#5 · hotlong · session_01Q4EjjQPiTGVjMVAbb5yijp

    2026-12-03T22:58Z · Release (claim only) · seat repo:cloud@zhuangjianguo's account zhuangjianguo is out of tokens. The maintainer's takeover order went to seat repo:cloud#5, whose project takes only objectstack-ai/cloud cards, so this objectstack card stays with the objectstack lane.

    Release: claim 7368180230 (session session_01TsNV8Bsjqmw7aXCo2QuLU1, account zhuangjianguo, seat repo:cloud@zhuangjianguo). Provenance: who = the maintainer (Jack, hotlong); words, verbatim: 「zhuangjianguo 座位没有token了,你看一下他的任务你全部接手」; where = hotlong's fleet project 「cloud #5」 (seat repo:cloud#5), 2026-12-03T22:44Z.
    Resume-from: claude/issue-39197-turso-form-switch@93e03541031a9b62f740c25afe0026bb07ed9190
    Handover: needs-user-decision stays; the card waits on the maintainer. Per director#1's correction (latest comment), it no longer holds the production deploy. The cloud side, cloud#5381, is the maintainer's card. Assignee zhuangjianguo cleared in this stroke.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cloudbugdomain:dataneeds-user-decisionpriority:p2

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions