Skip to content

Owner decision required: six-digit override PIN, wrong guesses count against the cashier - #675

Merged
techmore merged 3 commits into
mainfrom
claude/decision-override-pin-lockout
Nov 19, 2026
Merged

techmore merged 3 commits into
mainfrom
claude/decision-override-pin-lockout

Conversation

@techmore

Copy link
Copy Markdown
Owner

Owner decision required. Do not merge before the off-site backups are on. Merging this is the "yes" to item (d) in docs/decisions/staff-controls-2026-11.md; closing it is the "no". main deploys to production.

Stacked on #671 (the decisions document and the tests that pin today's behaviour). Merge #671 first; this PR then shows only its own commit. No database migration.

The decision

Today a manager's override PIN can be four digits. Wrong guesses are counted against the manager whose name was picked, whoever typed them: five in 15 minutes lock that manager's PIN at every register. So any cashier can stop a manager approving anything, and a cashier guessing five at a time can get through every four-digit PIN in about three weeks.

What this changes

  • A new PIN must be 6 to 8 digits. A four or five digit PIN that is already set keeps working; nobody is locked out by this merge. It is replaced the next time that manager saves a PIN (Compliance → Override PIN).
  • Wrong guesses count against the signed-in person who typed them. Five wrong PINs in 15 minutes, or ten in a day, stop that person asking for overrides, from any manager. The manager's PIN keeps working for every other cashier.
  • The refusal now reads "Too many wrong PINs from this sign-in. Wait before asking for another override, or ask an owner." The PIN page's wording follows.

Not changed: who can approve, the reason rule, what can be overridden, the audit trail (every wrong PIN and lockout is still logged with the cashier's and the manager's names and shows on the exception report).

To know before saying yes

  • Managers with a short PIN should be asked to set a longer one; until they do, theirs can still be guessed at ten tries a day per cashier (about three years for four digits, instead of three weeks).
  • A manager who mistypes their own PIN five times at a cashier's register locks that cashier's sign-in for 15 minutes, not themselves. Another cashier's register, or an owner, still works.

Files

  • web/app/models/user.rb: pos_override_pin= asks for six digits
  • web/app/services/compliance/sale_gate.rb: locked_out? counts by the person who typed, with the day limit
  • web/app/views/compliance/override_pins/edit.html.erb: the wording and the field pattern
  • web/test/support/compliance_fixtures.rb: the fixture's four-digit PIN is stored as an earlier PIN would be

Tests

web/test/integration/staff_controls/override_pin_lockout_test.rb, rewritten from the characterization test in #671: a new four-digit PIN is refused and an existing one still verifies; five wrong PINs lock the cashier who typed them while a colleague's override with the same manager goes through; the lock follows the cashier to another manager; ten wrong in a day lock until the day has passed. compliance_sale_gate_test.rb and compliance_guardrails_test.rb updated for the six-digit rule.

  • bin/rails test test/integration/staff_controls test/integration/compliance_guardrails_test.rb test/services/compliance_*_test.rb test/services/pos_checkout_compliance_test.rb test/services/pos_event_sale_recorder_test.rb: 54 runs, 0 failures
  • bin/rubocop on the changed files: no offenses

🤖 Generated with Claude Code

techmore and others added 2 commits November 18, 2026 22:39
…he cashier

A new manager override PIN must be 6 to 8 digits; a shorter PIN set
earlier keeps working until it is next changed. Wrong PINs are counted
against the signed-in person who typed them (five in 15 minutes, ten in
a day) instead of the manager they picked, so a cashier can no longer
lock a manager's PIN for every register.

Owner decision required: docs/decisions/staff-controls-2026-11.md, item d.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Base automatically changed from claude/staff-controls-decisions to main November 19, 2026 12:20
@techmore
techmore marked this pull request as ready for review November 19, 2026 12:50
@techmore
techmore merged commit 1b9ea82 into main Nov 19, 2026
8 checks passed
@techmore
techmore deleted the claude/decision-override-pin-lockout branch November 19, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant