Commit a4540ae
Add catalog apply and sync: instantiate a position's duties onto a person (#34)
* Catalog instantiation: apply and sync a position's duty catalog
Adds two object-less actions and their handlers:
- duly_catalog_apply — instantiate every active duly_catalog_item for a
position onto one or more people. Idempotent on (catalog_item, owner):
a second apply creates nothing and reports the skips.
- duly_catalog_sync — replay catalog CADENCE edits (frequency, due_anchor,
due_offset_days, lead_days, grace_days) onto derived duties. Never touches
owner, status, timezone or the effective_* window; never touches a duty
whose source is 'self'; reports duties from deactivated catalog items
rather than deleting them.
The handler↔declaration wiring is asserted in tests because no author-time
gate covers it: an unregistered handler renders, is clickable, and 404s at
call time.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqkTcrxUFci7nqXdbBSe2p
* Write pairKey's separator as an escape, not a raw NUL byte
The separator itself is right: a NUL cannot occur in a record id, so the
composite key cannot collide the way plain concatenation can - ('ab','c')
and ('a','bc') would otherwise produce the same key and silently skip a
duty that was never created.
Encoding it as a literal 0x00 in the source was the defect. It made git
treat catalog.handlers.ts as binary (Bin 0 -> 17555 bytes, no diff, no
blame, no review for the life of the file), left the separator invisible
in an editor, and would be dropped silently on copy-paste - degrading the
key back to plain concatenation with no error.
Now written as the \u0000 escape, so the file stays ASCII while the
runtime value is unchanged. pairKey is exported and the collision property
is pinned in tests, since the reason for the separator is not obvious and
would otherwise be "simplified" away.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqkTcrxUFci7nqXdbBSe2p
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent cc1d1d8 commit a4540ae
5 files changed
Lines changed: 1195 additions & 2 deletions
File tree
- src/actions
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
0 commit comments