Skip to content

专题:单据锁定(对象声明审批、付款、关账等状态后,单据和主从明细不能再增删改)(ADR 先行) #36253

Todo
1 of 9 issues completed

Description

@objectstack-fleet

security#2 · sunhaolin · session_017xRBcW9L8Noz9BxEwjwiov

Feature, ADR first. Maintainer ruling 2026-11-22, option C (record 7073676422 on #32004; analysed by an isolated contract-tier thread).

Rule. An object declares the states in which it and its master_detail lines refuse add, edit, remove and move: for example approved, paid, closed. Approval, payment and closing only set the state. A record leaves the closed state only through a sanctioned action that moves it back. The runtime refuses changes to a closed record and its lines at every door, with one loud refusal.

Why. Today the platform unlocks a record when its approval is decided, as content/docs/automation/approvals.mdx documents. Apps that need a decided document frozen hand-code it:

Removing a line cannot be guarded without code. Seat ruling 6281609466 on #24684 required "a named producer beyond this showcase" before a declarative state lock; that condition is now met. Mainstream ERP modelling is state-driven immutability, with child rows included.

The ADR settles:

  • the key's shape on the object;
  • the unit (the record plus its master-detail lines, the same unit the pending approval lock already uses);
  • exemptions (system writes, the record's own delete) and whether a closed document may be deleted;
  • one lock read for both producers (the pending approval lock and the declared closed states).

Then build cards. Convert the showcase's paid-invoice hooks to the declaration as the proof.

Not this card: the pending-window line lock. It is already on main (#35755), and #36135 lands with it.

Re-check: git grep -n "the record unlocks" origin/main -- content/docs/automation/approvals.mdx shows today's decided-state behaviour.

Sub-issues

Sub-issues

1 of 9 Issues completed
Loading 9 sub-issues

Activity

  1. objectstack-fleet commented on Nov 22, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in domain:spec (ADR first, then build cards) · pm:queue; rationale: area:data (records refuse change at every door) · Feature · an object declares the states (approved, paid, closed) in which it and its master-detail lines refuse add, edit, remove and move, and a record leaves them only through a sanctioned action. Maintainer ruling option C, 2026-11-22 (7073676422 on #32004); it replaces hand-coded guard hooks such as the showcase paid-invoice hooks (#24731) → p2 (maintainer-ruled feature) · size L.

  2. added
    domain:spec
    pm:queue
    priority:p2
    on Nov 22, 2026
  3. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Claim: PM loop round 1 · 2026-11-26T14:17Z
    Session: session_01L6bhgV6i8jfWwSXjpWJrjA
    Thread session: session_01L6bhgWPwjheYqchuPwxH8t
    Account: os-sales
    Branch: claude/project-thread-lotnpd
    Area: s2-data
    Domain: domain:spec
    Seat: repo:objectstack#2
    File surface: docs/adr/0162-<slug>.md (new; 0162 is main's next free number, unclaimed in open PR titles) and docs/adr/README.md (regenerated by pnpm adr:index). No packages, content/docs or skills.
    Container & model: M, mode:thread, model: CONTRACT_REVIEW_TIER — dispatch-gates --tier: "Model tier — MANDATORY" (docs/adr/**, no one-line exit), effort: xhigh (reason: an ADR authored alone — File surface is docs/adr/** only; the build cards that follow run at high)
    Clause-②: no
    Metadata-protocol: none
    Relation: the ADR PR says Part of #36253; the card stays open for the build cards the ADR names (the new declaration key is declared by those cards, not this PR).
    Responsibility: objectstack platform spec (no declaration lets an object state when a document and its master-detail lines are closed to change; approvals unlock on decision, and the showcase guards paid-invoice lines with app hooks) | none | app builders modelling invoices, orders and other documents that must freeze once closed; reachable today
    Thread-read: none
    Premise: holds (thread's read on origin/main 6c290d3: ruling 7073676422 on #32004 (② C) stands verbatim; approvals.mdx :908 and :964 still say "the record unlocks"; the showcase paid-invoice line guards are in examples/app-showcase/src/data/hooks/index.ts (#24731); seat ruling 6281609466 on #24684 stands; the in-approval line lock is on main (bindDetailRowLockHook, #36135 merged 11-22); no closed-state key exists in spec. Not checkable here: the card's "a hosted app's edit guards", cited as the card states it)
    Serial constraints cleared: ADR number 0162 free on main and in open PR titles; the thread re-runs overlap-check before its first push
    Tier: H (docs/adr/**); L2 owed at CONTRACT_REVIEW_TIER by an agent other than the drafter

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

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgWPwjheYqchuPwxH8t
    os-dev-report

    {
      "issue": 36253,
      "status": "done",
      "branch": "claude/project-thread-lotnpd",
      "pr": "https://github.com/objectstack-ai/objectstack/pull/37606",
      "session": "session_01L6bhgWPwjheYqchuPwxH8t",
      "premise_still_valid": true,
      "summary": "The card's ADR-first step is delivered as draft PR 37606 at head 9b848ed32b: docs/adr/0162 (status Proposed) plus the regenerated docs/adr/README.md. The record answers the four things the card asks: the key (an object-level closedStates map, read off the stored row), the unit (the record and its direct master_detail lines), the exemptions and delete, and one lock read for both producers. Four points go past the ruling's words and are marked in the text with the other reading beside each: a system context is not bound at all; a caller cannot delete a closed record; the lock is judged on the stored row, so the closing write lands whole; the lock read moves to the data layer and gains a reason. The build half has not started and starts only after acceptance. Tier H: the PR stays a draft; L2 at the contract tier with design judgement is owed by an agent other than the drafter.",
      "tests": "none: the diff is two Markdown files under docs/adr/",
      "gates": "Local: dispatch-gates --commands derived 21 commands; all 21 ran, each exit 0, exit codes captured before any pipe (list in the PR body); dispatch-gates --ran: 21 derived, 21 run, 0 NOT-MEASURED, 0 UNRUN. overlap-check before the first push: exit 0, clean against origin/main, no open PR shares a file. CI on head 9b848ed32b, read once after the PR opened: success: Check Changeset, Check PR Size, Governed Surface Queue Guard, Check Documentation Links, PR-body guards, filter; in_progress: the Lint families, the Type Check families, Plan Test Core shards, Dogfood Regression Gate, Test UI, Auto Label; the rest skipped by path.",
      "dogfood_battery": "n/a: no `!` in the PR title and no (narrowing) arm",
      "mcp_calls": "11: read tools only (issue_read 8, pull_request_read 3)",
      "api_writes": "2 relay strokes: pr_create (POST /repos/objectstack-ai/objectstack/pulls, POST /issues/37606/assignees, POST /issues/37606/labels) and this report (POST /issues/36253/comments)",
      "deviations": [
        "One derived gate (check:doc-formula-expressions) needed @objectstack/formula and @objectstack/lint built first; that turbo build ran without the shared verify lock. No other heavy command ran.",
        "The record's premise item 'a hosted app's edit guards' was not checked: that code is outside this repository. The record cites it only as the card states it; the claim's Premise line already says so."
      ],
      "open_questions": [],
      "security_findings": "withheld",
      "out_of_scope_findings": [
        "carrier: PR 37606, the record's Execution section · noted, not filed · the approval status mirror is written after the request is finalised and a failure of that write is logged and swallowed; the engine build card measures it where the mirrored value is a declared closed state",
        "carrier: PR 37606, the record's Execution section · noted, not filed · whether a customization overlay may add or shorten the declaration is left to the spec build card"
      ]
    }

    Generated by Claude Code

  6. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Ruled: the maintainer (Sales) answered the ADR-0162 decision card at 18:39Z (stamp 2026-11-26T18:40Z) with "all as recommended", covering the four points the ADR marks (▲1–▲4) and the three open points of the second contract review on PR #37606. The PR thread applies them in one push to #37606, then a delta contract review runs before the Tier H hand-off. Build cards are filed after the ADR is Accepted.

  7. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Ruled · 2026-11-26T19:16Z: after the third contract review of PR #37606 (record 7201298747, S9), the maintainer (Sales) answered a follow-up card on point 7 (a new approval round on a closed record) with 「平台堵住:撤回不恢复关闭值」 — keep the new-round way out, and the platform rule is that a recall never writes the state field back to a value in the closed set. This adds to the 18:39Z ruling (7200732942, 「全部按推荐」). The approvals-plugin change goes to the build cards.

  8. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Ruling text of record · 2026-11-26T20:02Z (adds to 7200732942 and 7201405662; closes review N13 of PR #37606, record 7201298747)

    The maintainer's answer recorded in 7200732942 was, in its original language, 「全部按推荐」 ("all as recommended", 2026-11-26 18:39Z). The recommendations it adopted, as put to the maintainer:

    • ▲1 The system identity is not bound by the closed-state lock; users and admins are. The author docs must state that an action body runs as system, so any action that edits the record still takes effect on a closed one unless its own body checks the state.
    • ▲2 A closed record cannot be deleted by any user, whatever their delete permission; a pending (not closed) record deletes as today.
    • ▲3 Item ③ of the 11-22 ruling applies to readonlyWhen field locks only; the record lock judges the stored state at write time.
    • ▲4 A new data-layer "is it locked" read; the approvals lock read stays as published. A card to retire or redirect the approvals read is filed with the build cards.
    • 5 Every caller who can read the record is told locked and the reason; the ADR states the one bit of the state field this discloses and why.
    • 10 A cascade delete is judged as a whole before its first write; its refusal names only the record the user asked to delete (by the title served to that user) and the blocking object's type label, stated as an explicit exception.
    • 7 A new approval round stays a way out of a closed state, with the submitter's own recall spelled out. Refined at 19:16Z by 7201405662: 「平台堵住:撤回不恢复关闭值」 — the option read 「ADR 加一条:撤回永远不把状态写回关闭值」 ("the ADR adds a rule: a recall never writes the state back to a closed value").
    • 6, 8, 9, 11 and the consequences listed (no grace period on publish; mirror write-back failure gets its own child card; overlay add/shorten of closed states verified by the spec card; change of owner refused on a closed record) take effect as the ADR writes them.
  9. objectstack-fleet commented on Nov 26, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    Ruled · 2026-11-26T23:51Z (adds to 7200732942 and 7201405662; closes the ▲ point left open in PR #37606 after review record 7203817706, S14)

    The maintainer (Sales) answered the decision card 「多步审批中途撤回后单据可能停在"已批准"并锁住,平台要拒绝这种配置吗?」 ("after a multi-step approval is recalled midway the record may stay 'approved' and locked — should the platform refuse this setup?") with the option 「平台拒绝这种配置」 ("the platform refuses this setup"). The option read: 「字段声明了关闭值、却缺少"审批中"状态或退回路径时,发布或开审批时直接报错;作者补上选项才能用,单据不会假装已批准。」 ("when the field declares closed values but lacks an in-flight status or a path back, it errors at publish or when the approval opens; the author adds the options before it can be used, and the record never pretends to be approved.") The other option, 「只在文档里教作者避开」 ("only teach authors to avoid it in the docs"), was not chosen.

    Effect on ADR-0162: the opening conditions in D5 are the platform's rule, not guidance; every ▲ wording becomes this record. The build cards carry the authoring-lint and request-open refusal.

  10. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

    ADR half landed · this card becomes the tracking parent of the build · 2026-11-27T01:54Z

    The "ADR first" half of this card has landed. ADR-0162 is on main from PR #37606 (Part of, merge 972114df), after eleven contract-review rounds; the last is 7206423099 (PASS). The maintainer's rulings it carries are 7200732942 (text 7202242844), 7201405662 and 7205949718.

    The build is the ADR's Execution plan. One card per item, each a sub-issue of this card:

    Item Card Order
    7 · approvals: the open check and the mirror on an abandoned request #37766 slice A first, alone on main; B and C on the trunk
    8 · status mirror: failed write, run ending between steps, decision that cannot resume #37767 design note first; build on the trunk
    1 · the closedStates key and its enforcement #37768 on one trunk branch with items 7 B/C, 8 and 3; the key ships only with them
    3 · showcase conversion (the runtime proof) #37771 Blocked-by: #37768; on the trunk if the liveness gate wants the proof in the key's release
    2 · one lock read owned by the data layer #37770 Blocked-by: #37768
    4 · console #37773 Blocked-by: #37770
    5 · docs #37772 Blocked-by: #37768
    6 · decide the approvals-family lock read #37774 Blocked-by: #37770, #37773

    Items 1, 7 and 8 are size L and are split along the slices their bodies name before dispatch. The release rule of ADR-0162: the key is never published without its enforcement and without items 7 and 8.

    Still to file when their time comes: the skills/** follow-up that teaches the key (named by item 1's PR), and the card that turns ADR-0162's status line to Accepted — implemented once the build has landed.

    This card is not dispatched. It closes when items 1–5, 7 and 8 have merged, item 6 is ruled, and the status-line card is filed.

    State: the skill puts a tracking parent in no pm state (seat-lifecycle.md), but label-write.mjs refuses an open card with no state, so this parent waits in pm:blocked on its build cards. The gap is filed separately.
    Blocked-by: #37768, #37766, #37767, #37770, #37771, #37772, #37773, #37774

  11. added
    pm:blocked
    tracking
    and removed
    pm:dispatched
    on Nov 27, 2026
  12. changed the title [-]An object declares the states in which a document and its master-detail lines are closed to change (ADR first)[/-] [+]专题:单据锁定(对象声明审批、付款、关账等状态后,单据和主从明细不能再增删改)(ADR 先行)[/+] on Nov 28, 2026
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:datadomain:specpm:blockedpriority:p2tracking

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions