You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make v2 file-layer exceptions expire and cover whole files #4204
#4191 added the v2-layers quality guard and rule api.v2.files-assigned-to-layers, which requires every file under policyengine_api/services/v2 and policyengine_api/fastapi_routes/v2 to have a name that gives it a layer. A file that can't be renamed may instead be listed in a [[rule.exception]] for that rule in rules/registry.toml.
#4191 merged before the fixes from its last self-review round, so the guard on master still accepts exceptions that it shouldn't, and some of its messages and proofs are incomplete:
Exceptions with no expiry date. An exception that sets category = "forever" or removal = "never" and no expires date loads, passes the registry checks and is accepted by the guard. The file then keeps a name with no layer permanently.
match is ignored. An exception with a match field reads as if it covered one site, but the guard applies it to the whole file.
Exceptions for connector files. The guard accepts an exception for a misnamed module in a database_connectors package, but rule api.v2.crud-checks-cover-every-resource still fails that module, so the exception can't work.
Incomplete fix message. The message for a services file with no layer lists the allowed names but not where each must sit (for example, database_session.py only directly in a resource package), so following it can fail again.
Proof gap. The registered proof fixture for api.v2.files-assigned-to-layers has no unassigned file under fastapi_routes/v2, so the proof doesn't show that check working there.
Proposed fix
Report a files-rule exception that sets category, removal or match, that has no expires date, or that names a database_connectors module.
Give the services fix message each name's location, and give connector modules their own message.
Add an unassigned route file to the proof fixture.
Split the guard so that each module stays under the 800-line limit.
Activity
Add changelog fragment for #4204
Test that file exceptions expire and cover whole files (failing)
Require file exceptions to expire and cover whole files; split the guard
Add changelog fragment for #4204
Test connector placement, exception path spelling and missing dates (…
Name connector placement in fix messages and reject unscanned excepti…
Test exception paths against the scanned files and the connector loca…
Accept only scanned exception paths and name the CRUD-checked connect…
Test untracked exception files and the connector-package remedies (fa…
Tell untracked and non-connector files the right fix; correct the CRU…