feat(revisions): property changes should auto-create revisions #173
Reference in New Issue
Block a user
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?
Context
From GAP_ANALYSIS.md Open Question #1: "Should editing properties auto-create revision?"
Decision: Yes. All item field changes should create a revision for full audit trail.
Current Behavior
PUT /api/items/{partNumber}ininternal/api/handlers.go:HandleUpdateItemupdates item metadata fields (part_number,description,item_type,sourcing_type,long_description) directly in theitemstable without creating a revision. A revision is only created when thepropertiesJSONB field is included in the request body.This means metadata changes (e.g. renaming a part, changing its type, updating its description) leave no trace in revision history.
Proposed Behavior
When any field on an item changes via
PUT /api/items/{partNumber}:"description changed from X to Y")part_number,description, etc.) continue to be updated in theitemstable as beforeEdge Cases
skip_revisionflag for import endpointsFiles to Modify
internal/api/handlers.go—HandleUpdateItem()(lines ~654-714): detect metadata changes, create revision when any field differsinternal/db/items.go— may need aGetLatestRevision()helper to snapshot current propertiesRelated
migrations/001_initial.sql,migrations/007_revision_status.sql