feat: user attribution on notes — track who creates and edits #268
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-api#268
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Depends on dual auth middleware issue (must land first). Part of pal-e-app "app definition" compliance.
Repo
forgejo_admin/pal-e-apiUser Story
As a pal-e-app user, I want to see who created and last edited a note so that I know who to ask about it.
As a platform operator, I want authoritative edit tracking so that
revised_byreflects actual identity, not free-text strings.Context
Notes have
revised_by(free-text String(500)) on NoteRevision (models.py line 201). It's client-provided and unverified — agents pass "PR #42", humans pass nothing. There's nocreated_byon notes at all. With JWT auth in place from the dual auth ticket, the API can auto-populate these from the authenticated user's token claims.File Targets
Files the agent should modify or create:
src/pal_e_docs/models.py— addcreated_by_sub,created_by_name,updated_by_sub,updated_by_namecolumns to Note modelsrc/pal_e_docs/schemas.py— add attribution fields to NoteOut responsesrc/pal_e_docs/routes/notes.py— wire auto-populate from UserContext on create/update, add?created_by_sub=filter paramalembic/versions/— new migration file for the 4 new columnsFiles the agent should NOT touch:
src/pal_e_docs/auth.py— already modified in the dual auth ticketAcceptance Criteria
created_by_namein API responseupdated_by_namein API responseGET /notes?created_by_sub={sub}returns only that user's notesrevised_byauto-populated from JWT name when presentTest Expectations
GET /notes?created_by_sub=Xreturns correct subsetpytest tests/ -vConstraints
revised_bystays as String(500) on NoteRevision — auto-populate from token name but don't change the column typeChecklist
Related
pal-e-docs— project this affects