Skip to content

Dogfood 回归测试 organization-ownership-boot-refusal-order 时好时坏,把无关 PR 踢出合并队列 #37429

Done
1 of 1 issue completed

Description

@objectstack-fleet

repo:objectstack#5 · os-bill · session_01Utp6CbeF2saT6wUBV4E9uc

Filing gate: ① non-deterministic test that ejected a PR from the merge queue. Found by area ai-36996 while landing PR #37409. Filed with no parent: it is not this area's surface.
Grading: area:data · Bug · p2 · reach: every PR in the merge queue that lands in Dogfood shard 2/3 (one measured ejection) · evidence: measured (CI logs).

维护者速读

  • 做什么:合并队列里有一个回归测试时好时坏:同样的代码,有时过、有时不过,结果把一个无关的 PR 踢出了队列。查清原因并修好这个测试。
  • 谁受益:所有排队合并的 PR。
  • 不做会怎样:无关 PR 会被随机踢出队列,要人手重新排队,拖慢合并。
  • 需要你做的:无。

What

packages/qa/dogfood/test/organization-ownership-boot-refusal-order.dogfood.test.ts, "[ADR-0131 D10 item 5] a 17.x database upgrades through the boot refusal":

  • step 1b fails at :121 with expected [ 'id', 'user_id', …(2) ] to include 'permission_set' (the columns of sys_user_permission_set after the refused boot);
  • then step 2 (the ceremony) fails at :132.

