You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit b14b3cc
Browse filesBrowse the repository at this point in the historyBrowse files
feat(demo): declare the demo staff so pnpm demo needs no hand-made accounts
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
Copy file name to clipboardExpand all lines: README.md
+71-57Lines changed: 71 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,10 @@ pnpm demo:zh # the same rows, in Chinese
36
36
else's contract book into a fresh deployment. `pnpm demo` is the opposite
37
37
intention — a fictional multi-entity group, six months of negotiation and a
38
38
book of contracts already in force, so every list has something on its first
39
-
screen. Sign in with `admin@objectos.ai` / `admin123`.
39
+
screen. Sign in with `admin@objectos.ai` / `admin123`, or as one of the
40
+
[demo staff](#the-demo-staff--created-for-you) with the same password: a
41
+
business requester such as `requester1@example.com` is an account whose 我的合同
42
+
the demo fills.
40
43
41
44
`pnpm demo` also turns on the platform's scheduled work, which is off by
42
45
default, so the daily reminder sweeps run on the demo book; a deployment that
@@ -74,51 +77,61 @@ rounds, obligations and payment instalments.
74
77
Every date is relative to boot, so ten contracts always expire within the next
75
78
thirty days and the arrears lists are always in arrears.
76
79
77
-
### Users are not seeded — create them, then assign these positions
78
-
79
-
A seed cannot create a user, so `pnpm demo` produces exactly one account. To see
80
-
the permission model of [DESIGN.md](./DESIGN.md) §04 do anything, create
81
-
accounts in **Setup → Users**, assign the seven positions, and give every business
82
-
requester a manager ([below](#rung-1-of-the-approval-ladder-is-a-manager)):
83
-
84
-
| Position | How many | What it changes |
85
-
|---|---|---|
86
-
|`clm_legal_counsel`| 2 | Receives contracts on submission (round-robin by open load) and owns review. **Name these two exactly** — see below |
87
-
|`clm_legal_head`| 1 | Rung 2 of the approval ladder whenever `route_legal_head` is stamped |
88
-
|`clm_finance_controller`| 1 | Rung 2/3, reads every contract with `route_finance`, and the only position that may edit bank details |
89
-
|`clm_executive`| 1 | Rung 4, and reads every contract with `route_executive`|
90
-
|`clm_general_manager`| 1 | Rung 5, and reads every contract with `route_gm`|
91
-
|`clm_records_manager`| 1 | Execution formalities, the executed copy and the archive number |
92
-
|`clm_admin`| 1 | Maintains the configuration objects and holds full reach over every CLM object: the only position that may write `clm_contract_type` and `clm_approval_rule`, and the only one the app's **Administration** group is served to |
93
-
94
-
**Three more accounts are business requesters, which is not a position.**
95
-
Every member of the organization holds `clm_requester` by default
96
-
([DESIGN.md](./DESIGN.md) §04): it is the app's default permission set, bound
97
-
to the platform's `everyone` anchor, so a requester needs no position and no
98
-
grant — creating the account is the whole of it. They launch contracts and see
99
-
their own. The seven positions above hold the same set the same way, on top of
100
-
their own.
101
-
102
-
**Five of the accounts above have to be named exactly**, because the fixture
103
-
references them by name:
104
-
105
-
| Name it exactly | Give it | It receives |
106
-
|---|---|---|
107
-
|`Business Requester 1` · `Business Requester 2` · `Business Requester 3`| nothing — every member already holds `clm_requester`| the 120 contracts' `owner_id`, dealt by counterparty — 43 / 43 / 34 · and the 143 delivery and reporting obligations under them — 50 / 53 / 40 |
108
-
|`Legal Counsel 1` · `Legal Counsel 2`| the `clm_legal_counsel` position | the `legal_owner` of every contract legal has accepted — 34 / 34 · all 56 compliance obligations, by the same counterparty relationship — 29 / 27 · and the `decided_by` of all 17 decided deviations — 10 / 7 |
109
-
110
-
Each requester's **我的合同 › Launched by Me** and **› My Obligations**, and each
111
-
lawyer's **法务工作台 › 审查中** and their own **My Obligations**, fill the moment
112
-
the account exists; a decided deviation's **Decided By** shows its lawyer on the
113
-
contract page's Deviations grid. All four columns are optional references, so
114
-
naming an account that is not there yet costs nothing and no row: it simply
115
-
stays empty.
116
-
Every dataset is an upsert, so **create the accounts and run `pnpm demo` again**
117
-
and their contracts and obligations are handed over. Get a name wrong by one
118
-
character and the column stays empty with no error — that is the one thing to
119
-
double-check in the names.
120
-
121
-
**Do that re-run before the daily jobs have run on the database.** Only a clean
80
+
### The demo staff — created for you
81
+
82
+
The people the demo book is dealt to are declared in `objectstack.config.ts`
83
+
(`demoStaff`), and the platform creates them on the demo boot — after the dev
84
+
admin, before the seed runs — so every seeded row that names a person reaches
85
+
them on the first `pnpm demo`, with no step of yours. They are the persona mix
86
+
of [DESIGN.md](./DESIGN.md) §10: three business requesters and one account per
87
+
position of §04, two for legal counsel.
88
+
89
+
Every one signs in with the development seed password, the dev admin's:
90
+
`admin123` (or whatever `OS_SEED_ADMIN_PASSWORD` says when it is set). The
91
+
console does not list them; this table is where they are named.
92
+
93
+
| Account | Sign in as | Position | What it holds in the demo |
94
+
|---|---|---|---|
95
+
|`Business Requester 1` · `2` · `3`|`requester1@example.com` · `requester2@example.com` · `requester3@example.com`| none — every member holds `clm_requester`| the 120 contracts' `owner_id`, dealt by counterparty — 43 / 43 / 34 · and the 143 delivery and reporting obligations under them — 50 / 53 / 40 |
96
+
|`Legal Counsel 1` · `2`|`counsel1@example.com` · `counsel2@example.com`|`clm_legal_counsel`| receives contracts on submission (round-robin by open load) and owns review · the `legal_owner` of every contract legal has accepted — 34 / 34 · all 56 compliance obligations — 29 / 27 · the `decided_by` of all 17 decided deviations — 10 / 7 |
97
+
|`Head of Legal`|`legal.head@example.com`|`clm_legal_head`| rung 2 of the approval ladder whenever `route_legal_head` is stamped |
98
+
|`Finance Controller`|`finance@example.com`|`clm_finance_controller`| rung 2/3, reads every contract with `route_finance`, and the only position that may edit bank details |
99
+
|`Executive`|`executive@example.com`|`clm_executive`| rung 4, and reads every contract with `route_executive`|
100
+
|`General Manager`|`gm@example.com`|`clm_general_manager`| rung 5, and reads every contract with `route_gm`|
101
+
|`Records Manager`|`records@example.com`|`clm_records_manager`| execution formalities, the executed copy and the archive number |
102
+
|`CLM Administrator`|`clm.admin@example.com`|`clm_admin`| maintains the configuration objects and holds full reach over every CLM object: the only position that may write `clm_contract_type` and `clm_approval_rule`, and the only one the app's **Administration** group is served to |
103
+
104
+
A business requester is not a position. Every member of the organization holds
105
+
`clm_requester` by default ([DESIGN.md](./DESIGN.md) §04): it is the app's
106
+
default permission set, bound to the platform's `everyone` anchor, so a
107
+
requester needs no position and no grant. They launch contracts and see their
108
+
own. The seven positions hold the same set the same way, on top of their own.
109
+
110
+
Signed in, each requester lands on **我的合同 › 我发起的** (Launched by Me) with
111
+
their contracts, and finds their obligations under **我负责的履约** (My
112
+
Obligations); each lawyer lands on **法务工作台** and finds their contracts under
113
+
**我的审查** (My Reviews); finance lands on **财务**, records on **执行与档案** and
114
+
the CLM administrator on **管理**. A decided deviation's **Decided By** shows its
115
+
lawyer on the contract page's Deviations grid.
116
+
117
+
Three things about where these accounts exist:
118
+
119
+
-**On a local development boot only.**`os dev` creates them; a production
120
+
boot, a migration run or a server whose auth base URL is not a loopback
121
+
address creates none and logs why. `os build` leaves the declaration out of
122
+
the artifact, so no deployment boots with them. They are not seeded users:
123
+
no fixture carries a `sys_user` row, and §10's 「用户不可种子」 stands.
124
+
-**With the demo only.** The declaration is gated on `CLM_DEMO_SEED`, the
125
+
switch that loads the dataset, so `pnpm dev` stays empty of people as well as
126
+
of contracts: it signs in the dev admin and nobody else.
127
+
-**Once.** Running `pnpm demo` again finds every address already there and
128
+
leaves that account exactly as it is — name, password, manager — adding only
129
+
a position it is missing. No account is duplicated.
130
+
131
+
Every dataset is an upsert, so `pnpm demo` also runs again on a database that
132
+
already holds the demo, sliding every boot-relative date forward.
133
+
134
+
**Run it again only before the daily jobs have run on the database.** Only a clean
122
135
database is guaranteed to come back as the known corpus: the fixture re-asserts
123
136
every column it declares, the job-written ones included, so once rows have
124
137
moved on — the jobs' work above all — a re-run does one of two things to each.
@@ -143,9 +156,6 @@ to tell" edge when there is none — the demo keeps exactly one unowned row, due
143
156
seven days after boot, so that edge stays exercised. `src/data/plan-children.ts`
144
157
proves it reachable and says why one is both the minimum and the maximum.
145
158
146
-
The other six positions are named however you like; they are reached through
147
-
the position, not by name.
148
-
149
159
The dev admin is deliberately none of them. Like every member it holds
150
160
`clm_requester`, so it sees 我的合同 and 分析 (`GET /api/v1/meta/app/clm` serves
151
161
it exactly those two groups), but it holds no position and no other `clm_*` set:
@@ -156,24 +166,27 @@ the dev admin cannot open, and as a business owner or an obligation's owner it
156
166
fills the setup account's 我的合同 instead of the requester's — and its
157
167
reminders go to somebody who is not going to act on them.
158
168
159
-
`clm_review.reviewer` is the one reference that still **has to** name the dev
160
-
admin: it is `required: true`, so a name that resolves to nothing takes the row
161
-
with it, and the dev admin is the only account that exists while the seed runs.
162
-
Reassign it once the real accounts are there.
169
+
`clm_review.reviewer` is the one reference that still names the dev admin. It is
170
+
`required: true`, so a name that resolves to nothing takes the row with it, and
171
+
the fixture names the account `pnpm demo` makes sure of before anything is
172
+
seeded. Reassign it if you want the reviews on a lawyer's desk.
163
173
164
174
### Rung 1 of the approval ladder is a manager
165
175
166
176
Every contract sent for approval opens on rung 1: the direct manager of the
167
177
contract's **owner** — the business requester who launched it, not the lawyer
168
178
who pressed **Send for Approval** — read from that account's
169
179
`sys_user.manager_id`. No seed, position or permission set fills that column,
170
-
so on an install set up from the tables above alone, no contract gets past
171
-
rung 1.
180
+
and neither do the demo staff: a `demoStaff` entry carries a position and
181
+
permission sets and nothing else, so it cannot name a manager. On a fresh
182
+
`pnpm demo` no requester has one, and no contract gets past rung 1 until you
183
+
set it — the one step of the demo that is still yours.
172
184
173
185
Set it in **Setup → Users → the user → ⋯ → Set Manager**, for each of the three
174
186
business requesters and for anyone else who launches contracts. Any other
175
187
account in the organization will do — the persona mix has no line managers of
176
-
its own, so point all three at one of the accounts above (the executive, say).
188
+
its own, so point all three at one of the demo staff (`Executive`, say). A
189
+
second `pnpm demo` leaves the manager you set where it is.
177
190
The manager needs nothing more: `approve_contract`, the gate a rung acts
178
191
through, is in `clm_requester`, which every account holds.
179
192
@@ -216,7 +229,8 @@ it approves.
216
229
217
230
### Assigning a position from a script
218
231
219
-
Clicking through Setup → Users needs nothing more than the table above. Automating it does: the
232
+
The demo staff get their positions from the platform. Staffing an organization of your own goes
233
+
through Setup → Users, and automating that needs one more fact: the
220
234
assignment binds by the position's **name**, not by its id. Read that off the declaration, not off
221
235
the field name — `sys_user_position.position` is declared `text`, and its own description says what
222
236
it carries: *"Position machine name (references `sys_position.name`)."* The field name tells you
0 commit comments