feat: activity log producers
This commit is contained in:
1 parent
50b1649965
commit
e37a46a027
93 files changed
+3396
-440
No files matched your search
+34
@@ -49,6 +49,40 @@ are UTC. The list answers `{ items, total, page, size }`, newest first (`created
|
||||
`{"activity_retention_days": 30}` is session only and owner only (403 "Only the owner can do this.");
|
||||
any other value answers 400.
|
||||
|
||||
### What is recorded
|
||||
Every real action is recorded by its use case, once, after the change was made (outcome `success`)
|
||||
or after the use case refused it (outcome `failed`, with a plain `failure_reason`). Nothing is
|
||||
recorded for a read (no `GET`, no list, no public article read, no status poll), for a request that
|
||||
fails validation, or for a target that does not exist (404). A failed audit write is logged and
|
||||
never changes the response or the change itself.
|
||||
|
||||
| Category | Actions |
|
||||
| --- | --- |
|
||||
| `articles` | `article.create`, `article.edit`, `article.publish`, `article.unpublish`, `article.delete` |
|
||||
| `media` | `media.upload`, `media.rename`, `media.delete`, `media.merge`, `media.purge` |
|
||||
| `users` | `user.register`, `user.verify`, `user.update_profile`, `invite.create`, `invite.cancel`, `invite.renew`, `invite.accept` |
|
||||
| `system` | `system.media_purge` (scheduled), `system.update_checked`, `system.update_downloaded`, `system.restart_requested`, `system.activity_cleanup`, `system.activity_retention_changed` |
|
||||
|
||||
Target types: `article`, `image`, `user`, `invite`, `api_key` and `release` (id and name are the tag).
|
||||
Only the fields `title`, `online`, `body`, `filename` and `display_name` appear in `changes`, with the
|
||||
kinds `text` and `body`; a body edit carries a signed character count delta and never the text. A
|
||||
change that leaves a value as it was (same body, same publish state, same file name, same display
|
||||
name) records nothing. Params: `media.merge` and `media.purge` and `system.media_purge` carry
|
||||
`merged` and `articles_updated`, plus `failed_groups` when a group failed (still outcome `success`);
|
||||
`system.update_checked` carries `update_available`; `system.restart_requested` carries `kind` and,
|
||||
for an update, `tag` (it has no target). `system.update_downloaded` is recorded when the job reaches
|
||||
`ready` or `failed`, with the origin captured at request time; a refusal at the start is recorded
|
||||
immediately. A failed registration or invite acceptance has an `anonymous` actor named by the
|
||||
attempted username.
|
||||
|
||||
`failure_reason` is one fixed sentence per domain error, matched with `errors.Is`, at most 255
|
||||
characters, for example "The title must be between 3 and 200 characters.", "That file name is not
|
||||
valid.", "The merge request is not valid.", "A purge is already running.", "Registration is closed
|
||||
on this site.", "That invitation has expired.", "The release feed could not be reached." or "The
|
||||
update could not be downloaded.". Any other error becomes "Something went wrong on our side. Please
|
||||
try again."; the text of the error never reaches the event, the API or the CSV. Passwords, hashes,
|
||||
codes, article bodies, file bytes, storage paths and asset urls are never recorded.
|
||||
|
||||
Article routes accept `?format=markdown|html|json` (default `markdown`). `GET /v1/media/` accepts
|
||||
`q`, `hash`, `cursor`, `filter`, `sort` and `limit`.
|
||||
|
||||
|
||||
Reference in new issue
Block a user