EMS Management: supply inventory foundation (E1) #97
All Vouch review confidence checks passed
Residual risk 0.37 = Change Risk (0.46) × (1 − Review Confidence (0.20)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 471 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 26% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.368
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #97"
general
weight: 0.35
chatgpt-codex-connector[bot]
What
The first slice (E1) of EMS Management: a new EMS Supply Inventory page under a new EMS sidebar group, with its module, permissions, rules, server logic and tests.
- Lots are picked first-expiring-first (FEFO) by default, or first-in-first-out (FIFO) as a department setting.
- Expired stock is never used, and stock never goes below zero.
How
emsInventory*callables infunctions/lib/emsInventory/. Infirestore.rulesevery new collection hasallow write: if false.T-{requestId}is created withcreate(), so a retry or double tap returns the first result instead of moving stock twice.emsManagement, plus six permissions:-
viewEmsInventory-
useEmsSupplies-
manageEmsInventory-
approveEmsInventoryAdjustments-
manageEmsSettings-
viewEmsAuditBuilt-in role defaults are set in
defaultRoles.jsand the server JSON, which the existing tests keep in sync. The permission table is indocs/ems/IMPLEMENTATION_REPORT.md.emsInventoryTransactionssupport the History filters.docs/ems/REPOSITORY_DISCOVERY.mdcovers:- how the full EMS spec maps onto this codebase
- the E1–E9 slice plan
- security findings in existing code, not changed here:
auditLogsis writable by members, and the storage read rule is broad.Testing
- 18 unit tests on the stock rules.
- 18 function tests against the emulator, including:
- retry and double-submit deduct only once
- two people taking the last unit (one wins, nothing goes negative)
- permissions per role, and other departments refused
- counts and reversals
- 5 rules tests.
For reviewers
- Crews can record use at any location, not only their assigned unit.
- No reservations, and one item per transaction.
- No expiration alerts or notifications yet.
- "Today" for expiration is the UTC date.
emsManagementadded in the Creator Console. Nothing existing changes behaviour.🤖 Generated with Claude Code