Repository navigation
Give an applied duty its owner's business unit, and say when there is none - #184
Conversation
… none Apply catalog read only the position-assignment anchor, and no demo assignment is anchored, so on 18.2 every applied demo duty had no unit (13 of 13). Apply runs as system, so the hand-made duty stamp from #178 never covers it. The handler now resolves the unit in the seat's R-A order: the owner's primary business unit, then a position anchor only when there is no primary and the anchored rows name one unit, otherwise none. Each created entry carries business_unit, the result counts unanchored duties and names their owners, and a closed outcome picks the console toast through outcomeMessages (en and zh-CN). Sync is unchanged. Fixes #179 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbYga1GGouLwJs9WbD3
…gle anchor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbYga1GGouLwJs9WbD3
…anchor fallback Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbYga1GGouLwJs9WbD3
席位核对ACCEPT — PR #184 at head
Generated by Claude Code |
LandedSeat landing at 2026-11-02T07:45Z (duly lane seat, session
State: #179 is closed Generated by Claude Code |
Requested by Warren · project thread
Fixes #179
What was wrong
Step 0 was measured on
main3395a9a with @objectstack 18.2.0 against a livepnpm demo; the write-up is in the project fileduly-179-apply-unit/step0.md. Apply catalog read onlysys_user_position.business_unit_id. On the demo, 0 of the 12 position rows are anchored, becausedemoStaffhas no unit key. So 13 of 13 applied duties had no unit, and the dispatcher copies that null onto every task. Apply runs its engine as system (buildActionExecutionContextsetsisSystem), which means #178'sduly_duty_unit_stampnever covers it.The old rung also took "the first anchored assignment of any position". Those assignments are the platform's capability positions (
duly_memberand so on), not the catalog'sposition_code.The change (seat ruling R-A, S1)
src/actions/catalog.handlers.ts:resolveBusinessUnitsreadssys_userandsys_user_positiononce per run with$in. It resolves in this order:primary_business_unit_id, the same rung as A member can write source, owner and business_unit on their own task, and so enter governed readings or someone else's #176, A member can create a duty with source catalog, another person as owner and a foreign business unit #178 and the fan-out;business_unit(an id, ornull);unanchored,unanchored_ownersand a closedoutcome:created,created_unanchoredornothing_created.src/actions/catalog.actions.ts:outcomeMessagesfor the three outcomes, inherited by theduly_catalog_apply_to_peopletwin. The console toast now reports the counts. Forcreated_unanchoredit says how many duties have no business unit.src/translations/zh-CN.ts: the three messages on both action addresses, and thebusiness_unithelp text.src/translations/authored-text.ts:action.outcomeMessagesis a data-keyed map, with a verdict that keys each message tooutcomeMessages.<outcome>.src/objects/duty.object.ts(Claim amendment 2): thebusiness_unitdescription now says the field is set on create from the owner's primary unit, that Apply falls back to a lone position anchor, and that otherwise it stays empty. Comment updated to match.src/hooks/duty.hook.ts(Claim amendment 2): comment only. Theduly_duty_unit_stampheader now says how Apply resolves its own unit.Tests
test/catalog-instantiate.test.ts: one test per rung, plus:nothing_created;test/catalog-engine-facade.test.ts: through the real action route, three people in one run cover the primary unit (via a real membership row and the plugin-sharing projection), anchor only, and none, along with the reported result.test/catalog-apply-unit.test.ts:created_unanchored,unanchored_owners= [admin]);outcomeMessagescover each outcome, read only real result keys, and carry the same placeholders.test/duty-provenance.test.ts(Claim amendment): Sami's position stays anchored to Quality, and Apply is now expected to give Sami's primary unit, Operations. This makes it the regression guard for R-A precedence. No assertion was removed.Gates pass locally:
pnpm validate,typecheck,test(46 files, 1297 tests) andbuild.Live check (18.2.0, fresh
pnpm demoandpnpm demo:zh)duly_memberrow is anchored to Northgate Quality, and her duties still land in Riverside Plant.duly-179-apply-unit/verify/shots):🤖 Generated with Claude Code
https://claude.ai/code/session_01JQwxbYga1GGouLwJs9WbD3