Repository navigation
feat(history): unified change history API - #456
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of PlaceOS/models#336
Exposes the unified change history from models (PlaceOS/models#337, #338), and attributes every change to the request that made it.
Changes
Applicationaround filter wraps each request inHistory.with_metadata.history_metadata(request, current_user)records the user, the API key,X-App-Id/Name/Date/Build, the user agent, the client IP and the request id. Header values are capped at 256 characters.authorize!has run.authorize!now keeps theapi_keyit authenticated with.GET /api/engine/v2/history(admin), newest first, paginated. It filters on:resource_typesandexclude_resource_types(table names)resource_idcorrelation_iduser_idactionsperiod_startandperiod_endGET /api/engine/v2/history/:id(admin): returns one entry.POST /api/engine/v2/history/undelete?resource_type=&resource_id=(admin): restores the latest deleted version, keeping its id. It returns:/group_history: now returnsHistoryentries correlated to the group, with the same permissions as before. Breaking: the response shape changes fromGroupHistorytoHistory.acting_userassignments are removed, since changes are now attributed by the around filter.Review
spec/controllers/history_spec.crspec/controllers/groups/history_spec.cralso checks correlation, attribution and show../testcompiles out of memory in the local Docker VM, so I ran them withcrystal specon the host against the compose database. The full suite runs in CI.🤖 Generated with Claude Code