Daily Changelog – August 31, 2025

Daily Changelog – August 31, 2025

Morning Status

Starting the day with a fresh changelog. Yesterday we made good progress on various features, and today we’re diving into a Leave of Absence system issue where employees aren’t showing up in the dropdown.

Today’s Goals

  • Investigate and fix the employee dropdown issue in the Leave of Absence form
  • Ensure the Leave of Absence system is working properly
  • Continue with any other pending tasks

Issues Identified

  • Employee dropdown in “Add Leave of Absence” modal is not populating with employees
  • Users cannot select employees when trying to add leave records

Issues Fixed

  • Fixed employee dropdown issue: The Leave of Absence form was trying to access first_name_legal and last_name_legal fields that don’t exist in the API response. Simplified the data transformation to only use user_first_name and user_last_name from the users table, which is the standard pattern used throughout the app.
  • Fixed employee API access issue: The /api/employees endpoint was requiring admin access for all requests, but many pages (including Leave of Absence) need to read employee data. Modified the endpoint to allow any authenticated user to read employee data (GET requests), while still requiring admin access for modifications (POST/PUT/DELETE).
  • Fixed docs routing issue: The documentation pages were using encodeURIComponent() on slugs, which was encoding / as %2F and breaking the Next.js routing. Removed the encoding so URLs like /docs/view/agent-tools/terminate-employee work properly instead of /docs/view/agent-tools%2Fterminate-employee.

Next Steps

  • Test the Leave of Absence form to ensure employees now appear in the dropdown
  • Test the docs pages to ensure they’re accessible
  • Continue with any other pending tasks

Afternoon/Evening Work – Scheduling and Records

  • Re-run Week fixed and hardened:

– Weekly generation now derives employment from employee_records type “Active Status” (truthy + overlapping date), not the legacy employees.is_active column.

– Gracefully handles missing leave_of_absence table; falls back to LOA via employee_records (types: Leave of Absence, Furlough, Sabbatical, Suspension, Unpaid Leave).

– Added detailed per-day logs with insert counts and skip reasons (not hired, effective dates, PTO, LOA, closed, noTimes).

  • Employee Records management improvements:

– “Set Employee Records” API fixed (record types now resolved with ANY($1::text[])).

– Added default start date when omitted: uses hire_date, else 2024-01-01.

– After single/bulk upserts, we recalc and sync employees.is_active from current “Active Status” records (for convenience only; scheduling ignores the column).

– Added DELETE endpoint to remove a single record: DELETE /api/employees/:id/records/:recordId (admin).

– Added PATCH endpoint to close a record (sets end_date and deactivates): PATCH /api/employees/:id/records/:recordId (admin). Also enforces only the most-recent active record per type remains active.

– UI: On the Employee Edit page, added “Close” and “Delete” actions per record; list refreshes after actions.

  • Docs and rules:

– Updated AGENTS.md with mandatory “Employee Records & Scheduling Rules”; clarified “Active Status” as source of truth; added guidance for ensuring a full set of record types.

– Added official docs: docs/EMPLOYEE_RECORDS_AND_SCHEDULING.md mirroring these rules and operations.

  • Dev ergonomics:

– Husky pre-commit updated to skip palette validation when npm isn’t available; still fails when validation actually runs and fails.

Status

  • Re-run Week works; terminated/LOA/PTO filtering behaves per rules.
  • You can close bad/old records, keep only the latest active per type, and default dates are sensible.
  • Ready to push.

📸 Screenshots


Development screenshot