Feature #142
open[HR][P4] Write safety and audit trail
0%
Description
Audit events (hand-written IAuditPublisher; HR is not on the central capture pipeline) on manual punch with before-values, roster publish/unpublish/entries, template edits, leave transitions, employee deactivate. Link uploaded attendance evidence to the punch and drop the free-text evidence URL field. ConfirmDialog on publish, unpublish, deactivate, remove, payroll-run process.
Size: M
Source: clinq-docs/modules/hr/reviews/2026-09-28-ui-audit/ (branch docs/hr-ui-audit-2026-09-28)
Findings covered:
- B-09
- B-36
- B-37
- C-10
- C-15
- C-16
- C-50
- D-31
- B-10
SV Updated by Sravan V S about 2 months ago
- Assignee set to Sravan V S
S- Updated by SK - 13 days ago
- Status changed from New to Resolved
- Assignee changed from SK - to Roshni Harish.
- Resolved By set to SK -
Fixed and merged to dev on nuvita-hr. Worked from the ticket's description, verified each area against current code first (source audit doc confirmed permanently lost, see #137).
- Audit events - added hand-written IAuditPublisher calls (HR's own correct pattern - it isn't on the central capture pipeline) with before/after values on manual punch, roster publish/unpublish/entries, shift template edits, and employee deactivate. Leave transitions were already fully audited from #140's work, except one real gap found and closed (ManagerApprove). All follow the exact calling convention already used elsewhere in HR.
- Evidence document linking - confirmed the free-text evidence URL field was a genuine arbitrary-URL risk, and found the fix had actually already been half-built: a real document-upload flow existed in the portal, but the submit handler silently discarded the uploaded document id and sent the free-text URL instead. Finished wiring what was already there rather than inventing a new mechanism - the free-text field is now gone entirely, with a migration to drop the column. Flagging a pre-existing, unrelated finding: HR's document pattern (EmployeeDocument/EvidenceDocumentId) diverges from the platform's newer canonical documents-pattern.md shape, which only marks HR's adoption as "planned" - not something this fix introduced or should paper over, and directly relevant to #143 which is building toward that canonical shape.
- ConfirmDialog - added to the 3 of 5 named actions that genuinely fired with no confirmation step at all: roster publish/unpublish, roster entry removal, and the payroll run process (split into a confirm step before executing). Employee deactivate already needed one and got it; activate (non-destructive) intentionally left as a single click, matching the platform's "destructive actions get confirmed" convention. Primary-department removal already had one from an earlier change - untouched.
Tests: HR backend unit 1331/1331 passed; HR backend integration 250/250 passed; HR frontend 105/105 files, 825/825 tests passed, type-check clean. Includes a schema migration (drops the evidence-URL column) - ordinary, safe to run normally.
RH Updated by Roshni Harish. 3 days ago
- Assignee changed from Roshni Harish. to Sravan V S