From 74d3bc4af77673631ae03e2d778258f4c3c3b926 Mon Sep 17 00:00:00 2001 From: Matt Mabrey Date: Tue, 6 Oct 2026 11:04:01 -0700 Subject: [PATCH] T12.4: CR-020 CSV upload (usernames only) POST /api/auth/bulk-users/resolve reads a list of usernames (first column; comma, semicolon or tab; header skipped) and answers line by line, the CR-005 validate-and-report pattern. A line is rejected, with its number and reason, when it names nobody the caller can see ('User not found', as everywhere else), an account they may not change (the single route's own reason), their own account, or a username already listed (duplicate of line N). An email address resolves only when exactly one account has it. Nothing is changed by this route. The console's 'Select from CSV' turns the accepted accounts into the ordinary selection (filter reset so every selected row is visible) and lists every rejected line. The action, confirm and per-row report are the checkbox ones, through the same T12.1 routes, which re-check each row: a CSV cannot reach an account a checkbox could not. Usernames only, action in the toolbar (decided 2026-10-06). Files over 1 MB are refused before upload; FileReader fallback for browsers without Blob.text(). bulk_users_check.py: 61/61. DOM harness: 40/40. --- html/users.html | 12 +++++-- html/users.js | 66 ++++++++++++++++++++++++++++++++++++ server/app.py | 71 +++++++++++++++++++++++++++++++++++++++ tests/bulk_users_check.py | 52 ++++++++++++++++++++++++++-- 4 files changed, 197 insertions(+), 4 deletions(-) diff --git a/html/users.html b/html/users.html index ca2133b..01a8f3d 100644 --- a/html/users.html +++ b/html/users.html @@ -38,8 +38,10 @@ .whoami-chip strong{ color:var(--text); } /* CR-020: row selection and the bulk bar. Tokens only (the token rule). */ - #sel-banner:not(:empty), #bulk-banner:not(:empty){ margin-bottom:var(--s3); } - #bulk-banner ul{ margin:var(--s1) 0 0; padding-left:var(--s5); font-weight:400; } + #sel-banner:not(:empty), #bulk-banner:not(:empty), #csv-banner:not(:empty){ margin-bottom:var(--s3); } + #bulk-banner ul, #csv-banner ul{ margin:var(--s1) 0 0; padding-left:var(--s5); font-weight:400; + max-height:220px; overflow:auto; } + #csv-btn[hidden]{ display:none; } table.grid th.selcell, table.grid td.selcell{ width:1%; padding:0 var(--s1); text-align:center; } /* The label is the hit area: the 16px box alone is under the 24px floor. */ .selhit{ display:inline-flex; align-items:center; justify-content:center; @@ -111,8 +113,14 @@ + + +
+