feat(gdpr): author erasure (PR5 of #6701)#7550
Conversation
Review Summary by QodoGDPR Art. 17 author anonymization with REST API endpoint
WalkthroughsDescription• Implement GDPR Art. 17 right-to-erasure via anonymizeAuthor(authorID) function - Zeroes display identity (name, colorId) on globalAuthor:<id> record - Deletes all token2author:* and mapper2author:* bindings pointing to author - Nulls authorId on chat messages posted by the author - Preserves pad content, revisions, and attribute pools for data integrity • Add REST endpoint POST /api/1.3.1/anonymizeAuthor?authorID=… with admin JWT/apikey auth • Implement idempotent erasure with zero-counter returns on subsequent calls • Add comprehensive unit and integration tests covering identity zeroing, mapping removal, idempotence, and error handling • Document erasure behavior and limitations in doc/privacy.md Diagramflowchart LR
A["Author Request<br/>authorID"] -->|POST /api/1.3.1/anonymizeAuthor| B["API Handler"]
B -->|validates authorID| C["AuthorManager.anonymizeAuthor"]
C -->|1. Delete token/mapper bindings| D["token2author:*<br/>mapper2author:*"]
C -->|2. Zero identity| E["globalAuthor:id<br/>name=null, colorId=0"]
C -->|3. Null chat authorId| F["pad:id:chat:n<br/>authorId=null"]
C -->|Returns counters| G["Response<br/>affectedPads, removedMappings"]
D -.->|Removed| H["DB"]
E -.->|Updated| H
F -.->|Updated| H
File Changes1. src/node/db/AuthorManager.ts
|
Code Review by Qodo
1. anonymizeAuthor lacks feature flag
|
| version['1.3.1'] = { | ||
| ...version['1.3.0'], | ||
| anonymizeAuthor: ['authorID'], | ||
| }; | ||
|
|
||
| // set the latest available API version here | ||
| exports.latestApiVersion = '1.3.0'; | ||
| exports.latestApiVersion = '1.3.1'; |
There was a problem hiding this comment.
1. anonymizeauthor lacks feature flag 📘 Rule violation ☼ Reliability
The new anonymizeAuthor REST/API surface is registered unconditionally and becomes available by default, without any enable/disable mechanism. This violates the requirement that new features be gated behind a feature flag and disabled by default.
Agent Prompt
## Issue description
A new feature (`anonymizeAuthor` API/REST endpoint) is enabled by default and has no feature-flag gating.
## Issue Context
Compliance requires new features to be behind a feature flag and disabled by default.
## Fix Focus Areas
- src/node/handler/APIHandler.ts[146-152]
- src/node/db/API.ts[65-77]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Qodo review: the `erased: true` sentinel was written before the chat scrub loop, so a throw during scrub left chat messages untouched while subsequent calls short-circuited on `existing.erased` and never finished. Split the write: zero the display identity first (still hides the name), run the chat scrub, and only then stamp `erased: true` so a retry resumes the sweep. Regression test covers the partial-run → retry path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
authorManager.anonymizeAuthor(authorID)zeroes the display identity onglobalAuthor:<id>(keeps the record as an opaque stub so existing changeset references still resolve), deletes everytoken2author:*andmapper2author:*binding that points at the author, and nullsauthorIdon chat messages they posted. Pad content, revisions, and attribute pool are kept intact.POST /api/1.3.1/anonymizeAuthor?authorID=…— admin-auth via the existing apikey/JWT pipeline.doc/privacy.mdexplains exactly what the call does and does not do.Final PR of the #6701 GDPR work. PR1 #7546 (deletion controls), PR2 #7547 (IP/privacy audit), PR3 #7548 (HttpOnly author cookie), PR4 #7549 (privacy banner) complete the set.
Design:
docs/superpowers/specs/2026-04-19-gdpr-pr5-author-erasure-design.mdPlan:
docs/superpowers/plans/2026-04-19-gdpr-pr5-author-erasure.mdTest plan