[PIGS-978] Surface redaction labels in redact_pdf - #103
Open
IvanK-Nitro wants to merge 1 commit into
Open
Conversation
The Platform API accepts an optional label per redaction mark and renders it onto the redaction box in the output. redact_pdf did not expose it, so the capability was unreachable through the MCP server while direct API callers had it. Adds an optional `label` to each entry in `redactions`, passed through to the platform unchanged. Extracts the redaction shape into an exported `Redaction` interface, replacing the inline type that was duplicated between the tool and the handler. Labels are only applied to redactions the caller supplies. Redactions derived from a piiJsonFile are still sent without one, so existing auto-redaction output is byte-identical -- whether detected PII should be labelled with its type is a product decision, not a passthrough concern. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional
labelto each entry inredact_pdf'sredactionsarray, passed through to the platform.PIGS-978
Why
The Platform API accepts an optional label per redaction mark and renders it onto the redaction box in the flattened output (left-aligned, trimmed to fit the box width). It is already supported end to end and documented in the public API docs.
redact_pdfnever exposed it, so the capability was unreachable through the MCP server — a direct API caller could stamp a redaction with e.g. a withholding basis, while the same request through this server could not. This closes that gap; it is a passthrough, no new platform behaviour.Changes
labeladded to the per-redaction schema, optional, capability-only description.Redactioninterface. It was previously an inline type duplicated betweenredact_pdfandPlatformHandler.redactPdf, which is what made this a three-place change rather than one.labelis typedstring | undefinedto satisfyexactOptionalPropertyTypes, matching the existing convention inDetectedFormField.manifest.jsonneeds no update.Deliberately not included
Redactions derived from a
piiJsonFileare still sent without a label, so existing auto-redaction output is byte-identical. A test pins this.Whether auto-detected PII should be labelled with its type (
EMAIL,NAME, …) is a product decision, not a passthrough concern: it would make auto-redacted output self-documenting, but it would also change what every existing auto-redact call produces. Worth deciding separately — happy to follow up if wanted.Testing
task check(format/types/lint) andtask testpass — 189 passed, 1 pre-existing skip (+2 new tests):piiJsonFileare sent with no labelNot exercised against the live API — this is a passthrough of a field the platform already accepts, and the existing redact tests mock at the handler boundary.
🤖 Generated with Claude Code