Address the 11 October test report findings #2

Merged
denis_ireri merged 1 commits from fix/test-report-followups into main 2026-10-12 07:37:16 +00:00
Contributor

Addresses the findings in the initial test report (11 October 2026), which was run on the build before #1. Details and rollout notes: docs/PILOT_READINESS.md ("Follow-ups from the 11 October 2026 test report").

Findings addressed

Finding Change
F-01 Trial allows 1 branch A business on its free trial may run 2 active branches, whatever its tier. Only active branches count towards any limit.
F-03 Reversed report dates Refused by the page and the API (400). The page labels which period the cards show. Report dates are Nairobi business days.
F-04 No way back for deactivated products "Show deactivated products" toggle with Reactivate. Deactivating warns about stock still on hand; that stock stays on the Stock page so it can be transferred or counted out.
F-05 Eggs shown as litres Products carry a unit: L, ml, kg, g, pcs, tray, pack.
F-06 No branch removal Branches page: rename, deactivate, reactivate. A branch can only be deactivated once it has no stock and no active staff; its history stays in reports.
F-07 Purchases shown as cost of goods Cost of goods sold = units sold x average buying price. Stock bought in the period is shown separately as "Stock purchased", with a "Cash surplus" line.
STA-04 No invites Staff and new branch managers can be invited with a one-time, 7-day link (copy or WhatsApp share); the person sets their own password.
CAT-12 Zero price, duplicates Prices must be above zero; product names are unique per business, ignoring case.
OFF-02 Local stock deduction The till shows each product's stock and deducts every sale immediately, online or offline.
POS-02 / INV-05 Oversell, cancel The till warns and asks to confirm before selling more than the recorded stock (it does not block, since the sale may already have happened). Adds a Clear sale button.

Also adds npm run backfill:stock, which turns purchases recorded before the stock ledger into stock.

Testing

  • npm test: 50 API tests pass. tests/retest-plan.test.ts runs the report's completion and retest plan (pages 9-10) and checks every balance and total it predicts: 18/9 after the online sale, 13/5 after the transfer, two offline sales replayed twice recorded once, final 3L stock 10/4 and 5L 8, revenue KES 320 / 40 / 360.
  • Production build passes.
  • Headless Chrome offline check (12 steps): terminal opens with the server unreachable, deducts stock locally for offline sales, and syncs them exactly once on reconnect.
  • Checked in the browser: reversed-date refusal, branch deactivation refused while it holds stock, product deactivation warning, oversell warning.

After deploying, before re-testing on ZERRO

  1. Run npm run backfill:stock once so the existing test purchases count as stock. Run it before anyone records an opening count, or those units would be counted twice.
  2. ZERRO is trialling, so it can add Branch B without a plan change.
  3. Create the manager and cashier logins with invite links from Staff.
  4. Optional: set APP_URL if invite links should use a different public address than the one requests arrive on.

🤖 Generated with Claude Code

Addresses the findings in the initial test report (11 October 2026), which was run on the build before #1. Details and rollout notes: `docs/PILOT_READINESS.md` ("Follow-ups from the 11 October 2026 test report"). ## Findings addressed | Finding | Change | |---|---| | F-01 Trial allows 1 branch | A business on its free trial may run **2 active branches**, whatever its tier. Only active branches count towards any limit. | | F-03 Reversed report dates | Refused by the page and the API (400). The page labels which period the cards show. Report dates are Nairobi business days. | | F-04 No way back for deactivated products | "Show deactivated products" toggle with Reactivate. Deactivating warns about stock still on hand; that stock stays on the Stock page so it can be transferred or counted out. | | F-05 Eggs shown as litres | Products carry a unit: L, ml, kg, g, pcs, tray, pack. | | F-06 No branch removal | Branches page: rename, deactivate, reactivate. A branch can only be deactivated once it has no stock and no active staff; its history stays in reports. | | F-07 Purchases shown as cost of goods | Cost of goods sold = units sold x average buying price. Stock bought in the period is shown separately as "Stock purchased", with a "Cash surplus" line. | | STA-04 No invites | Staff and new branch managers can be invited with a one-time, 7-day link (copy or WhatsApp share); the person sets their own password. | | CAT-12 Zero price, duplicates | Prices must be above zero; product names are unique per business, ignoring case. | | OFF-02 Local stock deduction | The till shows each product's stock and deducts every sale immediately, online or offline. | | POS-02 / INV-05 Oversell, cancel | The till warns and asks to confirm before selling more than the recorded stock (it does not block, since the sale may already have happened). Adds a Clear sale button. | Also adds `npm run backfill:stock`, which turns purchases recorded before the stock ledger into stock. ## Testing - `npm test`: 50 API tests pass. `tests/retest-plan.test.ts` runs the report's completion and retest plan (pages 9-10) and checks every balance and total it predicts: 18/9 after the online sale, 13/5 after the transfer, two offline sales replayed twice recorded once, final 3L stock 10/4 and 5L 8, revenue KES 320 / 40 / 360. - Production build passes. - Headless Chrome offline check (12 steps): terminal opens with the server unreachable, deducts stock locally for offline sales, and syncs them exactly once on reconnect. - Checked in the browser: reversed-date refusal, branch deactivation refused while it holds stock, product deactivation warning, oversell warning. ## After deploying, before re-testing on ZERRO 1. Run `npm run backfill:stock` once so the existing test purchases count as stock. Run it **before** anyone records an opening count, or those units would be counted twice. 2. ZERRO is trialling, so it can add Branch B without a plan change. 3. Create the manager and cashier logins with invite links from Staff. 4. Optional: set `APP_URL` if invite links should use a different public address than the one requests arrive on. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
denis_ireri added 1 commit 2026-10-12 07:30:26 +00:00
The initial test report (run before the pilot-readiness changes) raised
seven findings and a retest plan. This closes the ones still open.

- F-01: a business on its free trial may run 2 active branches whatever
  its tier, so an owner can try transfers and per-branch stock. Only
  active branches count towards any limit.
- F-06: owners can rename branches and deactivate/reactivate them from
  the Branches page. A branch can only be deactivated once it holds no
  stock and no active staff; its history stays in every report, and it
  leaves every picker.
- F-04: the Products page lists deactivated products under a toggle with
  Reactivate. Deactivating warns about stock still on hand, which stays
  on the Stock page so it can be transferred or counted out.
- F-05: products carry a unit (L, ml, kg, g, pcs, tray, pack) instead of
  everything being litres.
- CAT-12: product prices must be above zero and names are unique per
  business, ignoring case.
- F-03: a reversed report period is refused by the page and the API, and
  the page labels which period the cards show. Report dates are Nairobi
  business days.
- F-07: cost of goods sold is units sold x average buying price. Stock
  bought in the period is reported separately, with a cash surplus line,
  so unsold stock no longer shows as a loss.
- STA-04: staff and new branch managers can be invited with a one-time,
  7-day link; the person sets their own password. Managers can issue a
  new link for their own cashiers.
- OFF-02 / POS-02: the till shows each product's stock and deducts every
  sale immediately, online or offline; it warns before selling more than
  the recorded stock, and has a Clear sale button.
- npm run backfill:stock turns purchases recorded before the stock ledger
  into stock, so existing tenants (and the report's ZERRO fixtures) start
  from what they bought.

tests/retest-plan.test.ts runs the report's completion and retest plan
and checks every balance and total it predicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
denis_ireri merged commit 38facd3d9d into main 2026-10-12 07:37:16 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Ezekiel_Nyangweso/ERP#2