Skip to content

ADR β€” PR #1030

This document captures decisions made in response to CodeRabbit feedback on PR #1030.

  • Comment: CodeRabbit feedback on fetch calls around line 62-64
  • Priority: skip
  • Decision: skip
  • Rationale: All fetch calls in OrgBilling.tsx already implement AbortController with 30-second timeout. The pattern (create controller, pass signal, set timeout, clear timeout) is correctly applied in loadBilling, OverrideModal.handleSave, and FreeTrialModal.handleSave.

2026-05-20 β€” Modal dialog semantics already implemented

Section titled β€œ2026-05-20 β€” Modal dialog semantics already implemented”
  • Comment: CodeRabbit feedback on modal around line 718-736
  • Priority: skip
  • Decision: skip
  • Rationale: The ModalShell component already implements all required accessibility features: role="dialog", aria-modal="true", aria-labelledby="modal-title", aria-describedby="modal-desc", explicit ids on title/subtitle elements, Escape key handler to call onClose, focus trap via useRef with tabindex, and restore focus on close.
  • Comment: CodeRabbit feedback on currentPeriod calculation
  • Priority: skip
  • Decision: skip
  • Rationale: The currentPeriod calculation in org-billing-data.ts line 193-200 uses monthlyData.find(...) ?? null which correctly returns null when no current-month row exists. There is no fallback to monthlyData[0] in the current code.

2026-05-20 β€” grantFreeTrialSchema already requires integer

Section titled β€œ2026-05-20 β€” grantFreeTrialSchema already requires integer”
  • Comment: CodeRabbit feedback on free-trial.ts schema
  • Priority: skip
  • Decision: skip
  • Rationale: The grantFreeTrialSchema in free-trial.ts uses z.number().int().positive() for the amount field, already enforcing that only positive integers are accepted.

2026-05-20 β€” updateOverrideSchema already enforces non-negative values

Section titled β€œ2026-05-20 β€” updateOverrideSchema already enforces non-negative values”
  • Comment: CodeRabbit feedback on override.ts schema
  • Priority: skip
  • Decision: skip
  • Rationale: The updateOverrideSchema in override.ts already enforces the correct constraints: minOrderCharge, perLineItemRate, and accountCredit use .min(0); freeTrialLineItems uses .int().min(0).optional(). Negative and fractional values are rejected.

2026-05-20 β€” Add useEffect dependency array for modal keyboard handler

Section titled β€œ2026-05-20 β€” Add useEffect dependency array for modal keyboard handler”
  • Comment: CodeRabbit feedback on modal keyboard handler
  • Priority: nice-to-have
  • Decision: accept
  • Rationale: The ModalShell component’s useEffect was missing onClose in its dependency array. Without this, the keyboard handler might reference a stale onClose function. Added [onClose] dependency to ensure the handler always calls the latest close function.