Skip to content

fix(objectql,driver-sql): ADR-0131 8c-1 follow-up — an elevated insert whose row carries its organization warns [tenant-audit] under a wall, and a wall-exempt admin write cannot declare the exemption to the driver #25230

Closed

Description

@objectstack-fleet

Filing gate ③: a finding of the contract review of PR #25210 (record 6341425088, ③ item 3). It does not block that PR, which merged as 3a440b01f6.

  • Who acts: the shared queue.
  • Dedupe: none.

Part of #15212.

What happens on main

  • Since refactor(objectql)!: retire the PLATFORM_OBJECT_TENANCY ledger — the tenant-audit mute is decided by the schema, and the [tenant-audit] warning names both readings #25210, the engine's isSystem bypassTenantAudit mute is decided by schema: a tenant column, not federated. It no longer uses a per-table ledger. About 32 platform objects with a tenant column therefore no longer have their audit muted.
  • The SQL driver's auditMissingTenant (packages/drivers/driver-sql/src/sql-driver.ts, early return at about :15999) warns [tenant-audit] … without options.tenantId on create and bulkCreate as well as on update and delete. So an elevated insert whose row already carries organization_id warns under a walled posture. The dev's walled os serve printed 43 such lines at boot.
  • A wall-exempt admin's REST write has no caller that can declare bypassTenantAudit: true: the engine sets it only for isSystem. So that line keeps firing under a wall, even though nothing needs fixing.
  • Diagnostics only: no write changes. The ruled direction is a warning, never a silent rewrite.

Wanted

  • The insert audit is skipped when the row carries its tenant field.
  • The engine declares the D8 wall-exemption to the driver, so an exempt admin's write is not told to declare an option it cannot set.
  • Keep the warning's prefix byte-identical: delivery-claim-tenant-audit.integration.test.ts matches it.

Acceptance

  • A walled boot prints no [tenant-audit] line for an insert whose row carries its organization. This is pinned.
  • An update or delete with no tenantId still warns. This is pinned.
  • No write behaviour changes. R1–R4 hold.

Activity

  1. added
    pm:queue
    domain:engine
    pm:dispatched
    and removed
    pm:queue
    on Oct 22, 2026
  2. objectstack-fleet commented on Oct 22, 2026

    @objectstack-fleet
    ContributorAuthor

    Claim: PM loop (card thread) · 2026-10-22T18:04Z · p3, domain:engine. ADR-0131 8c-1 follow-up: the tenant-audit warning skips an insert whose row carries its organization, and the engine declares the D8 wall-exemption to the driver. Diagnostics only.
    Session: session_01S9iQu7nAw2Ce5EXSzDVTho (card thread of domain:engine seat 2, seat session session_01FaVyM6YvQLg9CsjPVCYc5K)
    Account: os-bill
    Branch: claude/project-thread-44gu3q
    Worktree: the card thread's own checkout
    Domain: domain:engine
    Seat: domain:engine#2 (seat post #20966)
    File surface: packages/drivers/driver-sql/src/sql-driver.ts (auditMissingTenant), packages/objectql/src/engine.ts (where bypassTenantAudit is set), their tests; a walled boot count before and after; one patch changeset per moved package.
    (stop on breach; explain in the report)
    ⛔ Not in scope: any write behaviour; the warning's prefix; the schema rule #25210 set; #25208 (the epic seat's).
    Container & model: M, mode:thread, model: TIER_DEFAULT, effort: high. Review: the seat's TIER_DEFAULT review of record; CONTRACT_REVIEW_TIER if a published driver option widens.
    Clause-②: no (provisional; diagnostics only)
    Metadata-protocol: none
    Responsibility: the driver audits inserts that already carry their tenant field, and no caller can declare a D8 exemption | #25210 decides the isSystem mute by schema | every operator reading a walled boot's log
    Thread-read: none
    Serial constraints cleared: open PRs on auditMissingTenant and the engine's bypassTenantAudit site re-checked at claim time: no open PR touches either file.

  3. objectstack-fleet commented on Oct 22, 2026

    @objectstack-fleet
    ContributorAuthor

    os-dev-report

    {
      "issue": 25230,
      "status": "done",
      "branch": "claude/project-thread-44gu3q",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/25274",
      "session": "session_01S9iQu7nAw2Ce5EXSzDVTho (card thread of domain:engine seat 2)",
      "premise_still_valid": true,
      "summary": "driver-sql: auditMissingTenant takes the inserted rows from create/bulkCreate and skips the [tenant-audit] line when every row carries a non-empty tenant column; update/delete/updateMany/deleteMany/bulkDelete/upsert with no tenantId still warn; prefix and text byte-identical. objectql: buildDriverOptions fills in the EXISTING bypassTenantAudit option when the recorded Layer 0 verdict is none and the engine own fallback asking of the same ladder (exemption withheld) would have walled the operation (plugin-security crossedByPlatformAdmin test, read from the recorded value); no DriverOptions widening, no new OperationContext member, no posture read added to the driver. Walled showcase boot: 55 lines on base 0f1eeeeeb (create 16, bulkCreate 16, update 5, updateMany 18) → 23 on the branch (update 5, updateMany 18): every insert line gone. Diagnostics only, no write changes.",
      "tests": "Head d323330402 (last commit is comment-only in engine.ts; suites below ran on fa4caae8/501e121d with identical code). New: sql-driver-tenant-audit-insert-carries-tenant.test.ts 11/11, engine-tenant-audit-wall-exemption.test.ts 10/10. objectql: test 464 files 8686 passed, typecheck exit 0. driver-sql: typecheck exit 0; test 3773 passed 1 failed on first run (sql-driver-tenant-scope throttle pin used a create carrying organization_id; now two deletes, same assertion) → tenant-scope + audit-posture + insert-carries files 61/61. service-messaging delivery-claim/delivery-update tenant-audit integration 13/13; service-storage tenant-audit-update-delete-half-repairs 30/30. Ablation via scripts/ablation-replace.mjs, fix committed, restore verified blob==HEAD and git diff HEAD empty, tests import src so no build leg: (1) delete row-carries-tenant skip → 2 failed 9 passed (insert pins red, update/delete/upsert controls green); (2) remove the engine exemption assignment → 3 failed 7 passed (declared pins red, not-declared green); first engine attempt refused by the tool before running (replacement was a substring of the anchor), rerun with distinct replacement.",
      "gates": "dispatch-gates --commands on d323330402: 74 commands, each exit captured before any pipe: 74/74 exit 0. --ran: 74 derived accounted for, 74 run, 0 NOT-MEASURED. Prerequisites met first: git fetch 621a48760 (check-plugin-teardown-shape --self-test) and --shallow-since=2026-07-17 (check-engine-split-ratio --days 90); on the earlier head b57e83d5 those two exited 3 and 2 on the shallow clone, the other 72 green. Not governed (no governed path). PR check-runs: in_progress at report time.",
      "dogfood_battery": "n/a — no ! in the PR title and no (narrowing) arm",
      "mcp_calls": "0 GitHub MCP calls. Harness (non-GitHub-MCP): claude-code-remote subscribe_pr_activity on #25274 once.",
      "api_writes": "2 relay strokes so far: fleet-write pr_create (POST pulls draft + assignee os-bill, run 39839763422, read-back identical 7248 bytes) and this os-dev-report comment via post-stamped. git push is not a REST write.",
      "deviations": [
        "PR body attribution line links THIS card thread (session-context requires its own link verbatim), not the seat thread link named in the dispatch order.",
        "Session-context MCP reviewer request skipped: order forbids MCP writes; assignee rode pr_create; reviewer request left to the seat."
      ],
      "files_changed": [
        ".changeset/25230-engine-declares-wall-exemption.md",
        ".changeset/25230-tenant-audit-insert-carries-organization.md",
        "packages/drivers/driver-sql/src/sql-driver.ts",
        "packages/drivers/driver-sql/src/sql-driver-tenant-audit-insert-carries-tenant.test.ts",
        "packages/drivers/driver-sql/src/sql-driver-tenant-audit-posture.test.ts",
        "packages/drivers/driver-sql/src/sql-driver-tenant-scope.test.ts",
        "packages/objectql/src/engine.ts",
        "packages/objectql/src/engine-tenant-audit-wall-exemption.test.ts"
      ],
      "line_budget": "8 files, +420/-33 (source +112/-18; rest tests and changesets)",
      "open_questions": [],
      "out_of_scope_findings": [
        "carrier: none (承接者:无) · noted, not filed: the 23 lines left at a walled showcase boot are seed-time update (5) and updateMany (18) on showcase_* objects with no tenantId, the case the line exists for; whether the showcase seed path should run them in an organization context is outside this card.",
        "carrier: none · noted, not filed: an exempt admin by-id write records no Layer 0 verdict, so the engine scopes it to the active organization and declares nothing (ADR-0131 D8 as written). NOT MEASURED: a live exempt-admin predicate write through REST; pinned at the DriverOptions seam."
      ]
    }

    Report taken 2026-10-22T19:25Z.


    Generated by Claude Code

  4. objectstack-fleet commented on Oct 22, 2026

    @objectstack-fleet
    ContributorAuthor

    os-dev-report

    {
      "issue": 25230,
      "status": "done",
      "round": "rework 1 (review FAIL: docs conflict with main 24360dcfb)",
      "branch": "claude/project-thread-44gu3q",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/25274",
      "head": "652114639b",
      "session": "session_01S9iQu7nAw2Ce5EXSzDVTho",
      "summary": "Merged origin/main into the branch (merge commit b6a43d4758, no rebase). The tenant-audit-census.mdx guard 2 keeps main D13 wording and adds the D8 wall-exemption sentence. Added the optional control: a row with organization_id null still warns (insert-carries-tenant file now 12 tests). The incoming main commits touch neither packages/objectql nor packages/drivers/driver-sql.",
      "tests": "On 652114639b after pnpm install --frozen-lockfile and a full turbo build (76/76): driver-sql tenant-scope + audit-posture + insert-carries-tenant 62/62; objectql wall-exemption + driver-read-scope 23/23. Package suites from the first round (objectql 8686/8686, driver-sql full run) were not re-run: the merge brought no change to either package.",
      "gates": "dispatch-gates --commands on 652114639b: 106 commands over 9 paths (docs families added by the census page), each exit captured before any pipe: 106/106 exit 0. --ran: 106 derived accounted for, 106 run, 0 NOT-MEASURED. Supersedes the 74/74 on d323330402, which did not cover the docs commit. PR check-runs at report time: 32 success, 6 skipped, 3 in_progress; mergeable true.",
      "files_changed": [
        ".changeset/25230-engine-declares-wall-exemption.md",
        ".changeset/25230-tenant-audit-insert-carries-organization.md",
        "content/docs/permissions/tenant-audit-census.mdx",
        "packages/drivers/driver-sql/src/sql-driver-tenant-audit-insert-carries-tenant.test.ts",
        "packages/drivers/driver-sql/src/sql-driver-tenant-audit-posture.test.ts",
        "packages/drivers/driver-sql/src/sql-driver-tenant-scope.test.ts",
        "packages/drivers/driver-sql/src/sql-driver.ts",
        "packages/objectql/src/engine-tenant-audit-wall-exemption.test.ts",
        "packages/objectql/src/engine.ts"
      ],
      "mcp_calls": "0 GitHub MCP calls",
      "api_writes": "this comment via post-stamped (relay); git push is not a REST write",
      "open_questions": []
    }

    Report taken 2026-10-22T20:09Z.


    Generated by Claude Code

  5. objectstack-fleet commented on Oct 22, 2026

    @objectstack-fleet
    ContributorAuthor

    ACCEPT → PR #25274 comment 6350266730 (seat review PASS 6350254884 on 652114639b, after FAIL 6349582997 on 0d69599888). Ready and auto-merge follow once every check on the landing head is green.

  6. objectstack-fleet commented on Oct 22, 2026

    @objectstack-fleet
    ContributorAuthor

    CI fix, round 2 (Test Core (3/6) red on 652114639b): driver-sqlite-wasm's sqlite-wasm-driver-tenant-scope.test.ts carried the twin of the driver-sql throttle pin (two creates whose rows carry organization_id, now unaudited because the WASM driver inherits SqlDriver.create). Same repair: two deletes, assertion unchanged; one test file, nothing else. New head 1313821b57: driver-sqlite-wasm 704/704, driver-turso 2492 passed locally; dispatch-gates --commands 106/106 exit 0, --ran 0 NOT-MEASURED. files_changed now 10 (adds packages/drivers/driver-sqlite-wasm/src/sqlite-wasm-driver-tenant-scope.test.ts). Session session_01S9iQu7nAw2Ce5EXSzDVTho. Taken 2026-10-22T20:41Z.


    Generated by Claude Code

  7. objectstack-fleet commented on Oct 22, 2026

    @objectstack-fleet
    ContributorAuthor

    Landed · domain:engine seat 2 (seat post #20966) · os-bill · session_01FaVyM6YvQLg9CsjPVCYc5K · 2026-10-22T21:31Z

    Probe Reading
    PR #25274 (Fixes #25230) merged: true at 2026-10-22T21:31Z, merge commit b62f959fe, through the merge queue
    origin/main b62f959fe fix(objectql,driver-sql): the tenant-audit warning skips an insert whose rows carry their organization, and the engine declares the D8 wall-exemption to the driver (#25274)
    queue branch gh-readonly-queue/main/pr-25274-* gone
    card closed completed by the PR

    A walled boot no longer warns for an insert whose rows name their organization (55 → 23 lines on the showcase; inserts 32 → 0), a D8 wall-exempt predicate write no longer asks for an option its caller cannot set, and updates / deletes without a tenant still warn; no write behaviour moved. State: pm:dispatched removed in this act.


    Generated by Claude Code

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

Metadata

Metadata

Assignees

Labels

domain:enginepriority:p3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions