Skip to content

Commit 9a5c296

Browse files
models: Clamp demo redacted values to parseable constants
- Updated `_demo_value_sanitizers.py` to enforce parseable-but-useless replacements for demo-redacted boolean-like strings to maintain operability while preserving data obscurity. - Added comments clarifying the intent of replacements in demo mode. - Updated AGENTS.md to document the redaction approach for demo/free-tier values. Assisted-by: Codex
1 parent 8f1df81 commit 9a5c296

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@
173173
pdfRest wire quirks (for example, splitting comma-separated values or
174174
serializing only the first uploaded file ID), not re-implement constraint
175175
logic already expressed by Pydantic field types/annotations.
176+
- For demo/free-tier redactions, favor parseable-but-useless replacements over
177+
reconstructing likely true values. The SDK should remain operable (no parsing
178+
crashes) while preserving demo mode’s intent of withholding useful output
179+
fidelity.
176180
- Prefer reusable validator factories that take parameters (for example
177181
allowed-value/extension helpers with keyword-configured fallbacks) over
178182
bespoke one-off validator functions tied to a single field.

src/pdfrest/models/_demo_value_sanitizers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def _demo_bool_or_passthrough(
5353
if value is None or isinstance(value, bool):
5454
return value
5555
if _looks_like_demo_redaction(value):
56+
# Intentionally clamp demo-redacted bool-like strings to a configured
57+
# constant. The goal is parseability without restoring potentially
58+
# meaningful signal that demo mode is designed to obscure.
5659
_log_replacement(value, replacement, info)
5760
return replacement
5861
return value

0 commit comments

Comments
 (0)