Appearance
Legal holds, per holder
A legal hold freezes every purge of a file — the retention job, the quarantine expiry, the manual route and even an erasure request from the data subject. Version 9 kept it as one bit on the record, and a bit cannot tell who is holding: the second hold was not recorded, and the first lifting released the file for everybody. From v10.1 the hold is per holder (RN-GF-27): one row for each party that needs the file kept, each with its own author, kind of author, reason and dates. This page is how it behaves; the route half is also in Retention & Purge.
The model
| Piece | What it is |
|---|---|
| Holder | The ownerScope of the registered consumer that placed it — or the platform, whose name is the reserved platform (a consumer scope called platform stops the host at start) |
| Hold | A row of files.file_legal_holds: holder, author, kind of author, reason, when placed, when lifted. At most one active hold per holder |
legalHold | Derived: on while at least one holder has an active hold. It is no column any more |
legalHolders | On StoredFileDto: the names of the holders with an active hold |
Rules that follow from it:
- Placing adds, never replaces. A consumer placing a hold on top of the platform's leaves two active;
PUT legalHold: trueover a consumer's hold also leaves two. - Each holder lifts only its own. The platform lifts through the route, a consumer through its port. No permission lifts another holder's hold, and the file stays held while any holder remains.
- Repeating the same act changes nothing. Placing again keeps the first author and reason and writes nothing; lifting a hold the holder does not have, over a live file, returns the record as it is so that the repetition of the act concludes. Over a tombstone it is
FILE_PURGED_CONFLICT. - Count cases on your side. The module does not count cases: a consumer with several cases on one file lifts its hold when the last case of its own ends.
- The refusal lists who.
FILE_LEGAL_HOLD_CONFLICT(a purge, an erasure) answers with the names of the holders; reason, author and executor of another holder do not leave the module (DEC-GF-15-4).
Which files can be held
A hold is accepted only on Available and Infected content — the two states in which every purge honours it (DEC-GF-18-1). On Pending, Scanning and Failed, a new hold is 409 FILE_NOT_AVAILABLE_CONFLICT: those states are tombstoned by the expiry sweep and the rejections without asking for holds, so the hold would promise a custody nothing keeps. An existing hold is idempotent in any state, and the consumer can still hold an Infected file after a verdict (a hold, or retainUntil, is how evidence of an incident is kept past the quarantine window).
Through the route: the platform's hold
PUT /files/{id}/retention with retain:files (a product file, retain:product-files):
| Body | Effect |
|---|---|
{ "legalHold": true, "reason": "…" } | Adds the platform's hold. The reason is required (at most 200 characters, 400 without code if missing). Never refused for want of a trail |
{ "legalHold": false, "reason": "…" } | Lifts the platform's hold. Needs release-hold:files on top of retain:files, a reason, and a durable trail (503 FILE_AUDIT_TRAIL_UNAVAILABLE otherwise, hold still on). On a file held only by consumers: 403 FILE_OWNER_SCOPE_FORBIDDEN, with their scopes in errors, and nothing changes |
{ "retainUntil": … } | Extends retention only, forward (RN-GF-09) |
The author on the route is always the authenticated user; there is no declared author over HTTP. The response is the record with legalHold and legalHolders. Every refusal is decided before anything changes, so a body carrying a date and a hold never applies half of itself. A tombstone is FILE_PURGED_CONFLICT.
Through the port: a consumer's own hold
csharp
// An act of a person, in a request: the user in the context is the author.
await files.PlaceLegalHoldAsync(fileId, tenantId, reason: "Litigation 2026/114", ct);
// The replay after the consumer's commit, which runs with no user:
await files.PlaceLegalHoldAsync(
fileId, tenantId, reason: "Litigation 2026/114",
author: new DeclaredFileAuthor(caseOpenedBy, "legal-case-replay"),
cancellationToken: ct);
await files.ReleaseLegalHoldAsync(fileId, tenantId, reason: "Case closed", author: declared, cancellationToken: ct);- The holder is the marker's scope. No module permission is checked (RN-GF-28): lifting needs no
release-hold:files, because it is the end of an act the consumer authorized and recorded on its side. - Author. The user in the context, or a
DeclaredFileAuthor(UserId, ServiceExecutor)— the person the consumer already recorded, declared for the replay. With a user in the context, a declared author who is someone else is401 FILE_CALLER_UNAUTHORIZED. With neither, also 401 and nothing is written. The declared author is data, not identity: it grants nothing and enables nothing else. - Marked. The hold and the trail line record the author as declared, with the scope that declared it (taken from the port, so a consumer cannot declare for another) and the executor of service. Nothing presents a declared author as authenticated (RN-GF-10).
IFileStore<TScope>.UpdateRetentionAsynconly extendsretainUntil; a request carryinglegalHoldis a contract error (400). A hold has one door per holder (DEC-GF-15-8).- The tenant is named by the consumer (
tenantId), the wayReleaseReferenceAsyncdoes;nullnames a product file.
The trail
Placing and lifting are control acts, and both go to the audit trail (stored_file.legal_hold_placed and stored_file.legal_hold_released), with the holder and the reason. The line is staged in the same transaction as the change and delivered after the commit, so a process that dies right after the commit still leaves it (RN-GF-27 (j)). Scope, author and trail are checked before anything changes: a refusal never leaves a hold lifted without a line, or a line without an author.
Lifting needs the durable trail (RN-GF-25); placing never does, because refusing would leave the evidence unprotected. On a product file (no tenant) the Core outbox cannot take the line yet, so a hold is placed without a trail line and counted in gryd_files.audit_trail.unreachable (act=legal-hold), and lifting answers FILE_AUDIT_TRAIL_UNAVAILABLE — see The audit trail and the outbox.
Interaction with everything else
| With | Rule |
|---|---|
| Purge, retention job, quarantine expiry | A hold of any holder refuses. The job leaves the file; the route answers FILE_LEGAL_HOLD_CONFLICT; the erasure is refused too — the legal hold wins over the data subject |
| The lock | Placing, lifting and purging serialize on the record's lock (RN-GF-20): a hold placed between a pre-condition query and the purge wins, the purge answers FILE_LEGAL_HOLD_CONFLICT with purgedAt null and the holder, and a lift that loses to a purge answers FILE_PURGED_CONFLICT. The holders a refusal lists are the ones after the lift that won the lock |
| Re-scan | Available → Infected releases the references and leaves the holds and retainUntil as they were (RN-GF-24) |
| Verdict handlers | Run with no user, so they never place a hold (RN-GF-24) |
Upgrading
The migration Files_GF_15_LegalHoldHolders drops the LegalHold bit and creates file_legal_holds. It fails on purpose (RAISE EXCEPTION) if any stored_files row still has the bit on: that hold has no holder, author or reason to migrate (DEC-GF-15-2). Lift those holds, or write them as holder rows by hand, and run it again. Code inside the module that decides by a hold has to load Include(file => file.Holds): the derived property is computed from the rows (DEC-GF-15-1).
The decisions behind this page are in ADR 0010; the contract is RN-GF-27 of the specification.