ADR β PR #1025
2026-05-19 10:00 β Replace console.error with structured logger
Section titled β2026-05-19 10:00 β Replace console.error with structured loggerβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#pullrequestreview-4305327736
- Priority: must-fix
- Decision: accept
- Rationale: Aligns with project logging standards using Pino logger.
2026-05-19 15:30 β Refactor to use Nanostores pattern
Section titled β2026-05-19 15:30 β Refactor to use Nanostores patternβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#pullrequestreview-4305327736
- Priority: must-fix
- Decision: accept
- Rationale: Follows project convention for state management using Nanostores instead of React hooks.
2026-05-19 15:35 β Fix selectedOrgId reset on form open/close
Section titled β2026-05-19 15:35 β Fix selectedOrgId reset on form open/closeβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#discussion_r3254517618
- Priority: nice-to-have
- Decision: accept
- Rationale: Prevents stale org selection when opening/closing add organization form.
2026-05-19 15:40 β Debounce slider changes to prevent rapid POSTs
Section titled β2026-05-19 15:40 β Debounce slider changes to prevent rapid POSTsβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#discussion_r3254517617
- Priority: nice-to-have
- Decision: accept
- Rationale: Reduces API calls and prevents race conditions by committing slider changes only on interaction end.
2026-05-19 15:45 β Ensure proper error handling in organizations fetch
Section titled β2026-05-19 15:45 β Ensure proper error handling in organizations fetchβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#discussion_r3254517608
- Priority: must-fix
- Decision: accept
- Rationale: Throws descriptive errors instead of silently returning, allowing proper error display in UI.
2026-05-20 15:30 β Final verification of CodeRabbit findings
Section titled β2026-05-20 15:30 β Final verification of CodeRabbit findingsβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025
- Priority: must-fix
- Decision: accept
- Rationale: All CodeRabbit findings addressed - console.error already fixed to Pino, Nanostores pattern properly implemented, UI state issues resolved.
2026-05-20 16:45 β Skip false positives - logging already implemented
Section titled β2026-05-20 16:45 β Skip false positives - logging already implementedβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#pullrequestreview-4305327736
- Priority: skip
- Decision: reject
- Rationale: Code already uses proper Pino structured logging (
logger.error({ err: error }, 'Feature flags API error')), finding was false positive.
2026-05-20 16:50 β Skip false positives - Nanostores pattern already implemented
Section titled β2026-05-20 16:50 β Skip false positives - Nanostores pattern already implementedβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#pullrequestreview-4305327736
- Priority: skip
- Decision: reject
- Rationale: Component already correctly uses Nanostores with
useStoreand proper atoms/computed values, finding was false positive.
2026-05-20 16:55 β Add request token guard for slider changes
Section titled β2026-05-20 16:55 β Add request token guard for slider changesβ- Comment: https://github.com/dboone31/erp-unlocked/pull/1025#discussion_r3254517617
- Priority: must-fix
- Decision: accept
- Rationale: Added request token mechanism to prevent stale responses from overwriting newer flag updates during rapid slider changes.
2026-05-21 03:00 β Fix stale-response guard with useRef (PR #1080 review)
Section titled β2026-05-21 03:00 β Fix stale-response guard with useRef (PR #1080 review)β- Comment: https://github.com/dboone31/erp-unlocked/pull/1080#discussion_r3279311233
- Priority: must-fix
- Decision: accept
- Rationale: The previous request-token guard captured
requestTokenfrom the same render snapshot ascurrentToken, so the equality check always passed and stale responses could still overwrite newer updates. Switched to auseRef-backed token that the closure can re-read afterawait.
2026-05-21 03:00 β Mirror write path in parseRollout (PR #1080 review)
Section titled β2026-05-21 03:00 β Mirror write path in parseRollout (PR #1080 review)β- Comment: https://github.com/dboone31/erp-unlocked/pull/1080#discussion_r3279311242
- Priority: must-fix
- Decision: accept
- Rationale:
upsertDefaultStatestores the rollout in the first multivariate variant only, so summing all variants here always produced 100%. Read the first variant so reads match writes.
2026-05-21 03:00 β Wrap flag catalog load in try/catch (PR #1080 review)
Section titled β2026-05-21 03:00 β Wrap flag catalog load in try/catch (PR #1080 review)β- Comment: https://github.com/dboone31/erp-unlocked/pull/1080#discussion_r3279311251
- Priority: nice-to-have
- Decision: accept
- Rationale: A missing or malformed
flags.jsonpreviously surfaced as a cryptic Node error; now it throws with the resolved path and the original error attached viacause.
2026-05-21 03:00 β Donβt return raw exception messages in 500s (PR #1080 review)
Section titled β2026-05-21 03:00 β Donβt return raw exception messages in 500s (PR #1080 review)β- Comment: https://github.com/dboone31/erp-unlocked/pull/1080#discussion_r3279311257
- Priority: must-fix
- Decision: accept
- Rationale: Exception messages can leak internal details to clients. Return a generic message and keep diagnostics in server logs only.