{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-treat-redaction-as-a-semantic-invariant-rather-than-a-post-hoc-filter",
  "title": "When must an instance treat redaction as a semantic invariant rather than a post-hoc filter",
  "date_of_record": "2026 November 26",
  "scope": "Applies to LLM/agent instances emitting OpenTelemetry-style spans where prompt, response, tool arguments, and retrieved-context attributes are subject to semantic-convention redaction rules. Does not cover at-rest data retention policy, key management, or transport-layer TLS concerns.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-redaction-as-a-semantic-invariant-rather-than-a-post-hoc-filter.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-redaction-as-a-semantic-invariant-rather-than-a-post-hoc-filter.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-treat-redaction-as-a-semantic-invariant-rather-than-a-post-hoc-filter.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1829,
    "python_slice_tokens": 413,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "There are two structurally different places to enforce prompt/response scrubbing, and they are not interchangeable: 1. **Post-hoc filtering** — the instance serializes the full prompt/response into span attributes, and a downstream collector or processor rewrites or drops the offending attribute. The sensitive bytes existed, fully materialized, in the emitti...",
    "what_was_observed": "An agent instance was instrumented to emit `gen_ai.*` spans per the semantic conventions, with a `RedactingSpanProcessor` registered to strip PII from `gen_ai.prompt` and `gen_ai.completion` attributes. During a multi-tool task, a prompt containing a user's account number in a few-shot example was passed to the model. Failure trace: - The instance constructed the span, setting `gen_ai.prompt.0.content` to the raw few...",
    "condition_of_validity": "Post-hoc redaction is only sound when **all** of the following hold; if any fails, redaction must be promoted to a pre-emission invariant: - Exactly one span processor is registered, or every processor is proven order-independent with respect to sensitive attributes (i.e., none reads them). - The redaction predicate covers the *entire* declared sensitive-att...",
    "decision_boundary": "The decision is a function of attribute provenance, not of configuration intent: - **Redact-before-construct (invariant mode):** the instance builds span attributes through a redaction-typed constructor that only accepts already-scrubbed payloads. The raw prompt is never assigned to a span attribute; it is consumed by the model call and discarded. This is re...",
    "operational_effect": "Treating redaction as a semantic invariant changes three things: 1. **Span construction becomes fallible.** The constructor returns either a scrubbed span or raises; it cannot return a span with unredacted sensitive leaves. This surfaces the second leak class (tool arguments) at the call site instead of in an audit sink. 2. **Processor ordering stops being l..."
  },
  "matched_failure_symptoms": [
    "SECRET_OR_PII_LEAK_IN_LOGS"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "6226e6282a727cda9f3f826e082f23c330fb21096b8cb464e9e414db320322b9",
    "verified_classes": [
      "UnredactedSensitiveAttributeError",
      "GenAiSpan"
    ],
    "verified_functions": [
      "_is_sensitive",
      "assert_no_unredacted",
      "emit",
      "set_sensitive",
      "seal"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 2,
    "raised_exceptions": [
      "UnredactedSensitiveAttributeError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [
      "__future__",
      "dataclasses",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
