Skip to content

docs(adr): a guard must be able to fail, and must know what it covers - #460

Merged
bomly-guy merged 4 commits into
mainfrom
docs/adr-0044-guards-know-their-reach
Sep 13, 2026
Merged

bomly-guy merged 4 commits into
mainfrom
docs/adr-0044-guards-know-their-reach

Conversation

@bomly-guy

Copy link
Copy Markdown
Collaborator

Closes #453.

ADR-0044 (dev-docs/adr/0044-a-guard-must-be-able-to-fail-and-know-its-reach.md) records what the SDK maturity program learned about guard tests. Context: the five-round progression on the purl-type guard and the parallel one on the SDK's wire-schema guard, each fix opening the next hole. Decision, as seven rules: key on where a decision is made, not where it is used; ask the thing itself; prefer removing the capability to inspecting its arguments; a guard must know its own reach; exemption lists invert and stale entries fail; mutation is the acceptance criterion, with its traps named; two correct rules pulling against each other means the frame is wrong. Every rule cites the real test that embodies it.

Enforced, not only stated: walkInternalGo, filesNamingModule and TestExportNeverReadsResolvedURL in internal/detectors/guards_test.go now fail when they visited zero Go files, in the style of TestGoldensCarryNoHostArchitecture. Verified by pointing the walker at an empty temporary directory: it fails with "the guard scanned nothing" (not committed).

CLAUDE.md / AGENTS.md: the "Add a guard when the rule can be bypassed by writing it out by hand" bullet gains one sentence pointing at the ADR; the two files stay byte-identical past their headers.

make verify passes.

🤖 Generated with Claude Code

ADR-0044 records what the SDK maturity program learned about guard tests:
more than twenty review findings in a day were one defect -- a rule that
covers the paths someone enumerated -- and the three fixes that broke the
cycle share a property worth naming. Key on where a decision is made, ask
the thing itself, remove the capability; and a guard must know its own
reach, because a walk that visits nothing reports nothing, exactly like a
clean tree.

That last rule is enforced here rather than only stated: the shared walkers
in internal/detectors/guards_test.go and the flat read in
TestExportNeverReadsResolvedURL fail when they scanned no Go files. CLAUDE.md
and AGENTS.md point at the ADR from their guard bullet.

Closes #453.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 47 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 27dc0b10-bb3f-4d88-b853-b9d21069adb7

📥 Commits

Reviewing files that changed from the base of the PR and between 6d3bcb2 and b972f5b.

📒 Files selected for processing (7)
  • AGENTS.md
  • CLAUDE.md
  • dev-docs/adr/0044-a-guard-must-be-able-to-fail-and-know-its-reach.md
  • dev-docs/adr/README.md
  • internal/detectors/guards_test.go
  • internal/detectors/python/roots_guard_test.go
  • internal/output/registry_lookup_guard_test.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Bomly Diff Summary

Compared 6d3bcb2f74136a114ed78b8c203bf28bbfd97aba to b972f5bf829352b97c05ac8a624789b124425137.

Overview

Status Manifests Dependencies Findings Duration
✅ Pass +0 / ~0 / -0 0 added / 0 version changed / 0 detail changes / 0 removed 0 introduced / 0 persisted / 0 resolved 1m 0s

Dependency Changes

✅ No dependency changes.

Vulnerabilities

✅ No vulnerability changes.

License Changes

✅ No license changes.

Project Posture

✅ No project posture changes (--matchers +scorecard was not selected).

Policy Findings

✅ No policy differences were identified.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6002c9316c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/detectors/guards_test.go
Comment thread internal/detectors/guards_test.go
… export guard walks recursively

Codex review on #460: the shared walker's count is over all of internal/,
so a scoped rule could inspect nothing while the walker stayed busy; the
two direct detector walkers had no count at all; and the export guard read
internal/sbom flat, so a codec moved into a subpackage would leave the rule.
Each guard now counts what it actually inspected, and the export guard
walks its whole scope.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 517639c4d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

…s its reach

Codex review on #460: the guard read the package directory flat, so a
parser added in a subpackage could call sdk.NewModuleNode unseen while the
top-level files kept it green. It now walks the tree and fails when it
scanned nothing, the rule ADR-0044 states.

Co-Authored-By: Claude Fable 5.1 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a92c5fff47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Codex review on #460: a root whose production files moved out still
exists and still walks, and the other roots kept the traversal looking
busy. Each root now fails when it yields no production Go file.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@bomly-guy
bomly-guy merged commit 0648d0a into main Sep 13, 2026
16 checks passed
@bomly-guy
bomly-guy deleted the docs/adr-0044-guards-know-their-reach branch September 13, 2026 07:41
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.

ADR: a guard must be able to fail, and must know what it covers

1 participant