Measured, on unchanged inputs (PR #37409, head e9b2056f, a docs-only diff that touches no migration, driver or platform object):

  • passed the whole queue CI on base 9ac77b48 (run 45748004021) and on base cd9d3b52 (run 45749212646);
  • failed in queue group gh-readonly-queue/main/pr-37409-f9dd0331, CI run 45751259665, job "Dogfood Regression Gate (2/3)" (job 139679521374): 1 file failed, 161 passed; 2 tests failed, 1305 passed;
  • the group's base f9dd0331 passed its own queue CI (pr-37382, run 45751257776).

Find the root cause ("flake" is not one: likely an ordering or timing dependency in the additive schema sync of the refused boot) and fix the test or the code it exposes. Do not skip, retry-wrap or quarantine it.

Acceptance

  • The root cause is named on this card with the evidence.
  • The test passes in 20 repeated runs of that file, and the fix carries a test that fails without it where the cause is in product code.

Size: S
Dedupe (objectstack, is:issue): "organization-ownership-boot-refusal-order" 0 open · "boot refusal" permission_set 0 open.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    priority:p2
    pm:queue
    on Nov 26, 2026
  2. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: lands in area:data · domain:devx · Bug · priority:p2 · pm:queue · size S; rationale: a non-deterministic dogfood test (organization-ownership boot refusal order, shard 2/3) ejected an unrelated PR from the merge queue. That is a measured false red with a named instance, so it enters the queue. It is p2 because it ejects at random and nothing is wrong on main.

    Confirmed as filed. Route: area:data p2, to seat 7 or seat 5 zone o5-D. If it ejects a second unrelated PR before a fix lands, triage re-reads it as a flake anchor.

  3. added
    domain:devx
    on Nov 26, 2026
  4. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS

    Claim: area o5-D round 3 · 2026-11-26T04:42Z · area:data p2 (area order 「开一个专区 ,接 data 的 p1 p2」, 2026-11-25T23:33Z). Routed by triage 7182679009 to seat 7 or o5-D; the claim stamp decides.
    Area: o5-D
    Session: session_01Utp6CbdHk3orAeensH6EzS
    Account: os-bill
    Branch: claude/issue-37429-boot-refusal-order-flake
    Worktree: objectstack-issue-37429
    Domain: domain:devx
    Seat: repo:objectstack#5
    File surface: packages/qa/dogfood/test/organization-ownership-boot-refusal-order.dogfood.test.ts and its local helpers; if the root cause is in product code, the file that produces it (the refused boot's additive schema sync: packages/drivers/driver-sql/src/** sync path or the boot-refusal ceremony in packages/runtime/** / packages/objectql/**, named in the report before the edit) plus a test that fails without the fix; root .changeset/ when product code moves. ⛔ Skip, retry-wrap, quarantine or timeout-only changes. Stop on breach and report.
    Container & model: S, mode:subagent, model: default, effort: medium
    Clause-②: no
    Metadata-protocol: none
    Responsibility: the dogfood test (or the product path it exposes) in objectstack | no platform path covers it; a re-queue by hand is today's workaround | every PR whose merge group lands in Dogfood shard 2/3 (one measured ejection, PR #37409)
    Thread-read: 7182679009
    Premise: holds — at origin/main f9dd033 the test is at organization-ownership-boot-refusal-order.dogfood.test.ts:85, unchanged since dfdebfa; the measured failure (CI run 45751259665, job 139679521374) is on the card.
    Pre-claim lane: packages/qa/** → domain:devx, as triage labelled it.
    Pre-claim deps: none. No open PR touches the test file.
    Serial constraints cleared: none in flight.
    Scope: the card's acceptance — root cause named on the card with evidence; the file passes 20 repeated runs; a test that fails without the fix if the cause is in product code. Fixes #37429.

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS

    Root cause (#37429): the sqlite-wasm driver's disconnect() stops waiting for its final flush after 5 s, so a refused boot can return before its schema sync is on disk. Not a sync-order defect: the refused boot does run the additive sync, in memory. What decides step 1b is whether that sync reached the file by the time bootStack rejects.

    Mechanism (tree: objectstack f9dd0331)

    1. The default datasource opens the file through SqliteWasmDriver (sql.js, in memory), persist mode on-write (packages/services/service-datasource/src/default-datasource-driver-factory.ts:1218). Every DDL statement of the sync starts a flush in the background. A flush exports the whole image and writes it as tmp file, write, fsync, rename (packages/drivers/driver-sqlite-wasm/src/wasm-connection.ts:519-531).
    2. The guard refuses. The kernel rolls back the plugins that started. DatasourceAdminPlugin.destroy() calls disconnectAll(), which disconnects the default driver.
    3. SqliteWasmDriver.disconnect() (packages/drivers/driver-sqlite-wasm/src/sqlite-wasm-driver.ts:158-167) goes to knex.destroy() (packages/drivers/driver-sql/src/sql-driver-lifecycle.ts:415-417), then to the tarn pool's destroy. The final flush runs inside the connection's close() (wasm-connection.ts:563), which is the pool's destroyer. tarn wraps every destroyer in a PendingOperation with destroyTimeoutMillis, default 5000 ms (tarn@3.1.2/dist/Pool.js:74, :444). At the timeout tarn logs the rejection to its event handlers and resolves anyway (:455-460). So disconnect() returns while the flush is still running. The driver's durability boundary is "flush done or 5 s, whichever comes first".
    4. On a loaded runner, a whole-image fsync takes more than 5 s. bootStack rejects, step 1b reads the old v17 bytes, and step 2's plan reads the same bytes ("sys_metadata has no column type").

    Evidence

    • CI run 45751259665, job 139679521374: Rolling back started plugins... at 04:04:42.799. The next Evicted the DEFAULT driver (the line disconnect() writes once the pool resolves) is at 04:04:47.804, 5.005 s later. Step 1b then fails, and the plan child finds sys_metadata without type. Neither of those two columns from the refused boot's sync reached the file.
    • Deterministic local repro (scratch probe, not committed): the same test file, with every FileHandle.sync in the worker delayed.
      • Delay 1500 ms (under the timeout): rollback, then eviction about 1.8 s later. The eviction waited for the flush. 1b passes, 4/4 tests pass.
      • Delay 6000 ms (over the timeout): rollback at 04:59:55.739, eviction at 05:00:00.747 (5.008 s). 1b reads [ 'id', 'user_id', 'permission_set_id', 'organization_id' ], and 1b and 2 fail with the CI's exact signatures (2 failed, 2 passed).
    • Confidence: high. The CI gap (5.005 s) and the repro gap (5.008 s) are both tarn's timeout. The failure reproduces on demand once the flush is slower than that timeout.

    Fix (product code, in the claim's "the file that produces it"): SqliteWasmDriver.disconnect() awaits its own flush before the pool is destroyed, so disconnect() (and stop(), and a refused boot's rollback) returns only once the image is on disk. A flush that fails is thrown, not timed out in silence. It comes with a driver test that fails without the change: a slowed fsync plus a short pool destroyTimeoutMillis, and the file is read right after disconnect(). The dogfood test is unchanged (no retry, skip or timeout). Reach beyond this test: any graceful stop of a file-backed sqlite-wasm datasource (os dev's default fallback) whose final flush takes more than 5 s returns before the data is on disk. A process that exits right after that loses the committed writes.

  7. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS
    os-dev-report

    {
      "issue": 37429,
      "status": "done",
      "branch": "claude/issue-37429-boot-refusal-order-flake",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37450",
      "head": "a37e3c5f",
      "files_changed": [
        "packages/drivers/driver-sqlite-wasm/src/sqlite-wasm-driver.ts",
        "packages/drivers/driver-sqlite-wasm/src/sqlite-wasm-driver-durability.test.ts",
        ".changeset/37429-sqlite-wasm-disconnect-awaits-flush.md"
      ],
      "line_budget": "+97 / -1 across 3 files",
      "gates": "local: 62/64 derived commands exit 0; NOT MEASURED: check-plugin-teardown-shape --self-test (exit 3, pinned control unreachable on shallow clone), check:dual-build-cjs-loads (exit 3, PREREQUISITE NOT MET, unrelated packages without dist); --ran: 64 derived, 62 run, 2 unrun (the two above); overlap-check VERDICT clean; driver-sqlite-wasm test 769/769 and typecheck exit 0 on the merged head; dogfood file 20/20 green; CI check-runs in_progress at report time",
      "deviations": "fix lives in packages/drivers/driver-sqlite-wasm (the claim's 'the file that produces it'; its example list named driver-sql); root cause and file:line posted on the card (comment 7183113339) before the edit; the first commit carried a harness co-author trailer naming a model, refused by the pre-push hook and reworded before any push",
      "security_findings": "none"
    }
  8. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS
    os-dev-report

    {
      "issue": 37429,
      "status": "done",
      "round": "L1 rework (seat verdict 7184319598, contract record 7184310941)",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37450",
      "head": "ebb76076",
      "files_changed": [
        "packages/drivers/driver-sqlite-wasm/src/sqlite-wasm-driver.ts",
        "packages/drivers/driver-sqlite-wasm/src/sqlite-wasm-driver-durability.test.ts",
        ".changeset/37429-sqlite-wasm-disconnect-awaits-flush.md"
      ],
      "closed": "S1: pinned that a failed final flush makes disconnect() reject with the same error, after the pool is released. S2: disconnect() shares the in-flight promise; pin added, and the memo ablation turns it red (Test timed out in 10000ms). S3: PR Acceptance note corrected and pointed at #37462. N1, N2 and N3 also addressed.",
      "gates": "driver-sqlite-wasm test 771/771, typecheck exit 0; check-nul-bytes exit 0; targeted gates (plugin-teardown-shape, test-source-alias, driver-conformance, refd-timer-probe, logger-receiver-detach, cross-package-test-inputs, empty-changeset, changeset-no-major, doc-authoring) all exit 0; overlap-check VERDICT clean before the push; CI pending on the new head",
      "deviations": "none; no main merge in this round (no conflict)",
      "security_findings": "none"
    }
  9. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:data · domain:devx · Bug · priority:p1 · pm:dispatched · size S; rationale: a non-deterministic Dogfood test ejected an unrelated PR from the merge queue. A queue-ejecting flake is p1.

    Regraded p2 → p1 on the maintainer's go in the triage session (「升级吧」), after a review of every open p2 card.

  10. added
    priority:p1
    and removed
    priority:p2
    on Nov 26, 2026
  11. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#5 · os-bill · session_01Utp6CbdHk3orAeensH6EzS

    Close-out · area o5-D · 2026-11-26T07:39Z
    Delivered by PR #37450 (merged, 4925039a75): SqliteWasmDriver.disconnect() awaits the final flush itself (no timeout) before destroying the Knex pool, so a refused boot's rollback, a kernel stop() and BootOptions.databaseFile return only after the committed image is on disk; a failed final flush rejects disconnect() after the pool is released; concurrent calls share one in-flight teardown. Root cause 7183113339 (flush ran as the pool destroyer, which tarn abandons after 5 s). L1 ACCEPT 7185135027, delta contract review PASS 7185102633.
    Remaining: #37462 (kernel rollback destroys only started plugins vs shutdown destroys all, open). The merge queue's Dogfood Regression Gate was this fix's first CI run of the dogfood file; a recurrence of the boot-refusal-order signature reopens this card. pm:dispatched removed in this stroke; the card closed as completed by the merge.

  12. removed
    pm:dispatched
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:datadomain:devxpriority:p1

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions