Repository navigation
Add catalog packs and the food-safety pack, selected by DULY_PACK - #170
Conversation
A pack is duly_catalog_item seed rows only (positions as position_code, evidence as part of What done means), chosen at compile time by DULY_PACK the same way DULY_DEMO_SEED chooses the demo, refused loudly when it names no pack. pnpm demo and demo:zh load food-safety by default; pnpm dev stays empty. The first pack has 38 recurring duties across 8 positions in zh-CN and en, citing the PRC Food Safety Law, GB 14881-2013, SAMR Order No. 60 and HACCP. Fixes #134 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXXneLu2NaS1dYFtum
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbXXneLu2NaS1dYFtum
席位核对ACCEPT — PR #170 at head
Generated by Claude Code |
LandedSeat landing at 2026-11-02T04:49Z (duly lane seat, session
State: #134 is closed Generated by Claude Code |
Requested by Warren · project thread
Fixes #134
What this adds
src/data/packs/): a pack isduly_catalog_itemseed rows and nothing else. Positions are the existing free-textposition_code. The evidence requirement is a line inside "What done means" and is guidance only: completion never requires evidence. A pack adds no objects, fields, hooks or metadata keys.DULY_PACK=<id>(comma-separated for several), read at compile time in the same way asDULY_DEMO_SEED. An unknown id is refused at compile time and the error lists the ids that exist. With it unset ornone, nothing is added, sopnpm devstill boots empty.food-safety: 38 recurring duties across 8 positions (食品安全总监, 食品安全员, 质量检验员, 生产班组长, 仓库管理员, 卫生管理员, 设备维修主管, 采购主管). They cover daily, weekly, monthly, quarterly, semi-annual and annual work, plus 2 standing duties. Every string exists in zh-CN and en, and the language followsDULY_DEMO_LOCALE.scripts/demo.mjssetsDULY_PACK=food-safetyonly when the caller hasn't set it. It is not inpackage.json, because shell default syntax doesn't run on Windows.DULY_PACK=none pnpm demogives the demo without the pack.nameisapplyOn: 'create'. The pack only adds rows that are missing, and a restart leaves a plant's edits alone.src/data/packs/README.mdcovers what a pack is, how to turn one on, the row shape column by column, adding a duty, removing a pack, starting from a spreadsheet, and writing a new pack. The root README links to it.Rulings this follows (seat, on #134)
defineStack({ data })is one flatSeed[], which aSeedscopes only byenvandlocale. The platform has no named seed set. That is why the switch is an env var read at compile time, and why there is no loader of our own.Seed.localecan't choose zh here, because the boot filters oni18n.defaultLocale, which is'en'.src/data/packs/, notsrc/seeds/. F2: it ships catalog rows only and puts no pack duties on demo people. F3: en and zh are inline on each row, and a test requires both. The authored-text gate doesn't cover seed rows. F4: citations name real public frameworks.⚠ Citations need domain review
The demo's own catalog still cites only invented documents. The pack is the exception: it cites real public frameworks, because that is what a pack is for. I give an article or clause number only where I read it against the published text:
The pack README says it is a starting point, not legal advice.
Proof: a duty is one edited file (not committed)
On a clean
DULY_PACK=food-safety DULY_DEMO_LOCALE=zh-CN pnpm dev:Seeds: 38 rows, andduly_catalog_item= 38 with 8 positions.临时测试职责, director, monthly) tosrc/data/packs/food-safety/pack.tsand restarted on the same database. Result:Seeds: 39 rows, catalog = 39, and the row was there under 食品安全总监.Seeds: 38 rows, and the catalog still had 39. A database keeps a row it already holds until someone deletes it, which is what the README says.Evidence
All gates pass on the head (main merged in, including #167):
pnpm validate && pnpm typecheck && pnpm test && pnpm build. That is 41 files and 1077 tests, 31 of them new intest/catalog-pack.test.ts.DULY_PACK=food-safety pnpm validateexits 0 and prints no new warnings.DULY_PACK=bogus pnpm validatefails with the refusal.pnpm demo(en)Seeds: 566 rows(528 demo + 38 pack), 13 users, 32 duties, 213 tasks, catalog 58 across 11 positionspnpm demo:zhpnpm devDULY_PACK=food-safety DULY_DEMO_LOCALE=zh-CN pnpm devpnpm demo, then a pack row edited in the DB and restarteddescription,lead_days)Browser pass in en-US and zh-CN, on both demos:
to_confirm.zh-CN English leakage: the pack rows contain none. The only Latin word on a pack record page is
Owner, in the platform's activity-feed line ("更新了 职责库条目 …:Owner"). It shows up the same way on the demo's own catalog rows, so it isn't from the pack.Screenshots, logs and Playwright scripts are in the project folder
duly-134-pack/.Files
New:
src/data/packs/{README.md,index.ts,food-safety/pack.ts}andtest/catalog-pack.test.ts. Edited:src/data/index.ts(concatenates the packs intodulySeeds; with no pack it is still the demo array itself),scripts/demo.mjsandREADME.md. Nothing in objects, views, flows, hooks, translations or the config changed.Generated by Claude Code