Skip to content

pnpm demo creates its demo staff, so every persona opens 我的合同 out of the box - #171

Merged
zhuangjianguo merged 1 commit into
mainfrom
claude/issue-28-demo-staff
Oct 27, 2026
Merged

zhuangjianguo merged 1 commit into
mainfrom
claude/issue-28-demo-staff

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #28

Ruling-ref: 6396320437 (letter D: the platform creates the demo accounts, hotclm declares them). Platform side: objectstack-ai/objectstack#25777, shipped in 18.2.0 as f00e8d5.

What changed

  • objectstack.config.ts declares demoStaff, eleven accounts, gated on CLM_DEMO_SEED like data (so pnpm dev stays empty of people too):
    • Business Requester 1/2/3 (requester1..3@example.com), no position, because every member holds clm_requester (isDefault). The names come from CONTRACT_OWNERS, the constant the fixture deals owner_id by.
    • Legal Counsel 1/2 (counsel1/2@example.com), position clm_legal_counsel. The names come from LEGAL_OWNERS.
    • One account for each other position: Head of Legal, Finance Controller, Executive, General Manager, Records Manager, CLM Administrator.
    • No password: the platform refuses that key. Every account signs in with the dev seed password (admin123, or OS_SEED_ADMIN_PASSWORD).
    • No sys_user row goes into any fixture, and os build drops the key from the artifact. §10 「用户不可种子」 still holds.
  • scripts/demo.mjs drops the closing operator note and what fed it: the roster read, the port and banner timing, and the persona name mirrors. The two-boot priming step for the dev admin stays as it was.
  • README replaces "Users are not seeded — create them…" with "The demo staff — created for you". The new section gives each account's name, sign-in address and position, what it holds, the shared password, and where the accounts exist (local dev only, demo only, once). Rung 1 still says to set each requester's manager by hand, and now says why: a demoStaff entry cannot carry a manager.

Measurements (18.2.0, port 3149, fresh DB, Chromium zh-CN, each reading signed in as the persona)

Before: origin/main 2cbcb8b, pnpm demo.

  • One account exists (Dev Admin). It owns all 120 contracts (claimed) and opens 我的合同 › 我发起的 with all 120.
  • legal_owner is NULL on all 120 contracts.
  • The log carries 404 ERROR [SeedLoader] Deferred reference UNRESOLVED: 120 owner_id, 68 legal_owner, 199 clm_obligation.owner and 17 decided_by. On top of those come 20 WARN [Seeder] ✗ lines and the summary WARN … 404 dropped record(s) and 404 error(s).

After: this branch, pnpm demo and pnpm demo:zh, each on its own fresh DB, with no manual step.

  • 12 accounts: Dev Admin plus the 11 demo staff. There are 8 sys_user_position rows, all in the org.
  • Ownership resolves:
    • owner_id: 43 / 43 / 34
    • legal_owner: 34 / 34, with 52 NULL by design
    • clm_obligation.owner: 50 / 53 / 40 / 29 / 27, with 1 NULL by design
    • decided_by: 10 / 7, with 8 open
  • In the browser, every account signs in with admin123 and gets no change-password prompt:
Account Lands on Readings
Business Requester 1 / 2 / 3 我的合同 › 我发起的 43 / 43 / 34 contracts · 我负责的履约 23 / 26 / 18 open obligations
Legal Counsel 1 / 2 法务工作台 (待受理) 我的审查 34 / 34
Head of Legal 法务工作台 全部合同 120
Finance Controller 财务 › 收付款计划 300 · 生效合同 60
Records Manager 执行与档案 › 待执行 6 · 待归档 7 · 合同台账 82
CLM Administrator 管理 › 审批矩阵
Executive, General Manager 我的合同 (+ 分析)

pnpm demo:zh gave the same counts: requester 1 43 / 23, counsel 1 34, finance 60, records 6.

  • Idempotency. A second pnpm demo and a second pnpm demo:zh on the same DB still showed 12 accounts and 8 positions, with no duplicates and no WARN or ERROR beyond the plugin-superseded line. Managers set before the re-run were kept.
  • Boot WARN/ERROR lines. Each first run printed 0 ERROR and 2 WARN. Both WARNs are informational and also appear on main: Plugin superseded and Inline seed exceeded 8000ms budget. Both builds print the same 6 author-time compile warnings and the same hierarchy-security capability line. No PROVISIONAL line appeared.
  • pnpm dev, fresh DB. One account (Dev Admin), and no demoStaff line.
  • Console output. The platform's [auth] demoStaff: … created … (admin123) line logs at info, which the default os dev output does not show. The console therefore names neither the accounts nor their password, and README says so.

The manager cannot be declared. DemoStaffSchema takes exactly name, email, position? and permissionSets? (strict). After pnpm demo, manager_id is NULL on all 11 accounts. README's Set Manager step still works on the demo staff: POST /api/v1/auth/admin/set-user-manager answered 200 ×3, and the managers survived the second run. That step is the one manual step left in README.

Gates (head b14b3cc; each exit code captured before any pipe)

  • pnpm install exited 0.
  • pnpm validate exited 0: ✓ Validation passed.
  • pnpm lint exited 0: 6 suggestion(s), 0 warnings, the same as main's config measured on this tree.
  • pnpm typecheck exited 0.
  • pnpm lint:i18n-gate exited 0: COVERAGE : 0 missing keys across 2 locale(s).
  • CLM_DEMO_SEED=1 pnpm validate exited 0.

Reverse check: changing one position to 'clm_nope' made CLM_DEMO_SEED=1 pnpm validate exit 1 with ✗ Demo account 'Head of Legal' (stack.demoStaff[5]) is assigned position 'clm_nope', which this stack does not declare. Plain pnpm validate still exited 0, which shows the gate works. The change was restored from HEAD and git diff HEAD came back empty.

Acceptance notes

🤖 Generated with Claude Code

https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn

…counts

The platform's `demoStaff` (@objectstack 18.2.0, objectstack#25777) creates
the accounts an application declares on a local development boot, after the
dev admin and before the seed runs. Ruling D on #28: the platform creates
the demo accounts, the app only declares them.

- objectstack.config.ts declares eleven demo accounts, gated on
  CLM_DEMO_SEED like the dataset: the three business requesters and two
  legal counsel by the same constants the fixture deals rows by, and one
  account for each of the other six positions. No password (the platform
  refuses one), no sys_user row in any fixture.
- scripts/demo.mjs drops the closing operator note and the roster read
  behind it: no account is left for the operator to create.
- README replaces the hand-made-accounts section with the declared staff,
  their sign-in addresses and the shared dev seed password. Setting a
  requester's manager stays a manual step: a demoStaff entry cannot carry
  one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

席位核对 — ACCEPT · head b14b3cc · 2026-10-27T10:27Z

check reading
shape draft → main, Fixes #28; mergeable clean
CI on the head both Validate check-runs success on b14b3cc = PR head.sha
scope 3 files: objectstack.config.ts (demoStaff, gated on CLM_DEMO_SEED like data), scripts/demo.mjs (operator note and roster read removed, −386), README.md (declared staff in place of the hand-made-accounts section). Within the claim's surface. Nothing governed; lint 0 warnings
the ruling 6396320437 letter D — delivered on 18.2.0's demoStaff (objectstack#25777). Each of the 11 accounts was measured on a fresh pnpm demo and pnpm demo:zh with no manual step: requesters see 43 / 43 / 34 contracts, counsel 34 / 34 reviews, and finance, records, the head of legal and the admin each land on their workbench. Seed references that went unresolved before (404 ERROR lines) now resolve: 0 ERROR. A second run is idempotent: 12 accounts, 8 positions, and hand-set managers are kept
§10 「用户不可种子」 holds: no sys_user row in data; os build drops the key; pnpm dev stays empty
names requesters and counsel come from the same keys.ts constants the fixture deals rows by, so they cannot drift. No password is committed (the platform refuses the key)
residual demoStaff cannot carry a line manager (measured: manager_id NULL ×11), so README keeps Set Manager for that one step. Filed upstream by the seat

Landing: under the maintainer's merge authorization (project thread: 「你可以自己审核的就自己合并」).


Generated by Claude Code

@zhuangjianguo
zhuangjianguo marked this pull request as ready for review October 27, 2026 10:27
@zhuangjianguo
zhuangjianguo merged commit 0159171 into main Oct 27, 2026
2 checks passed
zhuangjianguo pushed a commit that referenced this pull request Oct 27, 2026
…e platform (#28, PR #171)

Ruling 6396320437 (D).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Decision] pnpm demo 开箱即用时没有任何账号能打开「我的合同」——要不要让脚本建账号,与 #11 第一问耦合

2 participants