Appendix C - 17. Per-mutator attribution stamps
The Structure of Per-mutator attribution stamps — its shape at a glance:
Each mutator writes its stamp through the one sanctioned stamp-writer for its format; the stamp is embedded in the artifact. Debug stamps are stripped before delivery; preserved stamps ship.
flowchart LR Verb[Mutator verb] -->|write_stamp| Writer["Stamp-writer (per format)"] Writer -->|embed at mutation site| Art[(Artifact)] Art -->|strip debug stamps| Deliver([delivered output])
Accessible description: a mutator verb writes its attribution stamp through the one stamp-writer for its format, which embeds the stamp in the artifact. Before delivery a strip step removes debug-visibility stamps, leaving preserved ones in the shipped output.
Projected from the catalogue entry provenance-and-attribution / Per-mutator attribution stamps.
On this page: Intent · Motivation · Applicability · Structure · Sample Code · Consequences · Example use within DocAble · Related Patterns
Intent
Intent — Every remediation verb that mutates a document emits an attribution stamp embedded in the artifact through one sanctioned stamp-writer per format, so every change is durably attributable and the mutation history is reconstructable after the fact (our instances: a single PDF stamp-writer held as the sole surface by a ban-lint, and an append-only OOXML attribution registry).
Motivation
When a remediated document comes out wrong, you need to know which pass made which change; otherwise RCA is guesswork across many passes and four formats. Without attribution, a mutation is anonymous: you can see the output is wrong but not who wrote it or why. The failure is unattributable mutations → un-debuggable output, and it recurs on every mutation.
Applicability
- A stamp surface per format and a helper as the sole stamp API (so stamps are uniform).
- A visibility model (Debug vs Preserved) and a strip step before delivery.
- A completeness guarantee that every verb stamps, supplied by the F10 lint.
Structure
The Structure diagram appears at the top of this page.
Sample Code
A stamp is a small record embedded at the mutation site: which pass, what it changed, and a visibility flag. One writer per format is the sole surface, so stamps are uniform. Visibility keeps delivery honest — debug stamps default on for reconstruction and are stripped before the document ships; a user-visible pass opts its stamp into "preserved."
from dataclasses import dataclass
@dataclass(frozen=True)
class Stamp:
pass_name: str
target: str
visibility: str = "debug" # "debug" is stripped before delivery; "preserved" ships
class StampWriter:
"""The sole stamp surface for one format. Embedding at the mutation site means
the history travels with the artifact, not in logs that scroll away."""
def __init__(self, artifact):
self._artifact = artifact
self._order = 0
def write_stamp(self, stamp: Stamp) -> None:
self._order += 1
self._artifact.embed_metadata({"order": self._order, **stamp.__dict__})
def strip_for_delivery(artifact) -> None:
# remove scaffolding before the document reaches the user
artifact.drop_metadata(where=lambda m: m.get("visibility") == "debug")
Consequences
- Document overhead. Stamps add content;
Debugstamps are stripped before delivery to avoid shipping scaffolding. - Helper-only discipline. Bypassing the helper produces an un-uniform stamp; it is lint-guarded.
- Every new verb must wire it — the cost that the F10 lint turns from "remember to" into "must."
Example use within DocAble
MutatorStampHelper.WriteStamp(PDF);OoxmlAttributionRegistry.AppendEntry(OOXML).- The
Debug/Preservedvisibility model;strip-attributionbefore delivery.
Related Patterns
- Counterpart — f10-wiring-lint (hard) guarantees every mutator verb stamps; it is the counted sensor that makes this audit-trail complete.
- Consumer — derive-changelog reads these stamps to reconstruct the history.
- Enabler — the closed remediation-verb set makes "stamp every verb" a finite, achievable requirement.