Repository navigation
feat: record classifier results and hold releases in an append-only log - #1318
Conversation
Safety flags stay on ai.* rows. Each classification and each hold release appends a file_events row, including the content hash, so the history survives an overwrite. Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one): 2
🚫 Excluded labels (none allowed): 1
Please check the settings in the CodeRabbit UI or the
|
Drop the extra readers, the fake D1 table, and the repeated cases. The log, the release override, and the missing-migration no-op stay. Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
Object delete and retention no longer erase file_events. An override records the bytes' hash, or the approve fails. Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
Approve refuses a file whose bytes have no hash. The held-file test puts that hash on the object. Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
The in-memory bucket now returns custom metadata. The preview double's empty object has to match that type. Co-authored-by: Zach Dunn <zachdunn@users.noreply.github.com>
Classifier safety flags stay where the model wrote them. This adds an append-only log of each classification attempt and of each hold release, so that history survives an overwrite and a delete. A member release is its own record. It does not edit
ai.secretor the other flags. This is step 1 of the storage redesign for Zach Dunn (@zachdunn) (issue #1136).What it does / what it is not
file_eventsrow forclassified,reused_exact,reused_perceptual,skipped(with the reason), andfailed. Each row stores the model, the classifier version, the safety answers, and the content hash.content-sha256, or from the body copied back out of the held bucket. If that hash is unknown, approve and hold fail. The row records who, when, and the flags in force. It does not changeai.secret,ai.pii,ai.rating, orai.content.ai.*rows before reclassification. Holds, comment rendering, and classifier reuse stay as they are.(workspace, content_sha256, id)index stays for the hold projection in feat: key hold decisions by content hash #1319.How to try it
There is no new CLI flag. A release still looks the same:
The new rows are in D1 (
file_events).uploads meta getstill shows the currentai.*rows, includingai.hold.Technical notes
ai.hold=approvedis still written on this branch. #1319 stops that. A database that has not applied the migration still classifies and still approves when the content hash is known; the append is skipped. An override is never stored with a null hash.Test plan
skipped, thenclassified, thenreused_exactapproveUploadappends a release override with the object's content hash and does not change the safety flagslist_held, get_metadata, and approve)pnpm --filter @uploads/api exec tsc --noEmitvia the pre-commit typecheck8bd2f3ef. An earlier Test job failed because the MCP fixture had no content hash, and the next Lint job failed because the in-memory bucket's metadata type no longer matched a test double. Both are fixed on this commit.