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

17 commits

Author SHA1 Message Date
Christian Monch
300a32665e refactor GitAuditBackend
All checks were successful
Test execution / Test-all (push) Successful in 2m2s
Introduce an abstract `AuditBackend` base
class and derive `GitAuditBackend` from the
base class.
2026-03-17 09:51:17 +01:00
Christian Monch
2fcf475235 improve gitaudit tests 2026-03-17 09:17:26 +01:00
Christian Monch
ee6c3a2f15 add audit-backend documentation
All checks were successful
Test execution / Test-all (push) Successful in 2m2s
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`.
2026-03-16 15:30:17 +01:00
Christian Monch
e5f648a86f set git-identity before runing tests
All checks were successful
Test execution / Test-all (push) Successful in 2m1s
2026-03-16 14:53:23 +01:00
Christian Monch
89c7252d63 remove unused import from test_gitaudit.py
Some checks failed
Test execution / Test-all (push) Failing after 1m9s
2026-03-16 14:33:37 +01:00
Christian Monch
581948edbf add reference to branch minilad of datalad-core
Some checks failed
Test execution / Test-all (push) Failing after 57s
2026-03-16 14:31:23 +01:00
Christian Monch
f0451da314 add audit-backdend handling
Some checks failed
Test execution / Test-all (push) Failing after 49s
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>
2026-03-16 13:41:58 +01:00
Christian Monch
016576a6eb use apply_change_set
Some checks failed
Test execution / Test-all (push) Failing after 44s
Use the code from the minilad branch of
datalad-core.
2026-03-16 09:25:38 +01:00
Christian Monch
c5be11dc38 add an audit test with non-trivial change numbers 2026-03-13 16:47:13 +01:00
Christian Monch
e49ca98c1b fix change detection
Some checks failed
Test execution / Test-all (push) Failing after 52s
Due to the empty worktree, `git status` reports
even unchanged files as deleted. This lead to
unnecessary audit-commits. This commit fixes
the behavior.
2026-03-13 16:15:03 +01:00
Christian Monch
0b7dee7485 implement worktree-free audit trail
Add changes directly to git-index, and
commit from there. This keeps the worktree
empty.
2026-03-13 14:46:45 +01:00
Christian Monch
f87256fd86 create gitaudit-dir if it does not exist
Some checks failed
Test execution / Test-all (push) Failing after 55s
2026-03-12 14:46:03 +01:00
Christian Monch
038d18399b add dump-things-report-gitaudit command 2026-03-12 14:28:06 +01:00
Christian Monch
e6306f65c2 add gitaudit-description to changelog 2026-03-12 14:09:24 +01:00
Christian Monch
acc0981336 add change reports for IDs
Some checks failed
Test execution / Test-all (push) Failing after 51s
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
2026-03-12 10:11:50 +01:00
Christian Mönch
c1287e65b9 use three-level directory hierarchies for files
Some checks failed
Test execution / Test-all (push) Failing after 1m0s
2026-03-11 16:21:37 +01:00
Christian Monch
f3c20c913e add a git-based audit trail backend
Some checks failed
Test execution / Test-all (push) Failing after 58s
2026-03-11 14:38:09 +01:00