Skip to content

feat: record classifier results and hold releases in an append-only log - #1318

Merged
Zach Dunn (zachdunn) merged 5 commits into
mainfrom
cursor/classifier-event-log-e3dd
Oct 28, 2026
Merged

Zach Dunn (zachdunn) merged 5 commits into
mainfrom
cursor/classifier-event-log-e3dd

Conversation

@zachdunn

@zachdunn Zach Dunn (zachdunn) commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

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.secret or the other flags. This is step 1 of the storage redesign for Zach Dunn (@zachdunn) (issue #1136).

What it does / what it is not

  • Appends a file_events row for classified, reused_exact, reused_perceptual, skipped (with the reason), and failed. Each row stores the model, the classifier version, the safety answers, and the content hash.
  • Appends an override when a hold is released or held again. The hash comes from the object's 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 change ai.secret, ai.pii, ai.rating, or ai.content.
  • Deleting a file, the retention sweep, and the source delete inside an attach move leave the log in place. Only workspace teardown removes a workspace's rows.
  • New bytes still clear the current ai.* rows before reclassification. Holds, comment rendering, and classifier reuse stay as they are.
  • Not the sign-in wall or redaction. Not content-addressed storage. The (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:

uploads approve <key>

The new rows are in D1 (file_events). uploads meta get still shows the current ai.* rows, including ai.hold.

Technical notes

ai.hold=approved is 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

  • One upload path appends skipped, then classified, then reused_exact
  • approveUpload appends a release override with the object's content hash and does not change the safety flags
  • Approve fails when the object has no content hash
  • The MCP held-file test stores that hash on the object (list_held, get_metadata, and approve)
  • pnpm --filter @uploads/api exec tsc --noEmit via the pre-commit typecheck
  • CI on 8bd2f3ef. 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.
Open in Web Open in Cursor 

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>
@changeset-bot

changeset-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8bd2f3e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 2
  • coderabbit:review
  • review
🚫 Excluded labels (none allowed): 1
  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 67463dac-ee24-4f28-aff6-02a6393b93ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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>
@zachdunn
Zach Dunn (zachdunn) merged commit a4297b2 into main Oct 28, 2026
4 checks passed
@zachdunn
Zach Dunn (zachdunn) deleted the cursor/classifier-event-log-e3dd branch October 28, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants