feat(consent): grant consents through a version-checked usecase

This commit is contained in:
shira committed 2026-10-06 15:12:08 +03:00
1 parent de49f93b0b
commit ea0982a762
8 files changed
+1731 -11

No files matched your search

+10 -3
View File
@@ -80,9 +80,16 @@ type ConsentLedger interface {
// A grant of another version is a new record next to the earlier one.
// Superseded is decided by granted_at, then the record ID: the
// unrevoked record granted last is active, whatever its text version,
// so Grant accepts any published version. The grant usecase (TASK-063)
// must check that the version is the current text of the purpose,
// ConsentTexts().Current at the grant time, before it calls Grant.
// so Grant accepts any published version. The usecase consent.Service
// (TASK-063) is the path that checks that the version is the current
// text of the purpose, ConsentTexts().Current at the grant time, before
// it calls Grant; business code grants through it, not directly.
//
// A subject may leave any purpose ungranted: the ledger has no rule that
// ties one purpose to another, and a subject without C3 has no C3 record,
// so Current returns ErrConsentNotFound. That is not an error state of
// the account. No caller may treat a missing C3 as a reason to refuse the
// profile or the manual assessment path.
Grant(ctx context.Context, grant domain.ConsentGrant) (record domain.ConsentRecord, created bool, err error)
// GrantContact records the C4 grant of an invitation acceptance with its