Skip to content

feat(demo): pnpm demo:staff adds a Finance Controller and an Accounts Receivable user - #2823

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-2821-demo-finance-users
Nov 27, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-2821-demo-finance-users

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Irene · project thread

Fixes #2821

Clause-②: no
Metadata-protocol: none
Metadata-impact: reviewer — no registered metadata changes. src/sales/sharing/demo-staffing.ts is the dev-only table pnpm demo:staff reads; the artifact never imports it (test/demo-staffing.test.ts pins that no staffing email reaches the manifest). No permission set, position or sharing rule is touched.

维护者速读

  • 用户无感:只在本地演示环境里,运行演示人员脚本后多出两个财务账号(财务总监、应收会计),可直接登录演示开票与收款。
  • 为什么做:Irene 要求演示用户里加财务,订单到收款(发票、收款、客户应收数)以前只能用管理员演示。
  • 出错会怎样:只影响本地演示环境,脚本自检会直接报红;不进发布包,客户环境不受影响,可直接撤回。
  • 要你做什么:无。

What changes

  • Two rows in the demo staffing table (src/sales/sharing/demo-staffing.ts): finance.controller@objectos.ai (Farah Lindqvist, position crm_finance_controller → set finance_controller) and ar.accountant@objectos.ai (Arjun Mehta, position crm_ar_accountant → set ar_accountant), password demo1234 like the others. The five existing rows are byte-for-byte unchanged.
  • Ownership decision: neither finance user owns any seeded record. Finance does not own the routed book: TERRITORY_OWNER and CASE_DESK name neither key, and the run's ownership census shows 0 for both on every routed object.
  • The table's guard (Authorization gaps: forecast, knowledge article and all three detail objects have no profile grants #488 / Nobody holds any position on a fresh install, so every position-based sharing rule and both approval flows resolve to an empty recipient set #640) holds: both positions are declared and each declares a shipped permission set, so the "only names positions the app declares" and "every staffed position ... declares a permission set" tests cover them unchanged. The header and the leadership-bench failure text now record these two as a separate crossing, on the maintainer's ask of 2026-11-27, and say it sets no precedent for the six unstaffed leadership positions.
  • New optional mustRead field on a row: the objects that persona must read at least one row of. scripts/demo-staff.ts step 5 signs in as each persona and fails the run when one answers empty or denied. Both finance rows list crm_invoice and crm_payment.
  • The ownership census widens its columns to the longest handle (finance.controller ran into the neighbouring column at width 16).
  • docs/MAINTENANCE.md §4.1 lists the two users and what they show. It is the only doc that lists the demo users: README / README.zh-CN say "the demo team" with no names or counts, so they and their bold figures are unchanged, and no content/docs or src/**/docs page lists the users. docs/MAINTENANCE.md has no zh twin.
  • Changeset: empty frontmatter (dev tooling only, nothing ships to users).

Tests

test/demo-staffing.test.ts gets a new block, the finance personas read the Order to Cash surfaces. It runs after the script has staffed the shipped app (@objectstack/verify):

  • each finance position has exactly one holder, a different person each, who holds only that position and lists invoices and payments in mustRead;
  • neither key is an ownership route target;
  • each finance persona reads, over REST, the same set of crm_invoice / crm_payment ids as the dev admin (and the admin's set must be non-empty);
  • each reads invoiced_amount / received_amount / receivable_balance on every account it reads (against a dev-admin reading that must be non-empty).

Ablation: I set the controller's position to crm_project_member on disk and ran the block. 4 of its 5 tests went red (the ownership-route test, which does not read the position, stayed green), including "reads accounts without invoiced_amount / received_amount / receivable_balance: expected +0 to be 9". I then restored the file.

Acceptance notes

  • The finance controller reads invoices and payments through controlled_by_parent on its every-record contract read (its set grants viewAllRecords: false on the two objects). It sees all 6 invoices and 5 payments.
  • I booted the app for real (pnpm dev, fresh .objectstack/data) and ran pnpm demo:staff: exit 0. Output excerpt:
pnpm demo:staff, fresh database
➕ finance.controller@objectos.ai +[crm_finance_controller]
➕ ar.accountant@objectos.ai  +[crm_ar_accountant]
   finance.controller@objectos.ai sees 9 account(s): ...
     crm_invoice: 6 row(s)
     crm_payment: 5 row(s)
   ar.accountant@objectos.ai sees 9 account(s): ...
     crm_invoice: 6 row(s)
     crm_payment: 5 row(s)
   crm_opportunity  routed 23 ... finance.controller 0  ar.accountant 0
🎉 demo org staffed.

Signed in as each over REST (POST /api/v1/auth/sign-in/email 200), crm_account query returns invoiced_amount / received_amount / receivable_balance (Initech Solutions: 60000 / 39000 / 21000).

Verification

Files to read first, by risk:

  1. test/demo-staffing.test.ts: the new finance block and the reworded bench failure text.
  2. scripts/demo-staff.ts: the mustRead loop in verify().
  3. src/sales/sharing/demo-staffing.ts: the two rows and the header paragraph.

Two-minute check: pnpm exec vitest run test/demo-staffing.test.ts. Expect 38 passed, including the five tests under "the finance personas read the Order to Cash surfaces (hotcrm#2821)".

Local gate readings

On ae99ba7a: pnpm validate exit 0 (Validation passed), pnpm typecheck exit 0, pnpm lint exit 0, pnpm hygiene exit 0, pnpm test exit 0: Test Files 340 passed (340), Tests 6518 passed, 58 skipped (6576). The final head adds only the census column width in scripts/demo-staff.ts. On that head I re-ran validate, typecheck, lint, hygiene and test/demo-staffing.test.ts, which runs the script; see the report for those readings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01J8VVAk8tegvAi1ECkgCFfc

@vercel

vercel Bot commented Nov 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
hotcrm Ignored Ignored Nov 27, 2026 2:56am UTC

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation ci/cd CI plumbing and the verification pipeline metadata Declarative metadata — schema, security posture, UI surfaces labels Nov 27, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:hotcrm#1 · huangyiirene · session_01J8VVAk8tegvAi1ECkgCFfc

ACCEPT · 2026-11-27T03:10Z

Head-sha: a817776e

维护者速读

  • 改了什么:pnpm demo:staff 多建两个演示账号:财务主管 finance.controller@objectos.ai、应收会计 ar.accountant@objectos.ai,密码 demo1234。两人都能看到发票、回款和客户的财务数字,不拥有任何演示数据。原来 5 个账号不变。
  • 要你做什么:无。按您「做完的,没有问题的都自动合并」,席位合并。

席位核对

  • Form: Fixes #2821 on line 4 after the two attribution lines; draft → ready to main. Files: the five on the claim's surface only (staffing table, script, test, MAINTENANCE.md, changeset).
  • Diff read: two rows with positions crm_finance_controller / crm_ar_accountant (each declares its permission set, so the Authorization gaps: forecast, knowledge article and all three detail objects have no profile grants #488 guard holds); new optional mustRead makes the script's self-check sign in as the persona and require rows from crm_invoice and crm_payment. Existing rows untouched.
  • Changeset: empty frontmatter — dev tooling, not in the published app; the sentence matches the diff. Check Changeset success.
  • Gates: all 19 check-runs on a817776e completed success; local validate/typecheck/lint/hygiene exit 0; demo-staffing test 38/38 with an ablation (position swapped → 4 red); full suite 6518 passed on ae99ba7a (final head differs by one console column width); live pnpm demo:staff on a fresh DB exit 0, both personas see 9 accounts, 6 invoices, 5 payments.
  • Noted, not filed: the first commit's trailer names the model per the harness attribution line — no history rewrite.
  • Landing: seat lands on the maintainer's standing word 「做完的,没有问题的都自动合并」 (2026-11-26T10:39Z).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 27, 2026 03:10
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit a06398b Nov 27, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI plumbing and the verification pipeline documentation Improvements or additions to documentation metadata Declarative metadata — schema, security posture, UI surfaces

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Demo staff: add a Finance Controller and an Accounts Receivable user to pnpm demo:staff

2 participants