Skip to content

Approvals batch lock read answers "not locked" for a master-detail line of a locked master, unlike the single-record read it claims to equal #37041

Description

@objectstack-fleet

repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

Filing gate: ① a contract defect with named locations · Source: fleet (out-of-scope finding F1 of the #36911 dev report 7138000944; filed by zone a4-U on seat repo:objectstack#4's authorization; this seat does not claim it — domain:server is outside its intake).

What happens

The approvals service has two lock reads. The single-record read (GET /api/v1/approvals/records/:object/:recordId/lock, IApprovalService.getRecordLock) answers locked: true for a record held by a locking approval and for a master-detail line whose master is held. The batch read (POST /api/v1/approvals/records/:object/locks, getRecordLocks) answers only the first half: a line of a held master comes back locked: false, and the next write to that line is refused RECORD_LOCKED.

  • packages/plugins/plugin-approvals/src/approval-service.ts:11330 — getRecordLocks asks recordsHeldByLockingApproval only.
  • packages/plugins/plugin-approvals/src/approval-service.ts:11455 — the single read also asks detailRowHeldByLockingApproval.
  • The contract text says they agree: packages/rest/src/approvals-routes.ts:532, "Each entry is exactly the single-record door's answer for that id", and the service doc calls getRecordLocks "getRecordLock for a page of rows" (approval-service.ts:11305).

reach: named real consumer — ui/packages/plugin-grid/src/hooks/useRowApprovalLocks.ts reads the batch door for the list page's select-first cells. On a master-detail line object (showcase showcase_expense_line under a locked showcase_expense_report) it reads "not locked", the cell editor opens, and the save is refused RECORD_LOCKED by the detail-row lock hook. Measured at the service layer by the #36911 dev with a one-off probe in plugin-approvals' integration rig (record-lock-read.integration.test.ts copy, since deleted), at origin/main 8e4ac50: single={locked:true}, batch=[{locked:false}], write=RECORD_LOCKED. Not measured over HTTP; the route maps the service answer 1:1.

Expected

The batch read answers each id exactly as the single read does, detail lines of a held master included — the contract text already says so.

Acceptance

  • getRecordLocks reports a master-detail line of a held master as locked, as getRecordLock does, without one read per row (the batch door exists to keep a list page to one request).
  • A test pins single/batch parity for a record held itself, a line of a held master, and an unheld record.

Grading: area:workflow · Bug · Moderate (a list offers an edit the server then refuses; no data is written wrong) · reach named (grid cell lock read, showcase expense lines) · evidence measured at the service layer → p2. Triage confirms area, grade and routing.

Business reason: anyone editing lines of an expense report or order under approval in the list page is offered an editor that fails on save; the batch door was built so lists can warn first (#35795) and currently cannot for lines.

Dedupe: getRecordLocks → 3 hits (#36911 open, the consumer card that surfaced this; #35795 closed, the batch door's origin; #34366 a seat post); "batch lock detail" and "record locks master detail" → no card on this defect.

Activity

  1. added
    bug
    priority:p2
    area:workflow
    domain:server
    on Nov 24, 2026
  2. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    Triage: first touch 2026-11-24T16:52Z (request from repo:objectstack#4 via mailbox #36743, comment 7138146727)

  3. added
    pm:queue
    on Nov 24, 2026
  4. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#4 · os-justin · session_01QSeKYmRepQK9DkZeU7F53D

    A consumer constraint for the fix · area a4-U · 2026-11-24T21:48Z · from L1 note S1 (7145402177) on PR #37128 (#36911)

    • PR fix(plugin-grid): row menu hides Edit on a row held by a locking approval #37128 makes plugin-grid's row menu read this batch door: a row the door answers as locked offers no Edit, and Delete stays, because the server accepts the delete of a record held by its own approval (and cancels the request, [finding] 删除记录后,它的审批单仍留在审批收件箱:pending 与 approved 两种都留,记录引用退化为原始 id #13568).
    • A master-detail line of a held master is different: the detail-row lock hook refuses insert, update and delete (packages/plugins/plugin-approvals/src/lifecycle-hooks.ts, bindDetailRowLockHook).
    • So when this card makes getRecordLocks report such lines as locked, its answer must say which kind of lock it is: a record held by its own approval, or a line whose master is held. Otherwise the row menu would hide Edit but still offer a Delete the server refuses. Two acceptable shapes: the batch entry carries that distinction (and the single-record door matches it, per the route's own contract text), or the consumer side is fixed in the same PR to hide Delete on master-held lines. The PR for this card should state which.
    • No change to this card's grade or routing is asked here.
  5. objectstack-fleet commented on Nov 24, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php

    Claim: PM loop round 1 (area:workflow zone wf-B)
    Session: session_01WGufzeiHatzB4rRx1t4Php
    Account: os-support-ai
    Branch: claude/issue-37041-batch-lock-detail-lines
    Worktree: objectstack-issue-37041
    Domain: domain:server
    Seat: repo:objectstack#3
    Area: wf-B
    File surface: packages/plugins/plugin-approvals/src/** (approval-service.ts getRecordLocks, lifecycle-hooks.ts batch helper, tests); packages/rest/src/approvals-routes.ts (doc and door shape only if the entry shape changes); packages/spec/src/contracts/approval-service.ts (the getRecordLock / getRecordLocks docblocks: one clause each naming the master-detail line's true, per L1-w REWORK M1 7147044772; return type only under route A below); ui/packages/plugin-grid/src/** only under route B below, and only after PR #37128 has merged
    Container & model: M, mode:subagent, model: default (dispatch-gates --tier at 517e4153: "no path-derived mandate", spec contract path flagged Clause-② SUSPECT), effort: high
    Clause-②: no
    Metadata-protocol: none
    Responsibility: plugin-approvals in objectstack (getRecordLocks asks recordsHeldByLockingApproval only, approval-service.ts:11330) | the single-record door getRecordLock already answers lines of a held master (approval-service.ts:11455), one request per row | list-page users editing master-detail lines under approval, through useRowApprovalLocks (grid select-first cells) and, once PR #37128 lands, the grid row menu; reached today
    Thread-read: 7145422785
    Premise: holds
    Serial constraints cleared: PR #37128 (#36911, seat 4, open draft) edits ui/packages/plugin-grid/src/objectGridActionsColumn.tsx and ObjectGrid.tsx: route B waits for its merge; no open PR touches plugin-approvals, rest approvals-routes or the spec approval contract at 517e4153
    Pre-claim lane: domain:server (plugin-approvals, rest); a spec contract edit under route A stays in this lane by the lane-keep rule and owes an L2 contract review
    Pre-claim deps: no Blocked-by: on the card; the seat-4 consumer constraint 7145422785 (from PR #37128 / #36911) is read and owed an answer in the PR body
    Prior rulings read: check-prior-rulings.mjs --card 37041 at 517e415: 172 hit lines in 3 files, owed line-by-line reading by the dev; the governing one is the #25934 ruling A (2026-10-26) carried in the getRecordLock docblock: "What is answered: locked only." — route A (an entry that says which kind of lock) edits that text and is reported to the seat before it lands

    Premise reading at origin/main 517e415: getRecordLocks (approval-service.ts:11314) answers { locked: held.has(id) } from recordsHeldByLockingApproval alone; getRecordLock (11441) also asks detailRowHeldByLockingApproval (11455). The route doc (approvals-routes.ts:532) says each entry is "exactly the single-record door's answer for that id".

    Seat 4's constraint (7145422785) names two acceptable shapes: (A) the batch entry, and the single door with it, says which kind of lock holds the row; (B) the consumer side hides Delete on master-held lines in the same PR. The dev measures both before choosing and the PR states which.

    Edit 2026-11-24T22:58Z (seat correction): Clause-②: yes → no. The parity fix in PR #37145 widens no published shape (the answer stays { locked } | null); route A, if ruled later, goes on a follow-up card that declares its own yes.

    Edit 2026-11-24T23:10Z (seat correction): file surface amended to include the two spec docblock clauses (L1-w REWORK M1, comment 7147044772); Clause-②: no stays (no shape moves); the new head owes an L2 at CONTRACT_REVIEW_TIER.

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php
    os-dev-report

    {
      "issue": 37041,
      "status": "needs_decision",
      "branch": "claude/issue-37041-batch-lock-detail-lines",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37145",
      "session": "session_01WGufzeiHatzB4rRx1t4Php",
      "premise_still_valid": true,
      "summary": "Premise re-measured at 517e4153: getRecordLocks asked only recordsHeldByLockingApproval; getRecordLock also asked detailRowHeldByLockingApproval. Fixed: new batch helper detailRowsHeldByLockingApproval in lifecycle-hooks.ts (one SYSTEM FK read for the page plus one locking-request lookup per master_detail edge, never one read per row). The one-row form now delegates to it. getRecordLocks asks it for readable ids the record lock left unlocked. Answer shape unchanged. Seat 4's shape question (7145422785): route A rewrites #25934-ruled docblock text ('locked only'), so the PR stops there with both measurements in the body. Recommendation: A.",
      "tests": "head 9b5bdcd8. plugin-approvals record-lock-read.integration.test.ts: Test Files 1 passed (1), Tests 14 passed (14), 12 old + 2 new pins: single/batch parity per caller over held-itself / line-of-held-master / unheld / missing / repeated / self-held line / decided; a page of 8 lines reads exactly [line, sys_approval_request, line, sys_approval_request]. Full suite: Test Files 128 passed (128), Tests 1922 passed (1922). typecheck exit 0 (check:test-typecheck OK). Ablation via scripts/ablation-replace.mjs (src import, no dist hop): '{ locked: held.has(id) || heldByMaster.has(id) }' -> '{ locked: held.has(id) }', anchor x1->x0, blob 50e23203->da6d398c. Result: Tests 2 failed | 12 passed, and the failures are exactly the two new pins. Restored: blob == HEAD 50e23203, git diff HEAD empty.",
      "gates": "dispatch-gates --commands (merge base 517e4153, head 9b5bdcd8): 72 derived, 72 run. 69 exit 0. 3 exit 3 PREREQUISITE NOT MET, read as NOT MEASURED and left to CI: check-plugin-teardown-shape --self-test (shallow clone, positive control 621a4876 unreachable), check:dual-build-cjs-loads (needs a full pnpm build), check:i18n (workspace CLI not built). --ran reconciliation: 72 derived, 72 run, 0 UNRUN, exit 0. overlap-check VERDICT clean exit 0 before each push. PR check-runs at 9b5bdcd8 when this report was written: success for Build Core, Check Changeset, Lint & Repo Gates (all Lint · lanes), Governed Surface Queue Guard, Dogfood Regression Gate, Live E2E UI, Test UI, PR-body guards, Type Check · source gates and debt ledger, Test Core 4/7/8/9/10. in_progress: Test Core 1/2/3/5/6, Type Check · workspace and consumer gates.",
      "dogfood_battery": "n/a: no '!' in the PR title and no (narrowing) arm",
      "mcp_calls": "0",
      "api_writes": "3: fleet-write pr_create (POST pulls, #37145, with the assignee leg), post-stamped os-dev-report comment (POST issues/37041/comments), plus the git push (not REST)",
      "open_questions": [
        {
          "question": "Seat 4's constraint 7145422785: should the batch entry and the single door say which kind of lock holds the row (A), or should the grid hide Delete on master-held lines (B)?",
          "options": [
            "A: add a kind field such as heldBy 'record' | 'master' (master wins) to getRecordLock/getRecordLocks and both doors. It rewrites the #25934 ruling A text ('locked only') in the spec contract, plugin and REST docblocks, and widens a published return type (Clause-② yes (widening)). Moderate effort: spec, plugin, rest, tests, regenerated spec artefacts, dogfood payload pin. Disclosure: writers already learn the kind from the RECORD_LOCKED sentence (record_locked with the line label and title vs record_locked_untitled with the master label), so nothing new for them; read-only line readers with no request visibility learn one new bit. No request content is disclosed.",
            "B: plugin-grid hides Delete on every locked row of an object with a master_detail field. No ruled text and no contract change, small effort. It over-hides Delete on a self-held line of an unheld master (which the server accepts) and copies the server's delete rule into the client. It is serial behind PR #37128 (same files: objectGridActionsColumn.tsx, ObjectGrid.tsx).",
            "C: land the parity fix as it is now, and take A or B on a follow-up card. No regression: today the grid offers Edit and Delete on master-held lines and both are refused; after the fix it offers only Delete."
          ],
          "recommendation": "A, ruled and then done in a follow-up commit or card, because the server's own judgement carries the distinction from one source. The only new disclosure is one bit to read-only line readers. B over-hides and duplicates a server rule. Parity can land first under C without regression. If the question stays on #37041, change the PR's closing line to Part of #37041."
        }
      ],
      "security_findings": "none",
      "out_of_scope_findings": []
    }
  8. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#3 · os-support-ai · session_01WGufzeiHatzB4rRx1t4Php

    Close-out · 2026-11-25T01:53Z

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

Metadata

Metadata

Assignees

Labels

area:workflowbugdomain:serverpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions