Add audit trail functionality for collections #198

Merged
cmo merged 17 commits from audit-trail into master 2026-03-17 09:03:05 +00:00
Owner

This PR introduces a git-based audit trail backend. An audit trail can be added to any collection. On curated write, it is automatically records timestamp, user-id, diff, and the resulting record. Reports can be generated based on PIDs.

The backend tries to minimize git commit calls. It will only commit the changes in the current worktree, if a new audit-entry would overwrite them.

This PR introduces a git-based audit trail backend. An audit trail can be added to any collection. On curated write, it is automatically records timestamp, user-id, diff, and the resulting record. Reports can be generated based on PIDs. The backend tries to minimize git commit calls. It will only commit the changes in the current worktree, if a new audit-entry would overwrite them.
add a git-based audit trail backend
Some checks failed
Test execution / Test-all (push) Failing after 58s
f3c20c913e
use three-level directory hierarchies for files
Some checks failed
Test execution / Test-all (push) Failing after 1m0s
c1287e65b9
add change reports for IDs
Some checks failed
Test execution / Test-all (push) Failing after 51s
acc0981336
This commit adds a method that reports all
changes that were applied to a record with
a specific ID.

The report is a dictionaries. The keys are
ISO timestamps, the values are tuples containing
the following entries:

0: the user id that did the change
2: the git diff of the change
3: the content of the record after the change
implement worktree-free audit trail
Some checks failed
Test execution / Test-all (push) Failing after 49s
87f8e91011
Add changes directly to git-index, and
commit from there. This keeps the worktree
empty.
cmo force-pushed audit-trail from 87f8e91011
Some checks failed
Test execution / Test-all (push) Failing after 49s
to e49ca98c1b
Some checks failed
Test execution / Test-all (push) Failing after 52s
2026-03-13 15:17:46 +00:00
Compare
use apply_change_set
Some checks failed
Test execution / Test-all (push) Failing after 44s
016576a6eb
Use the code from the minilad branch of
datalad-core.
add audit-backdend handling
Some checks failed
Test execution / Test-all (push) Failing after 49s
f0451da314
This commit adds `audit_backends` to configuration
specifications. It also adds audit trails for every
record that is stored via the curator-interface.

For each record that is stored via the curator interface,
an audit entry is added to every audit-backend. The
audit entry contains:

1. timestamp when the record was added to the audit trail
2. the id of the token that was used to store the record
3. the changes that were made to the record (git diff format)
4. the content of the new record

The audit trail for a given PID can be printed by
using the command:

	dump-things-report-gitaudit <git-audit-dir> <PID>
add reference to branch minilad of datalad-core
Some checks failed
Test execution / Test-all (push) Failing after 57s
581948edbf
remove unused import from test_gitaudit.py
Some checks failed
Test execution / Test-all (push) Failing after 1m9s
89c7252d63
set git-identity before runing tests
All checks were successful
Test execution / Test-all (push) Successful in 2m1s
e5f648a86f
cmo changed title from WIP: add audit trail functionality for collections to Add audit trail functionality for collections 2026-03-16 14:13:36 +00:00
add audit-backend documentation
All checks were successful
Test execution / Test-all (push) Successful in 2m2s
ee6c3a2f15
This commit adds a description of the
audit-backend of type `git-audit`. That
means, it describes its configuration and
features in the changelog and in
`README.md`.

It also adds a short description of the
associated reporting tool, i.e, of
`dump-things-report-gitaudit`.
refactor GitAuditBackend
All checks were successful
Test execution / Test-all (push) Successful in 2m2s
300a32665e
Introduce an abstract `AuditBackend` base
class and derive `GitAuditBackend` from the
base class.
cmo merged commit dc089724f5 into master 2026-03-17 09:03:05 +00:00
cmo deleted branch audit-trail 2026-03-17 09:03:14 +00:00
Sign in to join this conversation.
No description provided.