Spec: HR-30Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Status: 📝 Planned
Last Updated: 2026-03-25
Constitution: §1.2 (core boundaries), §1.3 (integration patterns)
Integration Overview
| Integration | Pattern | Direction | Status |
|---|---|---|---|
| HR-03 | Event consumer | HR-30 consumes | 📝 Planned |
| HR-07 | Data / export | HR-30 → HR-07 staging | 📝 Planned |
| HR-06, HR-05, HR-11 | Same-core read | HR-30 reads | 📝 Planned |
| PF-10 | Notifications | HR-30 → PF-10 | 📝 Planned |
| PF-30 | RBAC | Permission keys | 📝 Planned |
Consumed Events
hr_employee_terminated
Publisher: HR-03 (HR core)Subscriber: HR-30
Status: Planned registry entry (see EVENT_CONTRACTS.md)
Trigger: Employment status set to terminated; existing lifecycle pipeline. Payload (align with HR-03 / platform event envelope per EVENT_CONTRACTS.md): The event follows the platform event envelope pattern with top-level
event_name, event_id, timestamp, and a metadata object. The business payload is wrapped inside the envelope.
- Deduplication key:
event_id(must be unique per event instance) - Business idempotency: Unique partial index or application check on
(organization_id, employee_id, termination_date)ensures at-most-once creation of final paycheck request - Retry behavior: Consumer must handle duplicate
event_idgracefully (idempotent INSERT); retries with sameevent_idare no-ops - Ordering: Events for the same
employee_idshould be processed intimestamporder where possible; out-of-order events are handled via business-key uniqueness check
- Verify
event_idnot already processed (optional deduplication table or log check). - Map
termination_typeto HR-30 enum per spec Clarifications. - Insert
hr_final_paycheck_requestsif no row for(organization_id, employee_id, termination_date)with non-cancelled status. - Enqueue calculation job (status →
calculating).
Published Events (optional Phase 2)
hr_final_paycheck_status_changed
Publisher: HR-30
Subscribers: PF-10 (notifications), HR-07 (future pay run hooks)
Status: 📝 Planned — event type is defined in KnownEventName but not yet seeded in fw_workflow_events. Confirm registration in seed data during implementation.
Payload (draft):
HR-07 Handoff
Phase 1: CSV export from UI + documented column mapping (employee id, amounts, pay date).Phase 2: Structured RPC or edge function
hr_export_final_pay_for_run returning JSON lines for payroll import — blocked on HR-07 pay-run API shape; tracked in PENDING_CONTRACTS.md.
Platform Integration Layer
- Use
@/platform/events(or existing HR event dispatcher) for emitting/consuming typed events. - Notifications:
@/platform/notificationspatterns; no PHI in notification body (ids and deadline only).
Security
- All access gated by RLS +
hr_has_permission/is_hr_admin/hr_is_manager_of/is_self_employeeper spec. - Edge functions:
verify_jwt: true;getCorsHeaders; structured logger.
References
- CROSS_CORE_INTEGRATIONS.md — matrix row HR-30
- EVENT_CONTRACTS.md
- CONTRACT_VALIDATION_CHECKLIST.md