Skip to content

Add catalog packs and the food-safety pack, selected by DULY_PACK - #170

Merged
os-warren merged 2 commits into
mainfrom
claude/project-thread-8sm850
Nov 2, 2026
Merged

os-warren merged 2 commits into
mainfrom
claude/project-thread-8sm850

Conversation

@os-warren

Copy link
Copy Markdown
Collaborator

Requested by Warren · project thread

Fixes #134

What this adds

  • The pack format (src/data/packs/): a pack is duly_catalog_item seed rows and nothing else. Positions are the existing free-text position_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.
  • The switch: DULY_PACK=<id> (comma-separated for several), read at compile time in the same way as DULY_DEMO_SEED. An unknown id is refused at compile time and the error lists the ids that exist. With it unset or none, nothing is added, so pnpm dev still boots empty.
  • The first pack, 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 follows DULY_DEMO_LOCALE.
  • Demo wiring: scripts/demo.mjs sets DULY_PACK=food-safety only when the caller hasn't set it. It is not in package.json, because shell default syntax doesn't run on Windows. DULY_PACK=none pnpm demo gives the demo without the pack.
  • Edits are kept: every column except name is applyOn: 'create'. The pack only adds rows that are missing, and a restart leaves a plant's edits alone.
  • Docs: src/data/packs/README.md covers 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)

  • Premise 1 was partly false on 18.2.0. defineStack({ data }) is one flat Seed[], which a Seed scopes only by env and locale. 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.locale can't choose zh here, because the boot filters on i18n.defaultLocale, which is 'en'.
  • F1: the pack lives under src/data/packs/, not src/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:

  • 《食品安全法》 (amended 2021-04-29): Arts. 44, 45, 46, 47, 48, 50, 51, 52, 63 and 102 (FAOLEX text)
  • GB 14881-2013: clauses 5.1.1, 5.2.2, 5.2.3, 6.2, 6.3, 6.3.1, 6.4, 6.5, 6.6, 7, 7.1, 7.3, 8.2.1, 8.2.2 plus Appendix A, 8.3, 8.4, 10, 11, 12 and 14 (English translation, USDA)
  • 《企业落实食品安全主体责任监督管理规定》 (SAMR Order No. 60): Arts. 11 (日管控), 12 (周排查), 13 (月调度) and 16 (training and assessment) (TID circular)
  • GB 2760, GB 5749 and HACCP are cited by name only. Two duties (法规标准更新跟踪, 成品留样检查) cite nothing, because they have no single source.

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:

  1. Boot: Seeds: 38 rows, and duly_catalog_item = 38 with 8 positions.
  2. I added one entry (临时测试职责, director, monthly) to src/data/packs/food-safety/pack.ts and restarted on the same database. Result: Seeds: 39 rows, catalog = 39, and the row was there under 食品安全总监.
  3. I removed the entry and restarted on the same database. Result: 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 in test/catalog-pack.test.ts. DULY_PACK=food-safety pnpm validate exits 0 and prints no new warnings. DULY_PACK=bogus pnpm validate fails with the refusal.

Boot (clean database) Result
pnpm demo (en) Seeds: 566 rows (528 demo + 38 pack), 13 users, 32 duties, 213 tasks, catalog 58 across 11 positions
pnpm demo:zh the same counts, all pack rows in Chinese
pnpm dev 1 user (the admin), catalog 0, duties 0, tasks 0, and the empty state renders
DULY_PACK=food-safety DULY_DEMO_LOCALE=zh-CN pnpm dev 1 user, catalog 38 across 8 positions, no duties
pnpm demo, then a pack row edited in the DB and restarted the edit survived (description, lead_days)

Browser pass in en-US and zh-CN, on both demos:

  • All 19 nav pages load with no console errors and no 4xx/5xx. Footers match the demo's counts from before the pack, apart from the catalog going from 20 to 58.
  • A pack record page shows the "What done means" text, the evidence line (Evidence to keep: / 留存证据:) and the reference.
  • Apply to people with position 质量检验员 / Quality inspector gave one demo person the pack's 7 duties, in 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} and test/catalog-pack.test.ts. Edited: src/data/index.ts (concatenates the packs into dulySeeds; with no pack it is still the demo array itself), scripts/demo.mjs and README.md. Nothing in objects, views, flows, hooks, translations or the config changed.


Generated by Claude Code

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
@os-warren os-warren self-assigned this Nov 2, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor

席位核对

ACCEPT — PR #170 at head 76885467e6b426bcffaddc9d49d1f4d4f8e09885 (duly lane seat, session session_011HyoSXGRy6L13mYq1Hp4n1, 2026-11-02T04:48Z). Implemented by the #134 card thread session_01JQwxbXXneLu2NaS1dYFtum under Claim comment 6568930403. The Step 0 report is in project files duly-134-pack/step0.md.

  • Shape: the head merges main 0400ac0 (no rebase), Fixes #134, Clause-②: no, Metadata-protocol: none.
  • Files (API list): src/data/packs/README.md, src/data/packs/index.ts, src/data/packs/food-safety/pack.ts, test/catalog-pack.test.ts (all new), src/data/index.ts, scripts/demo.mjs, README.md. This is inside the Claim. package.json and src/translations/ are untouched. No governed path, no new object, field or hook.
  • Gate: check-run verify success on 7688546, mergeable_state clean, and a local git merge-tree against main is clean.
  • Fork rulings, as applied:
    • F1: the pack lives at src/data/packs/.
    • F2: the pack is duly_catalog_item rows only.
    • F3: en and zh are inline, and a test requires both and requires them to differ.
    • F4: the citations are framework or section level and flagged for domain review, and the README says the pack is a starting point, not legal advice.
  • Read in the diff:
    • DULY_PACK is read at compile time. An unknown id throws with the list of valid ones, and none or unset means no pack.
    • dulySeeds is unchanged when no pack is asked for.
    • The seed is upsert on name with every column applyOn: 'create', so a plant's edits survive a later boot. A deleted row returns while the pack is on, and the README says so.
    • Cadence goes through cadenceOf, so the A standing duty carries a frequency — "Standing / Monthly" reads as if it dispatches #61 rules hold.
    • scripts/demo.mjs defaults DULY_PACK=food-safety only when the caller has not set it.
    • Pack names do not collide with the demo catalog's (tested).
  • Content: 38 duties across 8 positions, spanning daily to annual.
  • Measured (clean databases, 18.2.0):
boot result
pnpm demo 566 rows (528 demo + 38 pack), 13 users; catalog 58 across 11 positions
pnpm demo:zh same counts, pack rows in Chinese
pnpm dev 1 user, empty catalog
DULY_PACK=food-safety with zh-CN, on pnpm dev 38 catalog rows, no duties
restart after editing a pack row the edit survives
  • Tests: 1077 locally, 31 of them new.
  • Browser (project files duly-134-pack/):
    • en-US and zh-CN, 19 nav pages, with 0 console or HTTP errors.
    • The pack record page shows the evidence line and the reference.
    • Apply to people on 质量检验员 / Quality inspector created 7 to_confirm duties.
  • Open for the maintainer, not blocking: a domain review of the regulation citations, as flagged in the PR body.
  • Landing: direct-merge repo. The seat flips the PR ready and squash-merges it with expected_head_sha pinned.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 04:48
@os-warren
os-warren merged commit e512a10 into main Nov 2, 2026
1 check passed
@objectstack-fleet

Copy link
Copy Markdown
Contributor

Landed

Seat landing at 2026-11-02T04:49Z (duly lane seat, session session_011HyoSXGRy6L13mYq1Hp4n1). The seat flipped the PR ready through the relay, then squash-merged it with expected_head_sha 7688546 pinned.

probe reading
PR object merged: true, merge_commit_sha e512a10
origin/main by content e512a10, single parent 0400ac0; src/data/packs/ holds the format, its README and food-safety

State: #134 is closed completed by Fixes #134, and pm:dispatched is removed. #136 (ISO 9001 pack) and #137 (EHS pack) are released to pm:ready. They follow the merged format in src/data/packs/README.md, under src/data/packs/, not the src/seeds/** path the cards name. The regulation citations still want a domain review.


Generated by Claude Code

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.

Catalog pack format + first pack: food-safety recurring duties (seed-only, no code)

2 participants