Skip to content

docs: ADR 005 — design the --strict-types (Phase 2) pass#27

Merged
flaglint merged 1 commit into
mainfrom
docs/adr-005-strict-types
Jul 7, 2026
Merged

docs: ADR 005 — design the --strict-types (Phase 2) pass#27
flaglint merged 1 commit into
mainfrom
docs/adr-005-strict-types

Conversation

@flaglint

@flaglint flaglint commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

Design ADR for the opt-in --strict-types pass ADR 002 originally sketched. Splits it into two sub-phases:

Covers package loading (golang.org/x/tools/go/packages), fail-soft per-package fallback to Phase 1 results when a package doesn't type-check (the "no build required" guarantee stays intact for the rest of the tool), the identity resolution model, and the CLI/API surface (--strict-types as a flag — not a config-file field, since it's Go-only with no flaglint-js equivalent).

Test plan

  • Docs-only change — no code affected

Summary by CodeRabbit

  • Documentation
    • Added a new architecture note describing an optional --strict-types mode for identity resolution.
    • Clarified that scan, audit, and validate now support this flag, and that results will include additional type-checked matches where possible.
    • Documented graceful handling of packages that can’t be fully analyzed, with warnings instead of stopping the entire run.
    • Updated the ADR index to include the new entry.

Splits what ADR 002 originally described as one "Phase 2" into two
sub-phases: 2a (static type resolution via go/types, closing issues #15
interface satisfaction and #16 transitive factory wrapping — both pure
"what is this expression's real type" questions) and 2b (interprocedural
data-flow, closing issue #26 cross-function method values — a
meaningfully larger, riskier undertaking needing real call-graph
analysis, not just type info). This ADR scopes only 2a; 2b gets its own
future ADR once 2a has shipped and proven out the package-loading and
fallback machinery in practice.

Covers: package loading via golang.org/x/tools/go/packages, fail-soft
per-package fallback to Phase 1 results when a package doesn't
type-check (never breaking the "audit works with no build" guarantee),
the identity resolution model (still never inferred from a name, now
proven through the type checker instead of syntax), and the CLI/API
surface (--strict-types as a flag, not a config-file field, since it's a
Go-only concept with no flaglint-js equivalent; scanner.ScanStrict as a
new function wrapping the unchanged scanner.Scan).

Signed-off-by: Krishan Kant Sharma <krishansharma0327@gmail.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f4be6f6-eb33-44b1-9355-4e0079667e31

📥 Commits

Reviewing files that changed from the base of the PR and between 4af5a95 and 006e63f.

📒 Files selected for processing (2)
  • docs/adr/005-strict-types-pass.md
  • docs/adr/README.md

📝 Walkthrough

Walkthrough

Adds a new architecture decision record (ADR 005) documenting an opt-in --strict-types phase for type-checked identity resolution using go/types, describing package loading, resolution model, CLI/API surface changes, and consequences, and registers this ADR in the documentation index.

Changes

ADR Documentation

Layer / File(s) Summary
ADR intent and phase scoping
docs/adr/005-strict-types-pass.md
Introduces the ADR header, opt-in additive decision for --strict-types, and splits scope into Phase 2a (static resolution) and deferred Phase 2b (interprocedural data-flow).
Package loading and resolution model
docs/adr/005-strict-types-pass.md
Specifies fail-soft per-package loading via golang.org/x/tools/go/packages and defines resolution rules for interface satisfaction and transitive factory wrapping.
CLI/API surface and consequences
docs/adr/005-strict-types-pass.md, docs/adr/README.md
Documents the --strict-types flag, scanner.ScanStrict API, types.ScanResult extension, dependency/behavior consequences, out-of-scope items, and adds the ADR to the index table.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the docs-only ADR for the proposed --strict-types Phase 2 design.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/adr-005-strict-types

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.

@flaglint flaglint merged commit d33071b into main Jul 7, 2026
14 checks passed
@flaglint flaglint deleted the docs/adr-005-strict-types branch July 7, 2026 18:36
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.

2 participants