Skip to content

fix: minor improvements to the lint manifest build - #188

Closed
utkarash2991 wants to merge 1 commit into
mainfrom
fix/compile-json-categories-regex
Closed

fix: minor improvements to the lint manifest build#188
utkarash2991 wants to merge 1 commit into
mainfrom
fix/compile-json-categories-regex

Conversation

@utkarash2991

Copy link
Copy Markdown
Contributor

bin/compile_json.py pulls each lint's categories out of its SQL with a greedy array\[(.*?)\] ... as categories regex under re.DOTALL. In a lint that contains an earlier array[...] (a data array, not the categories projection), the lazy capture spans across it to the trailing as categories and returns the whole run as "categories".

Three lints are affected because they have a data array above the projection: 0023_sensitive_columns_exposed, 0024_rls_policy_always_true, 0025_public_bucket_allows_listing. Instead of ['SECURITY'] they emit dozens of SQL fragments. Since consumers filter by category (mgmt-api does lint.categories.includes(category)), a Security Advisor run requested by category through the Management API or MCP silently omits those three. Running all lints, as Studio does, is unaffected. This is in the 2026.08.0 and 2026.09.0 manifests.

This matches a single array[...] with [^\]]* (and drops DOTALL), so the capture can't leave its own array, and validates every extracted category against the known set so a malformed lint fails the build loudly rather than shipping bad metadata — the behaviour the module docstring already describes.

Verified by running bin/compile_json.py over all 29 lints: every lint now resolves to SECURITY/PERFORMANCE, and 0023/0024/0025 come out as ['SECURITY'].

Tracking: PSQL-1655

The categories regex used a lazy `.*?` under DOTALL, so in a lint with an
earlier `array[...]` the capture ran across it to the trailing
`as categories` and returned the whole span as garbage categories. This hit
0023/0024/0025, whose SECURITY category came out as dozens of junk strings,
which then dropped them from category-filtered Advisor runs.

Match a single `array[...]` with `[^\]]*` and validate the result against the
known category set so a malformed lint fails the build instead of shipping.
@utkarash2991

Copy link
Copy Markdown
Contributor Author

Folded into #187 as a single PR of minor build/CI fixes.

@utkarash2991
utkarash2991 deleted the fix/compile-json-categories-regex branch September 8, 2026 16:35
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