Skip to content

demoStaff spells the legal head and finance controller names as literals that keys.ts mirrors; a rename silently drops seeded reviews - #192

Merged
zhuangjianguo merged 2 commits into
mainfrom
claude/issue-191-staff-names
Oct 27, 2026
Merged

zhuangjianguo merged 2 commits into
mainfrom
claude/issue-191-staff-names

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #191

Clause-②: no
Metadata-protocol: none

demoStaff in objectstack.config.ts spelled the Head of Legal and the Finance Controller as literals, while src/data/keys.ts copied the same strings as LEGAL_HEAD and FINANCE_CONTROLLER for reviewerOf(). clm_review.reviewer is required, so if one side was renamed, every review dealt to that account would be dropped and the seed would still report success. Both entries now take their name from the keys.ts constants, the same way the requesters (CONTRACT_OWNERS) and the counsel (LEGAL_OWNERS) already do.

What changed

One file, objectstack.config.ts:

  • It imports LEGAL_HEAD and FINANCE_CONTROLLER from ./src/data/keys.js, and the two demoStaff entries use them as name. Emails and positions are unchanged.
  • The demoStaff comment now lists every account the fixture deals rows to by name (requesters, counsel, head of legal, finance controller) and says why reviewer makes a drift lose rows instead of landing NULL. The old sentence "The fixture names none of them" stopped being true with Seeded reviews name the Dev Admin as reviewer instead of the legal staff #189, and it now covers only the remaining four positions.

The resolved names are byte-identical to before (Head of Legal, Finance Controller), so the seeded data does not change.

Reverse check: rename the keys.ts constant

The fix is committed (e24c3bf). Then a script with a trap restore did three things: it changed LEGAL_HEAD to 'General Counsel' and FINANCE_CONTROLLER to 'Group Controller' in src/data/keys.ts (on disk: 1 hit for each new string, 0 for the old ones), compiled the stack with tsc, and loaded it with CLM_DEMO_SEED=1. The two legs were run against the same renamed keys.ts:

LEG A (this branch's config):  legalHeadStaff "General Counsel", financeStaff "Group Controller",
                               reviews 60, reviewersNotDeclaredStaff 0
LEG B (origin/main 494fb35):   legalHeadStaff "Head of Legal",   financeStaff "Finance Controller",
                               reviews 60, reviewersNotDeclaredStaff 24
RESTORED: blob hashes match HEAD; git diff HEAD lines: 0
LEG C (restored tree):         "Head of Legal" / "Finance Controller", reviewersNotDeclaredStaff 0

On main, the rename leaves 24 reviews (8 head of legal + 16 finance) naming an account demoStaff never creates, which are the rows the loader would refuse. On this branch both sides move together.

Live readings: pnpm demo:zh, port 3161, @objectstack 18.2.0, throwaway DB

Both runs started from an empty .objectstack/data. The before run used a detached worktree at origin/main 494fb35, and the after run used this branch at e24c3bf. Reviews were read as admin@ with GET /api/v1/data/clm_review and resolved against sys_user.

before (494fb35) after (e24c3bf)
clm_review total 60 60
naming Dev Admin 0 0
counsel1@ / counsel2@ 16 / 18 16 / 18
legal.head@ 8 8
finance@ 16 16
requester2@ / requester3@ 1 / 1 1 / 1

Browser: Chromium /opt/pw-browsers/chromium, locale zh-CN. For each persona I filled the /_console/ sign-in form with password admin123 and then read data as that persona:

  • legal.head@example.com: POST /api/v1/auth/sign-in/email returned 200 and landed on 法务工作台 › 待受理 (clm_contract/view/legal_intake, 6 条记录). The session user is Head of Legal and html lang is zh-CN. 60 reviews are visible, and 8 name this account (Legal · Head of Legal, Finance · Head of Legal, ...). Before and after are the same.
  • finance@example.com: sign-in returned 200 and landed on clm_payment_plan/view/all_payment_plans. The session user is Finance Controller. 50 reviews are visible, and 16 name this account (Finance · Finance Controller). Before and after are the same.
  • Responses with status 400 or above: only 401 GET /api/v1/auth/get-session on the login page, before sign-in.

Gates (head e24c3bf, each exit code captured before any pipe)

  • pnpm install: exit 0
  • pnpm validate: exit 0 (✓ Validation passed)
  • pnpm lint: exit 0 (0 warnings, 6 suggestion(s), same as main)
  • pnpm typecheck: exit 0
  • pnpm lint:i18n-gate: exit 0 (COVERAGE : 0 missing keys across 2 locale(s))
  • CLM_DEMO_SEED=1 pnpm validate: exit 0 (✓ Validation passed)

Acceptance notes

  • The JSDoc above LEGAL_HEAD / FINANCE_CONTROLLER in src/data/keys.ts still says objectstack.config.ts "spells them as literals rather than from here". After this PR that sentence is false. The claim's file surface allows keys.ts only for a missing export, so I did not touch it. The report proposes the replacement text for the seat.

🤖 Generated with Claude Code

https://claude.ai/code/session_017nzWFRUo2U7evMkPdVniAn

…from keys.ts

demoStaff spelled 'Head of Legal' and 'Finance Controller' as literals while
src/data/keys.ts mirrored them as LEGAL_HEAD / FINANCE_CONTROLLER for
reviewerOf(). clm_review.reviewer is required, so renaming one side dropped
every review dealt to that account and the seed still reported success. Both
entries now take their name from the same constant the fixture deals by, as
the requesters and counsel already do.

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 b8b4342 · 2026-10-27T13:24Z

check reading
shape draft → main, Fixes #191; mergeable clean
CI on the head both Validate check-runs success on b8b4342 = PR head.sha
scope 2 files. objectstack.config.ts takes the legal head's and the finance controller's demoStaff names from src/data/keys.ts (as it already does for CONTRACT_OWNERS / LEGAL_OWNERS), and its comment lists every account the fixture deals to by name. The seat added one comment-only commit (b8b4342, seat call A on the dev's open question): the keys.ts JSDoc no longer claims the config spells them as literals. The resolved strings are unchanged. Nothing governed
reverse check with both constants renamed in keys.ts, this branch's config follows (60 reviews, 0 dealt to an undeclared account), while main's config leaves 24 reviews naming accounts nobody carries. Restored to HEAD, with the blob hashes matching
live before and after are identical: 60 reviews, 0 naming the Dev Admin, and the same per-account deal. legal.head@ and finance@ sign in (zh-CN) and see their own reviews

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 13:24
@zhuangjianguo
zhuangjianguo merged commit 7e7c2dc into main Oct 27, 2026
2 checks passed
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.

demoStaff spells the legal head and finance controller names as literals that keys.ts mirrors; a rename silently drops seeded reviews

2 participants