Repository navigation
feat(hr): surface HR lifecycle and leave alerts on Vy Today feed (#4444) - #4459
Conversation
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
04c18db to
9ba72c8
Compare
|
PO acceptance: merge at 9ba72c8 Verified clean head |
Closes #4444
What
Wire the
hrmodule into Vy's Home (Hôm nay/Today) feed (Stage 5A), attributed toLy(todayCoworkerKey('hr') === 'finance'), with zero AI cost, zero DB/audit writes, and zero employee PII in parameters:'hr'toTODAY_APPS(packages/kernel-contract/src/today.ts),zHrTodayAsk(packages/kernel-contract/src/hr.ts), and'hr.today'toTODAY_READS(packages/kernel/src/today.ts).modules/hr/src/today.ts, exported viamodules/hr/src/index.ts):[]) whenactor.type !== 'user',role === 'viewer', or'hr'is disabled/inactive oncrove_kernel.tenant(apps_off, readable under bothcrove_appandcrove_tenant).owner/admin: aggregates alerts across active non-erased staff for probation ending within 7 days (hr.probationEnding,/hr/employees), fixed-term contracts ending within 30 days or already expired while active (hr.contractsExpiring/hr.contractsExpired,/hr/employees), foreign work permits ending within 60 days or expired viaworkPermitAlertsFor(hr.workPermitsExpiring/hr.workPermitsExpired,/hr/employees), semi-annual01/PLIlabor fluctuation filing windows due June 5 (YYYY-H1) and December 5 (YYYY) when non-erased labor exists in the reporting year (hr.laborReport01Pli,/hr/declarations), and total waiting leave approvals (pending_l1+pending_final,hr.leaveApprovalsPending,/hr/employees).memberwitharchived_at IS NULL AND manager_user_id = actor.userId, whether linked or unlinked topayroll_employee): sees only the count ofpending_l1leave requests in their managed active department(s), excluding their own linked employee requests (NOT crove_hr.is_self_employee) and erased employees (crove_hr.leave_request_employee_name IS NOT NULL), usinghr.deptLeavelinking to/hr/my.memberandviewer: returns[].apps/app/src/i18n/messages/en.ts,vi.ts,apps/app/test/hr-today-copy.test.tsx,modules/hr/test/hr-today.db.test.ts,packages/kernel-contract/test/today.test.ts,apps/kernel/test/today.test.ts): Addedtoday.items.hr.*messages,commands.hr.todayVietnamese/English labels, and full unit + PostgreSQL 17 integration coverage.Tests
origin/main(e626e250e):pnpm vitest run --project unit packages/kernel-contract/test/today.test.ts apps/kernel/test/today.test.ts apps/kernel/test/command-labels.test.ts apps/app/test/hr-today-copy.test.tsx apps/app/test/i18n.test.ts: passed (5 files, 48 tests).node tools/ci/spdx-header.mjs origin/main: passed (spdx header OK: 3 new source file(s) checked).pnpm --filter @ludy/mod-hr typecheck,pnpm --filter @ludy/app typecheck,pnpm --filter @ludy/kernel-server typecheck,pnpm exec oxlint --deny-warnings <11 changed files>: passed.pnpm vitest run --project unit packages/kernel-contract/test/today.test.ts apps/kernel/test/today.test.ts apps/kernel/test/command-labels.test.ts apps/app/test/hr-today-copy.test.tsx apps/app/test/i18n.test.ts apps/app/test/i18n-no-env-names.test.ts apps/kernel/test/invariant/write-path.test.ts: passed (7 files, 64 tests).CROVE_TEST_ADMIN_URL=postgresql://postgres:postgres@127.0.0.1:55432/postgres pnpm vitest run --project db modules/hr/test/hr-today.db.test.ts: passed (3/3 tests on PG 17).9ba72c8d3.Acceptance
Hôm nay/Today) feed, owners and admins see HR compliance and approval alerts underLylinking directly to/hr/employeesand/hr/declarations, while active L1 department managers (member) see only their own department's pending L1 leave approval count linking to/hr/my. Non-manager members and viewers see no HR alerts.TODAY_APPSincludes'hr'(todayCoworkerKey('hr') === 'finance') andTODAY_READSincludes'hr.today', verified bypackages/kernel-contract/test/today.test.ts,apps/kernel/test/today.test.ts,apps/kernel/test/command-labels.test.ts, andhr-today.db.test.ts(kernel.todayreturnsfailed: 0,dropped: 0).<= 7dprobation,<= 30dfixed-term contract + expired active,<= 60dforeign work permit + expired,01/PLIJune 5 & December 5 windows with zero-labor suppression,pending_l1+pending_final), malformed employment row resilience, ended/erased exclusions, L1 manager scoping (linked and unlinked, excluding self-requests, other departments, archived departments, andpending_final),le_scope, cross-org isolation,MODULE_OFFgating (Runtime + directcrove_tenantexecution), zero PII in params, and zero DB/audit writes verified inmodules/hr/test/hr-today.db.test.ts.Lyattribution, and/o/<slug>/hr/*link rendering verified inapps/app/test/hr-today-copy.test.tsxandapps/app/test/i18n.test.ts.researchsubagent reviewer checked the implementation against#4444and all 6 checklist dimensions: 0 blocking findings, 4 non-blocking notes (3 applied: explicitpe.org_idfilter, malformed historical employment row DB test, clearer VietnameseworkPermitsExpiredphrasing; subsequently added missingcommands.hr.todaylabels and renamedleaveApprovalsL1Pending->deptLeaveviahrTitlehelper to resolve gitleaks false positive).codex review -c model_reasoning_effort=high --base origin/mainunavailable: hit OpenAI Codex usage limit (ERROR: You've hit your usage limit).<= 7d,<= 30d,<= 60d,01/PLI),contract_type = 'fixed_term'scoping,erased_at IS NULL&status = 'active'filtering, and safe skip on malformed legacy employment bounds.access: ALLwith immediate[]for non-user/viewer/non-managermember,crove_kernel.tenant(status/apps_off) fail-closed gate compatible with bothcrove_appandcrove_tenant, omittedsensitive: true(allowingkernel.todayinvocation) with zero PII or salary columns queried/returned, zero LLM calls, and zero writes.org_id = ctx.orgIdunder PostgreSQL RLS (tenant_isolation,le_scope,hr_leave_request_select), and L1 manager scoping usesarchived_at IS NULL,NOT crove_hr.is_self_employee, andcrove_hr.leave_request_employee_name IS NOT NULLwithout wideningpayroll_employeemember access.hr.todayselects zero wage columns and emits no monetary amounts or currencies).DISTINCT ON (pe.employee_id)skipped when zero active staff;01/PLIended checkLIMIT 1skipped when active staff exist), zero N+1 queries.TodayListsemantics (<a href="/o/<slug>/hr/...">) with verifiedvi/enICU copy, zero forbidden coworker names, and zero em/en dashes.9ba72c8d3.Release note (vi): Nhân sự nay xuất hiện trên màn hình Hôm nay của Vy (do Ly phụ trách): chủ doanh nghiệp và quản trị viên thấy cảnh báo thử việc sắp kết thúc, hợp đồng xác định thời hạn, giấy phép lao động nước ngoài, kỳ nộp mẫu 01/PLI và đơn nghỉ phép chờ duyệt; trưởng bộ phận thấy số đơn nghỉ phép của bộ phận mình cần duyệt cấp 1.