Add an ai_disclosure_audit submodule: append-only assessment audit trail
Problem / Motivation
A disclosure decision is only as defensible as the record behind it. Today the field value is entity-revisioned, but the grades and profiles it points at are mutable config: editing a grade silently changes what every past disclosure meant, and there is no record of who assessed an entity, when, or why. For a compliance module that is not enough evidence for a historical decision.
Proposed resolution
Add an ai_disclosure_audit submodule that records an append-only audit trail, with no changes to the main module's data model:
- Save-time snapshots: on entity insert/update with a disclosure field, store an audit row — entity/revision/langcode, mode, grade ID plus a frozen copy of the grade's flags and disclosure sentence, acting user, timestamp.
- Config drift log: a
ConfigCrudEventsubscriber onai_disclosure.ai_disclosure_grade.*and...ai_disclosure_profile.*records each version, so old rows can be read against the rules in force at the time. - Optional rationale: a text element added to the existing widget via
hook_field_widget_single_element_form_alter(), stored with the snapshot.
One small seam in the main module: dispatch an event when a suggestion's status changes (accept/dismiss) so the submodule can audit review actions without polling the suggestion table.
The audit table is append-only — on non-revisionable entity types it is the sole history.
Out of scope
Modelling Article 50(4) scope facts (publication / public interest) — that is a separate issue about the decision model itself; this issue only preserves evidence of whatever was decided.