Skip to content

feat: add SQBRPYTHON provider layout rules for providers/ - #1492

Merged
chio-labs-delivery[bot] merged 8 commits into
mainfrom
feat/sqbrpython-provider-rules
Nov 15, 2026
Merged

chio-labs-delivery[bot] merged 8 commits into
mainfrom
feat/sqbrpython-provider-rules

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Why

Providers have no enforced shape: clients, helper functions and collaborator classes end up flat in providers/, and nodes reach into another provider's private code. The Python rules already check the node unit layout under python/; providers need the same single convention.

Changes

  • Adds SQBRPYTHON013–SQBRPYTHON015, on by default under SQBRPYTHON:
    • 013 provider-layout: providers/<capability>/provider.py, with only role files (models.py, types.py, constants.py, exceptions.py), _helpers/ and _classes/ beside it.
    • 014 provider-module-shape: provider.py holds imports, private constants and one public Provider subclass. Bases are followed through imports, aliases, module attributes and project base classes; a class whose base comes from another package is never reported.
    • 015 provider-import-boundaries: a provider's _helpers/ and _classes/ are private to it; providers import only python/utils/ from python/ and nothing from orchestration/.
  • sqlbuild-pysource records classes, dotted bases and assignments for the rules.
  • Docs: "Laying out providers" in the Python rules page, and the providers page now shows the capability-folder layout.
  • Release note: projects that select SQBRPYTHON may get new provider findings.

DuckShop: the python_rules edge case adds a conforming carrier_api provider and a violation for each rule, with updated expected findings. The main DuckShop project has no providers/, so its findings are unchanged.

Verification

  • cargo test -p sqlbuild-rules -p sqlbuild-pysource, including table cases for aliased, indirect, re-exported and external bases, tuple, subscript, mixed and chained assignments; clippy with -D warnings; fensu check.
  • test_rules.py and the rule-engine unit tests, including the DuckShop edge case.
  • make check-ci on the final head.

…ounts

Parse files in parallel, keep the provider count in the caller, regenerate
the DuckShop edge-case findings and docs skill, and edit the providers
page's layout section into shape.
…cript assignments

SQBRPYTHON014 now accepts a Provider imported under an alias or reached
through project base classes, reports tuple, attribute and subscript
assignments in provider.py, and only parses files under providers/ or
that mention providers. The providers page shows the capability-folder
layout, and the violations fixture no longer hides an existing finding.
… or unknown

Keep dotted base names so module attribute bases resolve, report a class
as not a Provider only when every base chain resolves to project classes
or builtins, and stay silent when a chain leaves the parsed sources. Any
assignment with an attribute or subscript target is a statement that
does not belong in provider.py.
@kvlonge kvlonge added the full-verify Run the full Verify matrix on this pull request label Nov 15, 2026
@chio-labs-delivery
chio-labs-delivery Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 43ee21d Nov 15, 2026
49 of 74 checks passed
@chio-labs-delivery
chio-labs-delivery Bot deleted the feat/sqbrpython-provider-rules branch November 15, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-verify Run the full Verify matrix on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant