Repository navigation
feat(org): enabledApps.compliance for the standalone compliance tracker [TURNWRK-728] - #36
Conversation
…er [TURNWRK-728] OrgAppKey gains 'compliance' beside hostfixCmms/restock/service. It is opt-in (never grandfathered onto orgs without enabledApps) and normalizeEnabledApps writes it only when on, so existing org docs and consumer fixtures stay identical. Scheduling automation stays a plan entitlement (Operator), not this key. Refs: TURNWRK-728 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
practical-bot
left a comment
There was a problem hiding this comment.
Review
I reviewed origin/main...a0907536b1b9e50a58d727c860ee01b14f255968 (#36), scoped to the shared-core portion of TURNWRK-728. The change is appropriately limited to the shared Org entitlement type and its normalization/lookup behavior; onboarding, Dispatch routing, scheduling, and Playwright coverage belong to the linked consumer PR and are not duplicated here.
What is right:
OrgAppKeyandOrgEnabledAppsadd the opt-incompliancekey without changing the existing trial defaults.orgAppEnabledkeeps compliance off for absentenabledApps, requires the key to be exactlytrue, and still turns every app off for suspended orgs.normalizeEnabledAppspreserves existing canonical output for the other apps and emitscomplianceonly when enabled, matching the compatibility goal stated in the PR.- The focused regression tests cover enabled, absent, suspended, and normalization cases. The CI
typecheck + unitjob rannpm run typecheck,npm run test:run,npm run build, and vendored checks successfully on this head. The secret scan and Firestore rules behavior jobs also passed.
Claim ledger
- PR claim: “New tests fail on the old
org.ts(stashed) and pass with the change:old org.ts: × normalize keeps it when on and omits it when off Tests 1 failed | 13 passed (14);new org.ts: Tests 14 passed (14).” UNVERIFIED for the old-tree result: the referenced stash/old-tree artifact is not available in this review workspace, so I did not infer the historical failure. The current command passed:npm run test:run -- tests/orgAppEnabled.test.ts→14 passed (14). - PR claim: “
npx tsc --noEmit: exit 0.” PASS, independently run:npx tsc --noEmit→ exit 0 (no output). It is also covered by CI run37548675469, jobtypecheck + unit. - PR claim: “
npx vitest run: 68/68 files, 703/703 passed.” VERIFIED-BY-CI, not re-run wholesale by design. CI run37548675469, jobtypecheck + unit, rannpm run test:runsuccessfully. The changed-surface command independently passed:npm run test:run -- tests/orgAppEnabled.test.ts→1 passed,14 passed (14). - PR claim: “
firestore.rules:enabledAppsis already a privileged org field as a whole map, so the new key is covered.” VERIFIED-BY-CI for the unchanged rules behavior: CI run37548675469, jobfirestore rules behavior tests, rannpm run test:rulessuccessfully. - PR claim: “Net source lines: +13 / -1 in
src/types/org.ts; tests +29.” PASS against the PR diff: source is+13/-1, tests are+29; total tracked diff is+42/-1.
No blocking findings.
REVIEW VERDICT: approve
FINDING: The PR body’s historical old-tree mutation result could not be re-executed because the referenced stash/artifact is unavailable; the current regression test and CI evidence pass -> DROPPED (historical evidence limitation, not a defect)
|
merge:queued applied at Julissa's request (Claude Code seat, 2026-10-06): TURNWRK-728, Talos-approved, CI green. |
Why
TURNWRK-728 makes the compliance tracker its own product line on the shared core: a host can sign up for just the Florida tracker without the rest of Dispatch. Entitlement to a suite surface lives on
Org.enabledApps, which today only knowshostfixCmms,restockandservice, so there is no way to say "this org has the tracker and nothing else".What changed
OrgAppKeygains'compliance'andOrgEnabledApps.compliance?: boolean, documented as the standalone tracker entry. Scheduling automation stays a plan entitlement (Operator); this key never grants it.orgAppEnabled(org, 'compliance')is opt-in: true only when the key istrue, never grandfathered onto orgs with noenabledApps, false when suspended.normalizeEnabledAppswritescompliance: trueonly when on. Absent reads as off, so every existing org doc and every consumer test fixture (clean, restock, dispatch, cortex) stays byte-identical after the bot sync.src/types/org.ts; tests +29.What deliberately did NOT change
firestore.rules:enabledAppsis already a privileged org field as a whole map, so the new key is covered.DEFAULT_TRIAL_ENABLED_APPS: the tracker is a choice in onboarding, not a default.Proof
New tests fail on the old
org.ts(stashed) and pass with the change:Verification
npx tsc --noEmit: exit 0npx vitest run: 68/68 files, 703/703 passedConsumer: TurnWrk/dispatch PR for TURNWRK-728 vendors this commit (
a090753). Merge this one first; the bot sync then restamps dispatch on the squash-merged main SHA.Refs: TURNWRK-728
🤖 Generated with Claude Code