People access patterns on tee-admin: typeahead, offices, ecclesia directory, CARD #278
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.50) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 635 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · 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.386
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #278"
general
weight: 0.35
claude[bot]
Closes #275. Phase 2 step 0 of epic #270 (ADR-0006 §8, plan §7).
What
New derived projection items on
tee-admin. They are sparse entries on the existing GSIs; no GSI is added. Code lives inpackages/app/provider/dynamodb/people-index/:keys.tsderives (pure),projections.tswrites,reader.tsreads.| Pattern | Item / index entry | Only writer |
|---|---|---|
| 3 typeahead |
PERSON#<id> / NAMETOK#<token>, gsi3NAMEPFX#ALL#<2 letters>|personRepository|| 4 everyone / by ecclesia, 10 BatchGet |
PERSON#<id> / CARD, gsi4PEOPLE#ALL, gsi2ECCPEOPLE#<ecclesiaId>|personRepository|| 7 stable id, 9 all ecclesias |
ECCLESIA_ID#<id> / ECCLESIA(points at the ECCLESIA key), gsi2ECCLESIAS; RB-email sign-in entry on gsi1RBEMAIL#|locations.ts|| 8/11 RB office |
ECCLESIA_ID#<id> / OFFICE#RB#<pid>+PERSON#<pid> / OFFICE#<id>#RB|locations.ts|| 8/11/12 REP office |
… OFFICE#REP#<pid>+… OFFICE#<id>#REP|personRepository|ecclesiaIdand carried across renames, where the alias is re-pointed.One writer, always in sync
PersonRepositoryre-derives a person's projections after every write to a PROFILE, EMAIL# or PHONE# item. That covers the named methods and the baseput/update/delete, so the directpersonRepository.update(...)callers (the SES cron, contact.ts, scripts) are covered too.locations.tsdoes the same on ecclesia create, update, rename and delete.PEOPLE_INDEX_WRITES=off.Scans removed from request paths
Each of these switches to Query/BatchGet once the backfill marker
PEOPLE_INDEX#META/BUILDexists. Before that, the legacy read stays in charge, so a deploy cannot show a short list.| Was | Now |
|---|---|
|
app/api/people/route.ts:94listAlland:104getAllPhonesByPerson(two full Scans) | one gsi4 Query of CARDs ||
app/api/people/guests/route.ts:70listAll| the same ||
utils/dynamodb/locations.ts:346(picker/search),:403(by country),:465getAllEcclesia| directory Query plus BatchGet ||
locations.ts:680RB Scan in sign-in (auth.ts:134,256,341) | gsi1RBEMAIL#Query, behind thepeople_index_signinflag (default off) ||
person-repository.tscount()andgetByGoogleId()| deleted (no callers) |Bug found on the way:
getAllEcclesiaand the RB lookup were single-page Scans. TodaygetAllEcclesiareturns 35 of the 39 ecclesias, and the RB lookup can miss in the same way. The index fixes both.Not changed (reported on #270)
sync-ses-contacts, the exhorter heads-up,listInterEcclesiaReps.rb-service.findCurrentRBand theset-roleScans.credentials-users.ts(auth cutover is Phase 2 step 3).Backfill
scripts/rebuild-people-projections.ts:--applyrequires--after-deploy.s3://tee-admin-backups/backups/<date>-people-index-backfill/before writing.Dry run against prod, read-only:
| | count |
|---|---|
| Source: PERSON# partitions | 185 |
| Source: PROFILEs | 180 |
| Source: ECCLESIA items | 39 |
| Existing projection items | 0 |
| Planned: CARD | 180 put |
| Planned: NAMETOK | 300 put |
| Planned: REP office refs | 70 put |
| Planned: RB office refs | 10 put |
| Planned: ecclesia directory | 39 put |
| Deletes | 0 |
| Ecclesia id collisions | 0 |
The run happens only after this merges and deploys (see
EXTERNAL_CHANGES.md).Tests
tests/people-index-keys.test.ts: derivation, the key guard, and diff idempotency.tests/people-index-sync.test.ts: uses an in-memory DynamoDB and the realPersonRepositoryandlocations.tswrite paths.- Create, rename, phone/email change, bounce, base update/delete, REP move/clear, RB assign/clear and ecclesia rename/delete keep the projections in sync.
- A re-run is a no-op and writes no source item.
- The indexed reads make no Scan.
- The directory loader returns the same people from the index as from the Scan.
main. The PR adds 20 new passing tests.yarn lint: no new errors. typecheck: pass.next build: pass.Known limitation
Two concurrent writes to the same person can race their refreshes. The next write or a rebuild repairs this. People change rarely.
🤖 Generated with Claude Code
https://claude.ai/code/session_013tgTQCXN3wSxnLue5J49Bs