feat(lint): add rest_clients() and rest_operations() Starlark builtins - #1130
Draft
jvegmond-tech wants to merge 1 commit into
Draft
jvegmond-tech wants to merge 1 commit into
jvegmond-tech wants to merge 1 commit into
Conversation
The catalog already builds both tables, and rest_operations carries a Timeout column, but neither was reachable from a Starlark rule. This adds the two accessors following the DatabaseConnections pattern: catalog backed, platform modules filtered via notPlatformModule, excluded modules honoured. Motivating rule: 'REST/web services should have a timeout', which until now could not be expressed as a custom rule at all.
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor Issues
What Looks Good
RecommendationApprove the PR. The implementation correctly adds the requested Starlark lint API functions by following the existing pattern exactly, with proper error handling, documentation updates, and test coverage. The minor testing limitation is acknowledged and acceptable given the pattern-based implementation. The inline REST call observation is out of scope and appropriately noted for potential follow-up. No changes are needed before merge. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds two query functions to the Starlark lint API:
rest_clients() — consumed REST service documents
rest_operations() — their operations, including the Timeout the catalog already stores
Why
We're porting a set of CLEVR ACR quality rules to mxcli custom rules. Most map across cleanly, but this one can't be expressed at all today:
REST/Web services should have a timeout — not using the timeout mechanism when integrating with another system can cause your users to wait extremely long, especially when integrating with multiple services sequentially in one user request.
The data is already there. mdl/catalog/tables.go builds both rest_clientsand rest_operations, and rest_operations carries a Timeout column. There was simply no accessor, so a Starlark rule couldn't reach any of it.
Implementation
Follows the existing DatabaseConnections pattern exactly:
catalog-backed, so no LintReader change is needed
platform modules filtered via notPlatformModule(...)
ctx.IsExcluded(...) honoured
failures routed through recordQueryError(...)
Docs updated in .claude/skills/mendix/write-lint-rules/SKILL.md: the query function table plus property tables for the two new struct types.
What this enables
python
RULE_ID = "CUSTOM010"RULE_NAME = "RestOperationNoTimeout"DESCRIPTION = "Consumed REST operations should have a timeout"CATEGORY = "reliability"SEVERITY = "warning" def check(): return [violation( message = "REST operation '{}.{}' has no timeout".format( op.service_qualified_name, op.name), location = location(module = op.module_name, document_type = "rest_client", document_name = op.service_qualified_name), suggestion = "Set a timeout on this operation.", ) for op in rest_operations() if op.timeout == 0]
Testing
Run in the mxcli dev container:
make build — passes
go test ./mdl/linter/... — passes (mdl/linter and mdl/linter/rules)
Known limitation — worth a reviewer's eye
The project I tested against had no consumed REST service documents, so the accessors compile and the tests pass, but they have not yet returned a live row. A check against a project that has one would be worth doing before merge.
Related observation: that same project did contain a RestCallAction in a microflow while rest_operations stayed empty. If REST calls configured inline on the activity aren't represented in that table, then this PR alone won't fully cover the ACR rule above — the activity's own timeout would also need exposing, on top of the service_ref / action_ref change in my other PR. Happy to follow up on that separately if you can confirm how inline REST calls are meant to be indexed.