Skip to content

Showcase: replace the three paid-invoice line guards with a closedStates declaration, as the runtime proof (ADR-0162 item 3) #37771

Backlog

Description

@objectstack-fleet

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Filing gate: ③ maintainer-directed · Source: ADR-0162 Execution item 3 (accepted by merge 972114d)

维护者速读

  • 做什么:把示例应用里「已付款发票不能动明细」的三段手写代码删掉,换成发票对象上的一行声明,并把前后对比跑一遍记下来。
  • 用户会看到什么:示例应用里已付款的发票,表头也不能再改、整张不能删、明细行任何字段都不能改;这三处是新增的拒绝,是设计本意。
  • 不做会怎样:新能力没有一个真实应用证明它能替代手写代码,其他应用也没有可以照抄的样例。
  • 顺序:排在声明和执行那张卡之后,最好和它同一次发布,作为运行证明。

What happens

The showcase guards a paid invoice's lines with three hand-written hooks in examples/app-showcase/src/data/hooks/index.ts, with their own refusal sentences (PAID_INVOICE_LINE_ADD_REFUSAL, PAID_INVOICE_LINE_REMOVE_REFUSAL, PAID_INVOICE_LINE_MOVE_REFUSAL). They guard add, remove and move. They do not guard the invoice's header, its delete, or most fields of a line.

Card #36253 asks for this conversion as the proof ("Convert the showcase's paid-invoice hooks to the declaration as the proof"), and ADR-0162 D10 names it as the runtime proof ADR-0054 asks of a new key.

Expected

  • The three hooks and their sentences are deleted. The invoice object declares closedStates on its status for the paid state.
  • The card records, as a dogfood run against the running app, each refusal the hooks gave before and the declaration gives after.
  • It records every outcome that changes by design. ADR-0162 Execution item 3 lists them:
    • a caller's edit of a paid invoice's header is refused, where today every field but the one that carries readonlyWhen lands;
    • a caller's delete of a paid invoice is refused, where today only the button is hidden;
    • a caller's update of a line under a paid invoice is refused whole, where today a change to description, position, service_start or receipt lands, and a write that carries product, quantity or unit_price has those keys stripped and the rest lands;
    • adding, moving and removing a line under a paid invoice stay refused, now with the platform's code and sentence where the app worded three of its own.
  • A seed or import of finished invoices still loads: it runs as system, or creates the invoice open and closes it last.

Done when

  • No paid-invoice guard hook is left in the showcase, and the invoice declares the key.
  • The dogfood record is in the PR: the before and after of each of the four outcomes above, taken from the running app.
  • The showcase's own tests that asserted the three app sentences now assert RECORD_LOCKED.
  • The showcase's seed loads, and its flows still run: none of them uses the approval status mirror on the invoice, and its batch sign-off under a map names no closing field and runs under a parent that carries no record, so the approvals conditions of item 7 refuse none of them. Each is checked, not assumed.
  • The liveness row of the key points at this proof, if the key's own card did not carry one.

Category ③: maintainer-directed. A build card of ADR-0162, child of #36253.
Grade: area:data · Feature · n/a (not a defect) · reach: the showcase app and every author who copies it · evidence: read (the three hooks on main at 972114df)
Suggested-grade: p2 · part of the feature #36253; it is the proof the key's release needs
Size: M (one app: its hooks, one object, its tests and the dogfood record).
Business reason: carried from #36253. The proof that the declaration replaces hand-written guards, and the sample other apps copy.
Reader: seat 2 (repo:objectstack#2), a card thread, effort high; the dogfood run follows the dogfood-verification skill.
Blocked-by: #37768 (item 1). If the liveness gate wants the runtime proof in the same release as the key, this card lands on the same trunk branch before it merges.
Clause-②: no. An example app changes; no published package contract moves.
Metadata-protocol: none
Dedupe: searched closedStates (all issues): 1 hit, #36253 itself.
Related: #36253, PR #37606 (ADR-0162), #24731 (the guards this card removes).

Activity

  1. added
    priority:p2
    pm:blocked
    domain:server
    on Nov 27, 2026
  2. objectstack-fleet commented on Nov 27, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Triage: lands in area:data · domain:server · Feature · priority:p2 · pm:blocked · size S; rationale: closedStates. The showcase replaces three paid-invoice line guards with a declaration. Part of #36253; p2. It keeps its named blocker.

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:serverpm:blockedpriority:p2

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions