# Specification: 044-backstock-bulk-action-audit-logging

## Status

| Field | Value |
|-------|-------|
| **Created** | 2026-04-02 |
| **Current Phase** | PLAN Reviewed by Codex → Ready for Implementation |
| **Last Updated** | 2026-04-02 |

## Documents

| Document | Status | Notes |
|----------|--------|-------|
| product-requirements.md | completed | Full audit overhaul scope |
| solution-design.md | completed | Full SDD with ADRs |
| implementation-plan.md | completed | 5 phases, ~55 tasks, Codex-reviewed |

**Status values**: `pending` | `in_progress` | `completed` | `skipped`

## Decisions Log

| Date | Decision | Rationale |
|------|----------|-----------|
| 2026-04-02 | Full audit overhaul | User chose full overhaul over quick fix — new action codes, change detail, batch grouping |
| 2026-04-02 | Enhance bsActions table | Use existing table with new columns rather than creating separate audit system |
| 2026-04-02 | ADRs 1-5 approved | Extend bsActions, new codes 10-15, VARCHAR snapshots, UUID batchId, batchId in route handler |
| 2026-04-02 | Codex PLAN review completed | Added risk/gotchas section, global feed verification, batchSize test, deferred features section |
| 2026-04-02 | Deferred UI features | PRD Features 3 (UI grouping), 6 (action filter), 7 (user filter) deferred to follow-up |

## Context

**User Request**: "We added bulk actions to the backstock overview page, but the actions we take are not logged and tied to any user"

### Discovery Findings

After analyzing the codebase, bulk actions **DO** already log to `bsActions` via `logMassAction()`, but there are several gaps:

1. **Missing action codes in `getReadableString()`**: Actions 7 (hide) and 8 (unhide) have no case in the switch statement — they produce empty strings in the action log display
2. **Generic action code 6**: Location change, category change, age update, and note additions ALL use action code 6 ("added items to bin") — no way to distinguish between them
3. **No "mass" indicator**: Individual and mass actions look identical in the log — no way to tell that 50 bins were updated at once vs 1 bin
4. **Print labels not logged**: `massPrintLabels()` doesn't call `logMassAction()` at all
5. **Tag additions use code 6 (generic)**: Only tag removals get a specific code (3)
6. **No detail captured**: The log doesn't record WHAT changed (e.g., "moved from Back Room to Storage Unit 111")

---
*This file is managed by the specification-management skill.*
