Skip to content

docs(readme): narrow ContentBlockedError.result in the intro LangChain example - #13

Merged
TARSDrakon merged 1 commit into
mainfrom
loop/readme-intro-narrowing
Oct 17, 2026
Merged

TARSDrakon merged 1 commit into
mainfrom
loop/readme-intro-narrowing

Conversation

@TARSDrakon

Copy link
Copy Markdown
Contributor

The introductory LangChain example in the README read error.result.firewall directly. Since 0.5.0, ContentBlockedError.result is typed ScanResult | None (it is None only with fail_closed=True), so that line fails mypy with union-attr. This narrows it the same way the later README example already does.

  • README.md: intro example guards error.result is not None before reading .firewall.
  • CHANGELOG.md: one [Unreleased] Documentation bullet.

Docs only; no code change. Found as non-blocking nit N1 in the independent review of #11.

…n example

0.5.0 widened ContentBlockedError.result to ScanResult | None (None only
with fail_closed=True). The introductory example read
error.result.firewall directly, which fails mypy with union-attr. Narrow
it the same way the later README example does.

Found by independent release review of #11 (nit N1).
@TARSDrakon

Copy link
Copy Markdown
Contributor Author

Independent review (OpenAI-family lane) at head 55df41668e72e49ac3d5fbd084ccef2540b3ce14: APPROVE, no blockers, no nits.

  • README now checks error.result is not None before reading error.result.firewall.reason; this matches ContentBlockedError.result: ScanResult | None in the LangChain integration, where None is produced only on the fail_closed=True path.
  • Reviewer type-checked the changed README lines with mypy --strict against the real annotations (pass) and confirmed the original unguarded access fails with union-attr (negative control).
  • Only README.md and CHANGELOG.md change; the new bullet sits under Unreleased and the 0.5.0-and-earlier sections are byte-identical.

CI on this head: test (3.9–3.13) all success.

@TARSDrakon
TARSDrakon merged commit 1985ec9 into main Oct 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant