1---2name: self-attempt-02-413description: Skill: Inspect Payroll Assignment and Accrual Readiness4---5# Skill: Inspect Payroll Assignment and Accrual Readiness67## Environment8- Base URL resolves to `http://34.46.77.124:8012` (use `<TASK_ENV_BASE_URL>` as referenced in prompts).9- The portal exposes JSON REST APIs under `/api/`. In practice, direct `GET` calls to the endpoints below return data without extra session handling; if a frontend login screen is encountered, use the credentials supplied in the task prompt.1011## Relevant APIs12| Endpoint | Purpose |13|---|---|14| `GET /api/payroll-ledgers?q=<employee_id>` | Salary assignments, periods, `accrual_batch_id`, and status. |15| `GET /api/audit?q=<employee_id>` | Global audit events (payroll QA results, draft-exclusion notes, etc.). |16| `GET /api/cases?q=<employee_id>` | Case summaries and embedded `audit_events` (fallback when no global payroll audit exists). |17| `GET /api/policies/PAY-SRC-001` | Reference policy: submitted assignments control; drafts are ignored. |1819## Procedure201. **Read the task prompt** to extract the target `employee_id` and the target accrual batch month (e.g., “April 2026”).212. **Read `input/payloads/answer_template.json`** to confirm exact field names and enum values.223. **Fetch payroll-ledgers** (`/api/payroll-ledgers?q=<employee_id>`) and filter to records where `record_type` contains `"Salary assignment"`.234. **Select the controlling assignment** — the record with `status: "Submitted"`.24 - `salary_assignment_id` → `ledger_id`25 - `base_salary` → numeric `base_salary` (do not format as currency)26 - `effective_date` → use an explicit `effective_date` field if present; otherwise derive it from `period` by appending `-01` (e.g., `2026-04` → `2026-04-01`)27 - `payroll_source_status` → `"submitted"`285. **Identify the excluded draft** — the salary assignment with `status: "Draft"`.29 - `excluded_assignment_id` → its `ledger_id` (or `""` if none exists)30 - `draft_exclusion_rule` → `"exclude_draft_assignment"`316. **Determine accrual readiness** for the target month:32 - If the submitted assignment has a non-empty `accrual_batch_id` and its `period` matches the target month, set `accrual_ready: true` and `accrual_batch_id` to that batch ID.33 - Otherwise, set `accrual_ready: false` and `accrual_batch_id: ""`.347. **Find the payroll audit event**:35 - Query `/api/audit?q=<employee_id>` and prefer the event whose `event` starts with `payroll.` and whose `detail` mentions the selected `ledger_id` or `accrual_batch_id`.36 - If absent, inspect the employee’s case(s) (`/api/cases?q=<employee_id>` → each case’s `audit_events`) for a payroll-related entry.37 - `audit_event_id` → the chosen `audit_id` (or `""` if none found).388. **Map `control_result`** from audit evidence to the exact enum in the answer template:39 - Detail contains `"QA result: ready_with_monitoring"` → `"ready_with_monitoring"`40 - Detail contains `"QA result: block close"` or explicit folder/notice defects (missing files, missing tags, missing appeal instructions, etc.) → `"hold_for_folder_and_notice_defects"`41 - Detail contains `"QA result: approve_closeout"` → `"approve_closeout"`42 - If no payroll audit exists but the submitted assignment carries a matching accrual batch, default to `"ready_with_monitoring"`.43 - If no payroll audit and no matching batch, default to `"hold_for_folder_and_notice_defects"` unless the case is approved with no blocking evidence.449. **Set `audit_scope`** → `"payroll_assignment_readiness"`.4510. **Write the final answer** as a single JSON object matching the answer template exactly, using the normalized enum strings (never free-text paraphrases).4647## Pitfalls48- Never use a draft or superseded salary assignment as the controlling source.49- `accrual_ready` must be a JSON boolean (`true`/`false`), not a string.50- `base_salary` must remain a number.51- Enum fields (`control_result`, `payroll_source_status`, `draft_exclusion_rule`, `audit_scope`) must match the answer template allowed values verbatim.52- If multiple submitted salary assignments exist, prefer the one whose `period` aligns with the target accrual batch month.53- If multiple drafts exist, exclude the most recent one (latest `updated_at`).