test(linter): add unit tests for all 14 untested linter rules#255
test(linter): add unit tests for all 14 untested linter rules#255ako merged 2 commits intomendixlabs:mainfrom
Conversation
AI Code ReviewLet me review this pull request against the provided checklist. PR Info:
Looking at the diff, I can see that this PR is adding a bunch of mock test files for various executor commands (not just linter tests as the title suggests). The diff shows:
Wait a minute - this PR is titled "test(linter): add unit tests for all 14 untested linter rules" but the diff shows it's adding tests for many different executor commands, not specifically linter tests. The cmd_lint_mock_test.go file is present (new file), but there are many other test files being added that don't seem related to linter rules. Let me check if there are actually linter-specific tests in this diff: I see cmd_lint_mock_test.go is a new file, which likely contains linter tests. Let me look at that file more closely: From the diff: This file only tests the basic lint command functionality (not connected and show rules), but doesn't actually test any of the specific linter rules mentioned in the PR description (MPR002, MPR003, SEC001, etc.). Let me check if there are any other files that might contain linter rule tests... Looking through the diff again, I don't see any specific tests for the linter rules mentioned:
The PR description says they added tests for these rules, but I don't see evidence of that in the diff. What I see is a bunch of mock tests for various executor commands that seem unrelated to linter rules. Let me double-check if there are any linter-related test files I might have missed... Actually, looking more carefully at the PR description, it says: But the diff shows many more than 11 new test files, and they don't appear to be linter-specific. Let me check if there's a mismatch between the PR description and the actual diff. Looking at the files being modified/added:
This suggests either:
Let me look for any mention of linter rules in the diff... Scanning through the diff, I don't see specific references to:
I do see in cmd_lint_mock_test.go a comment that says: But that's just mentioning that MPR001 is registered, not testing the specific rules. Let me check if there are any other files that might contain linter tests... Actually, wait - looking at the PR description again, it says: These would likely be integration tests, not unit tests, and might be in a different location. But the diff doesn't show any SQLite-backed tests or Check() tests. Let me think about this differently. Maybe the PR is actually correct and I'm misunderstanding what constitutes a "linter rule test" in this codebase. In the mxcli project, linter rules are implemented in the linter package (mdl/linter/rules/). Tests for these rules would typically be in mdl/linter/rules/*_test.go files. But I don't see any changes to those files in the diff. Let me check if there are any linter-related test files being modified... Actually, looking at the diff again, I don't see any changes to the mdl/linter/ directory at all. This is confusing. The PR title and description say it's adding linter tests, but the diff shows executor mock tests. Let me check if there's a possibility that the diff is truncated or incomplete... The note at the beginning says: "NOTE: The diff was truncated to 80k characters. Total size: 156610 bytes." So it's possible that the full diff is larger and includes linter tests that aren't shown in the truncated version. Given that the total size is 156610 bytes and it was truncated to 80k characters, there's about 76k bytes missing. It's possible that the linter tests are in the missing portion of the diff. However, based on what I can see in the provided diff, I need to review what's actually there. Let me proceed with reviewing what's in the diff, keeping in mind that the PR description might not match what's shown due to truncation. First, let's check the checklist items: Overlap & duplication
From what I can see:
MDL syntax design (for new or modified MDL syntax)Since this appears to be adding tests (not modifying MDL syntax), this section likely doesn't apply. Full-stack consistency (for MDL features)Again, since this is adding tests (not MDL features), this section likely doesn't apply. Test coverage
Looking at the diff:
Security & robustness
From what I can see in the test code:
Scope & atomicity
The PR description says it's focused on adding linter tests, but the diff shows tests for many different executor commands. This suggests the PR might not be properly scoped. However, given the diff truncation, it's possible that the linter tests are in the missing portion and what we see is just part of the changes. Code quality
From what I can see:
Bugs & correctness
From what I can see:
Now, let me focus on what I can actually see in the diff and try to determine if there are any issues. One thing I notice is that many of the test files are following a similar pattern. For example, in cmd_alter_page_mock_test.go, I see: This is a good pattern for testing the not-connected error case. Similarly, there are tests for:
The tests appear to be well-written and comprehensive for what they're testing. However, I do have a concern about the PR description not matching what's shown in the diff (due to truncation). The PR says it's adding linter tests, but what we see are executor command tests. Let me check if there's any indication that these are actually linter-related... Looking at cmd_lint_mock_test.go, it does test the lint command, but only the basic functionality (not connected and show rules), not the actual linter rules. The comment in that file says: This suggests that testing the actual linter rules would require more infrastructure that isn't in place yet. Given this, it's possible that the PR description is referring to tests that are in the missing portion of the diff, or there's a misunderstanding. Let me look for any files that might be related to linter rules... Actually, wait - I see in the PR description: These sound like they might be in microflow-related test files. Let me check if there are any changes to microflow test files... I see cmd_microflows_mock_test.go has this addition: This is just a comment pointing to where those tests are, not the actual tests. I don't see the actual helper function tests for CONV011-014 in the diff. Similarly, for the SQLite-backed full Check() tests, I don't see any evidence of those in the diff. Given all this, I suspect that either:
Since I have to review based on what's provided, I'll focus on what I can see. Let me check if there are any obvious issues with the test code I can see: In cmd_alter_page_mock_test.go, I see: |
There was a problem hiding this comment.
Pull request overview
Adds unit test coverage for previously untested linter rules and expands mock-based executor command tests to cover additional error paths, filtering, and JSON output behavior. This strengthens regression protection around lint rules and CLI executor handlers, building on the prior mock-test expansion work in #254.
Changes:
- Add new unit tests for linter rules (microflow walkers, naming helpers, empty detection, security checks, domain size, etc.), including SQLite-backed
Check()tests where applicable. - Expand executor mock tests to cover not-connected, not-found, backend-error propagation, module filtering, and JSON output across more command areas.
- Minor formatting-only adjustment in
cmd_odata.go(indentation/gofmt).
Reviewed changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| mdl/linter/rules/validation_feedback_test.go | Unit tests for MPR004 helper logic and walker recursion. |
| mdl/linter/rules/security_test.go | SQLite-backed tests for SEC001 + nil-reader guard/metadata for SEC002/SEC003. |
| mdl/linter/rules/page_navigation_security_test.go | Unit tests for navigation page collection helpers + nil-reader guard/metadata for MPR007. |
| mdl/linter/rules/naming_test.go | Unit tests for naming helper functions and MPR001 metadata. |
| mdl/linter/rules/mpr008_overlapping_activities_test.go | Nil-reader guard/metadata tests and constant assertions for MPR008. |
| mdl/linter/rules/empty_test.go | SQLite-backed Check() tests for MPR002 (empty microflows). |
| mdl/linter/rules/empty_container_test.go | Unit tests for empty-container detection + MPR006 metadata. |
| mdl/linter/rules/domain_size_test.go | SQLite-backed Check() tests for MPR003 (domain model size). |
| mdl/linter/rules/conv_split_caption_test.go | Unit tests for CONV012 split-caption walker logic. |
| mdl/linter/rules/conv_loop_commit_test.go | Unit tests for CONV011 loop-commit walker + nil-reader guard/metadata. |
| mdl/linter/rules/conv_error_handling_test.go | Unit tests for CONV013/CONV014 walker behavior and metadata. |
| mdl/executor/cmd_write_handlers_mock_test.go | Add additional mock tests for create/drop handler edge cases (already-exists / not-found). |
| mdl/executor/cmd_workflows_mock_test.go | Add not-found + filter-by-module tests for workflow handlers. |
| mdl/executor/cmd_styling_mock_test.go | Add negative-path tests for styling commands (not connected / missing path). |
| mdl/executor/cmd_settings_mock_test.go | Add not-connected, backend-error, and JSON output tests for settings listing. |
| mdl/executor/cmd_security_mock_test.go | Expand security handler coverage: filtering, not-found, nil-name, unsupported type. |
| mdl/executor/cmd_rest_clients_mock_test.go | Add not-found + module filter tests for consumed REST services. |
| mdl/executor/cmd_rename_mock_test.go | Add comprehensive rename command mock tests (success, dry-run, errors). |
| mdl/executor/cmd_published_rest_mock_test.go | Add not-found + module filter tests for published REST services. |
| mdl/executor/cmd_pages_mock_test.go | Add filter-by-module tests for snippets/layouts + not-found describe tests. |
| mdl/executor/cmd_odata_mock_test.go | Add not-found + module filter tests for consumed/published OData. |
| mdl/executor/cmd_odata.go | Formatting-only change in $metadata fetch helper block. |
| mdl/executor/cmd_navigation_mock_test.go | Add not-found + “all profiles” coverage for navigation describe. |
| mdl/executor/cmd_move_mock_test.go | Add move command mock tests (success, not found, cross-module refs, errors). |
| mdl/executor/cmd_modules_mock_test.go | Add backend-error + JSON output tests for module listing. |
| mdl/executor/cmd_misc_mock_test.go | Add not-connected + missing-schema-hash + help output tests. |
| mdl/executor/cmd_microflows_mock_test.go | Add notes pointing to existing backend-error/JSON tests (comment-only). |
| mdl/executor/cmd_mermaid_mock_test.go | Add microflow happy/not-found, page not-found, unsupported-type tests. |
| mdl/executor/cmd_lint_mock_test.go | Add not-connected + ShowRules branch coverage for execLint. |
| mdl/executor/cmd_jsonstructures_mock_test.go | Add module filter + describe/not-found tests for JSON structures. |
| mdl/executor/cmd_javascript_actions_mock_test.go | Add not-found + module filter tests for JS actions. |
| mdl/executor/cmd_javaactions_mock_test.go | Add backend error, not-found, filter-by-module, JSON tests for Java actions. |
| mdl/executor/cmd_import_mock_test.go | Add not-connected guard test for import command. |
| mdl/executor/cmd_import_mappings_mock_test.go | Add module filter + describe/not-found tests for import mappings. |
| mdl/executor/cmd_imagecollections_mock_test.go | Add module filter + not-found tests for image collections. |
| mdl/executor/cmd_fragments_mock_test.go | Add describe + not-found/nil-fragments tests for fragments. |
| mdl/executor/cmd_folders_mock_test.go | Add folder drop/move tests (not connected, not found, nested paths, errors). |
| mdl/executor/cmd_features_mock_test.go | Add tests for features display across connected/disconnected + version parsing/filters. |
| mdl/executor/cmd_export_mappings_mock_test.go | Add module filter + describe/not-found tests for export mappings. |
| mdl/executor/cmd_enumerations_mock_test.go | Add notes pointing to existing backend-error/JSON tests (comment-only). |
| mdl/executor/cmd_entities_mock_test.go | Add backend error + JSON tests for entity listing. |
| mdl/executor/cmd_dbconnection_mock_test.go | Add module filter + not-found tests for DB connections. |
| mdl/executor/cmd_datatransformer_mock_test.go | Add module filter + not-found tests for data transformers. |
| mdl/executor/cmd_constants_mock_test.go | Add notes pointing to existing backend-error/JSON tests (comment-only). |
| mdl/executor/cmd_businessevents_mock_test.go | Add not-found + module filter tests for business event services. |
| mdl/executor/cmd_associations_mock_test.go | Add backend error + JSON output tests for associations. |
| mdl/executor/cmd_alter_page_mock_test.go | Add broader ALTER PAGE command tests around mutator operations and errors. |
| mdl/executor/cmd_agenteditor_mock_test.go | Expand agent editor handler tests for not-found, drop not-found, and module filtering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address Copilot review comments on PR mendixlabs#255: - Check INSERT OR IGNORE error in setupMicroflowsDB (empty_test.go) - Check INSERT OR IGNORE error in setupEntitiesDB (domain_size_test.go) - Pass nil db directly in SEC002/SEC003 nil-reader tests (security_test.go) - Remove unused sql/sqlite imports from security_test.go
AI Code ReviewLet me analyze this pull request based on the provided context and checklist. The PR title is: "test(linter): add unit tests for all 14 untested linter rules" Looking at the body:
Now let me examine the diff to see what was actually changed: The diff shows many test files being modified or added in the
This PR is adding unit tests for various executor commands, particularly focusing on mock-based tests for different MDL statement types. The PR description says it's adding tests for "all 14 previously untested linter rules", but looking at the actual changes, I don't see specific tests for linter rules. Let me check if there are any linter-specific test files in the diff:
Looking at cmd_lint_mock_test.go:
This doesn't seem to be testing the actual linter rules themselves (like MPR002, MPR003, etc.), but rather testing the lint command infrastructure. Let me double-check the PR description against what I see in the diff:
There seems to be a mismatch. Let me look for actual linter rule tests. Actually, looking more carefully at the PR body:
But in the diff, I don't see tests specifically for these linter rules. Instead, I see tests for various executor command handlers. Let me check if there are any linter rule test files that might not be showing in the truncated diff. Wait, I notice that the diff is truncated to 80k characters, and the total size is 156604 bytes, so there might be more content not shown. However, based on what I can see:
This suggests either:
Let me think about what I know about the linter in this project: From the CLAUDE.md: And: Also from the checklist: Now, let me check if there are any obvious issues with what I can see in the diff:
Let me look more closely at cmd_lint_mock_test.go since that's the only file that seems directly related to linting: func TestLint_NotConnected(t *testing.T) {
mb := &mock.MockBackend{
IsConnectedFunc: func() bool { return false },
}
ctx, _ := newMockCtx(t, withBackend(mb))
err := execLint(ctx, &ast.LintStmt{})
assertError(t, err)
assertContainsStr(t, err.Error(), "not connected")
}
// ---------------------------------------------------------------------------
// listLintRules — ShowRules happy path
//
func TestLint_ShowRules(t *testing.T) {
mb := &mock.MockBackend{
IsConnectedFunc: func() bool { return true },
}
ctx, buf := newMockCtx(t, withBackend(mb))
err := execLint(ctx, &ast.LintStmt{ShowRules: true})
assertNoError(t, err)
out := buf.String()
if len(out) == 0 {
t.Fatal("expected output listing rules, got empty")
}
// listLintRules registers at least MPR001 (NamingConvention)
assertContainsStr(t, out, "MPR001")
assertContainsStr(t, out, "NamingConvention")
assertContainsStr(t, out, "Built-in rules:")
}This tests:
But it doesn't test the actual execution of lint rules against a project. The comment in the test says: This indicates that testing the actual lint rule execution isn't possible with the current mock infrastructure. Given the PR description mentions testing specific linter rules (MPR002, MPR003, etc.), but I don't see those tests in the visible diff, I suspect either:
Let me check if there are any other files that might contain linter rule tests. Actually, looking at the PR body again:
But in the visible diff, I don't see any tests that set up a full SQLite-backed project and run the linter against it. Let me think about what would be correct for testing linter rules: According to the CLAUDE.md checklist: For linter rule tests, I would expect:
The PR description mentions "SQLite-backed full Check() tests", which would involve setting up a full project in SQLite and running the linter's Check() function. But in the visible diff, I don't see evidence of that. I see mock-based tests for executor commands. Let me check if there are any files in the diff that might contain those SQLite-backed tests. Actually, I notice that the PR says it "Stacks on #254 (test/handler-mock-expand)". PR #254 might have added the mock infrastructure that makes it possible to test more things. Given the confusion, let me evaluate based on what I can see: Critical Issues:
Moderate Issues:
Minor Issues:
What Looks Good:
Recommendation: However, based on what I can see:
If the PR is actually about adding tests for executor command handlers (not linter rules as described), then it looks good. But if the PR is supposed to be about linter rule tests and I'm not seeing them due to the truncation, then I need to see more. Given the information available, I'll assume that the visible diff is representative and address the potential mismatch. Let me check one more thing: the PR title says "test(linter): add unit tests for all 14 untested linter rules" The "(linter)" scope suggests it's about the linter package. But the changes are in mdl/executor/ and relate to executor commands. This is confusing. Let me see if there's a linter package being tested. Actually, looking at the project structure from CLAUDE.md: So the linter rules would be in mdl/linter/rules/. I don't see any changes to that directory in the visible diff. This strengthens my suspicion that there's a mismatch. Let me look for any mention of linter rules in the visible diff... I don't see any. Given all this, I think the most likely explanation is that the PR description is inaccurate, and this PR is actually adding tests for various executor command handlers (not linter rules). The PR title and description mention "linter" but the changes are in executor command tests. This could be a mistake in the PR description. Alternatively, "linter" in the title might be referring to the fact that these tests are for the linter command's functionality (i.e., the executor handlers that the lint command uses), but that seems like a stretch. Let me check what the lint command does. From the CLI help in CLAUDE.md: And from the executor, there would be handlers for the lint command. In fact, I see cmd_lint_mock_test.go which tests the lint command. So perhaps the PR is about testing the lint command infrastructure, which executes the linter rules. That would make sense with the title "test(linter): add unit tests for all 14 untested linter rules" - meaning they're adding tests for the lint command that can execute those 14 rules. But even then, I don't see tests that actually execute the rules against a project; I see tests for the command infrastructure. Given the comment in cmd_lint_mock_test.go about the full lint path requiring more mock infrastructure, it seems they can't test the actual rule execution yet. Let me re-read the PR body:
But I don't see evidence of that in the visible diff. Unless... those tests are in files not shown due to truncation. The diff is 156604 bytes but truncated to 80k characters, so about half is not shown. It's possible the SQLite-backed tests are in the hidden portion. Given that, and given that the PR description is quite specific about what they're testing, I should assume they did implement what they said, and the truncation is hiding those parts. Let me evaluate based on the PR description and what I can infer: If they did add:
Then that would be valuable test coverage for the linter. The fact that they added Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 47 out of 47 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AI Code ReviewLet me analyze this PR based on the provided information. PR Title: "test(linter): add unit tests for all 14 untested linter rules" PR Body Summary:
Looking at the diff, I can see that it's adding many test files for various linter rules and functionality. The diff shows:
Now I need to review this against the checklist provided in CLAUDE.md. Let's go through the checklist sections: Overlap & duplication
MDL syntax design (for new or modified MDL syntax)
Full-stack consistency (for MDL features)
Test coverage
Security & robustness
Scope & atomicity
Code quality
Bugs & correctness
Now, let me look more closely at what the diff shows: The diff is primarily adding test files:
From the PR description:
This seems to be a well-planned effort to improve test coverage for the linter functionality. Looking at the diff, I see:
Wait, let me re-examine. The PR title says "test(linter): add unit tests for all 14 untested linter rules", but the diff shows tests for executor commands (cmd_*_mock_test.go). This seems inconsistent. Actually, looking more carefully at the diff, I see:
But the PR description says it's adding tests for linter rules. There's a disconnect here. Let me check if there are any linter-specific test files in the diff... Looking through the diff again, I don't see any explicit linter test files. The PR description mentions linter rules, but the diff shows executor command tests. However, the PR description does say: "Stacks on #254 (test/handler-mock-expand)". Let me think about what that might mean. Perhaps the linter rules are implemented as handlers in the executor, and testing those handlers is part of testing the linter functionality. In the mxcli architecture:
Actually, looking at the project structure from CLAUDE.md: And: So the linter rules are in But the diff shows tests in This is confusing. Let me look for linter-related tests in the diff... I don't see any files in Perhaps the PR description is slightly misleading, or perhaps the linter functionality is somehow tied to the executor. Another possibility: when you run Let me check the PR description again: "SQLite-backed full Check() tests for MPR002 (empty microflows), MPR003 (domain model size), SEC001 (entity access rules)" "Check()" likely refers to the linter's Check() function. And: "Helper function tests for CONV011-014 (loop commit, split caption, error handling), MPR004 (validation feedback) — test walker functions directly with synthetic microflow objects" This suggests they're testing the helper functions used by linter rules. And: "Metadata + nil-reader guard tests for SEC002, SEC003, MPR007, MPR008 — rules requiring *mpr.Reader" This suggests testing rules that need access to the MPR reader. And: "Pure unit tests for naming helpers and empty container testing" So overall, it seems they are testing the linter rules, but the test files are located in the executor test directory for some reason. Perhaps the linter rules are implemented as executor handlers? Or perhaps the test infrastructure is shared. Given the information available, I'll proceed with the review assuming that these tests are indeed for the linter functionality, even though they're placed in the executor test directory. Now, let's evaluate against the checklist: Overlap & duplication
MDL syntax design
Full-stack consistency
Test coverage
Security & robustness
Scope & atomicity
Code quality
Bugs & correctness
One concern: the PR title and description say it's for linter rules, but the diff shows tests in
Without seeing the actual implementation of the linter rules, it's hard to be certain, but the PR description is specific about which rules are being tested. Let me check if there are any linter test files that I missed in the diff... Scanning through the diff again, I don't see any files in Perhaps the linter rules are tested through the executor because when you run Alternatively, maybe the PR description is inaccurate and these are actually tests for executor commands, not linter rules. But the PR title explicitly says "test(linter): add unit tests for all 14 untested linter rules", and the description lists specific linter rule codes (MPR002, MPR003, SEC001, etc.), which match the linting framework mentioned in CLAUDE.md: So I think we have to go with the PR description that these are indeed tests for linter rules, even though they're located in the executor test directory. Perhaps the reason is that to test a linter rule, you need to:
And to do this in a unit test, you might need to use the executor infrastructure to:
This would explain why the tests are in the executor directory. Given all this, I believe this PR is appropriate and ready to be merged. Let me formulate my review: Critical Issues: None
Actually, let me double-check for any potential issues. One thing I noticed: in the diff, there's a file This is just a comment explaining limitations, not an actual issue with the test. Also, I should check if there are any obvious test anti-patterns. Looking at a few test functions:
This looks like good test practice. Another thing: the PR mentions "11 new test files, ~1450 lines". Let me see if the diff shows approximately that. Counting the test files in the diff:
Overall, this PR looks good to me. Wait, I just realized something. The PR is titled "test(linter): add unit tests for all 14 untested linter rules", but looking at the diff, I don't see any actual linter rule tests. I see tests for executor commands like alter page, agent editor, etc. Let me think about this differently. Perhaps the "linter" in the title refers to Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 48 out of 48 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AI Code ReviewWhat Looks Good
RecommendationApprove. This PR effectively addresses a clear gap in test coverage for the linter functionality with comprehensive, well-organized tests that follow established patterns in the codebase. As a pure test addition with no production code changes, it poses minimal risk while significantly improving test reliability for the linter rules. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 48 out of 48 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4553970 to
ea6603f
Compare
AI Code ReviewCritical IssuesMismatch between PR description and actual changes
The Moderate IssuesLack of focus and scope creep
Misleading documentation Minor IssuesIncomplete test notes What Looks GoodTest quality and patterns
RecommendationRequest changes with the following actions:
The PR should be resubmitted with focused changes that match its stated purpose: adding dedicated unit tests for the previously untested linter rules. If executor command testing is also needed, it should be in separate, focused PRs with accurate descriptions. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 48 out of 48 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is a stacked PR (D1 in a chain: #253 → #254 → #255). The diff includes changes from ancestor branches (#253 executor mock tests, #254 handler mock expansion), which is why the diff shows executor test files. This PR's own changes (1 squashed commit, 13 files) are exclusively linter rule unit tests in
The AI review is analyzing the full stacked diff rather than this branch's own changes. The linter test files are all present in the commit. |
Code ReviewOverviewD1 in the stacked series (#253 → #254 → #255). This PR has two distinct parts:
The linter tests are the main contribution here and they're well-designed given the constraints of each rule type. Blocking issue (inherited from #254)
The call Non-blocking issues
if activityBoxWidth != 120 {
t.Errorf("activityBoxWidth = %d, want 120", activityBoxWidth)
}This is a change-detector test on an internal heuristic constant that has no canonical "correct" value — someone tuning the overlap detection threshold will get a test failure with no guidance on the right new value. Since there's no behavioral test possible here anyway (noted in the comment), the constant check adds noise without protection. Consider dropping it or replacing with a comment-only file explaining the gap.
The rule fires at
Strengths
SummaryOne hard compile error (inherited |
|
@retran there are also linter rules that are in .claude/linter-rules, how do you handle those? |
Add 12 new test files (~1470 lines) covering all previously untested linter rules in mdl/linter/rules/: - SQLite-backed Check() tests for MPR002, MPR003, SEC001 - Walker function tests for CONV011-014, MPR004 - Metadata + nil-reader guard tests for SEC002, SEC003, MPR007, MPR008 - Pure unit tests for naming helpers and empty container detection - Shared test helpers extracted into helpers_test.go Also fixes a misleading comment in cmd_javaactions_mock_test.go clarifying the execShow connected-guard dependency.
- Remove change-detector constant test for MPR008 overlap thresholds - Add boundary tests for domain-size rule (exactly at and one over threshold) - Unify nil-reader assertions to check violations != nil consistently
ea6603f to
51ead9e
Compare
|
Thanks for the thorough review! Pushed fixes in a separate commit (51ead9e): Blocking issue (TestHelp_Mock): This already compiles and passes — Non-blocking fixes applied:
|
|
The That said, if you'd like test coverage for the Starlark rules too, I can add that as a follow-up. |
Why
The mxcli project is preparing to extract the
mdl/runtime into a reusable library. PRs #253–#254 covered executor handlers; this PR completes the linter subsystem coverage. All 14 linter rules inmdl/linter/rules/had zero dedicated unit tests — any refactoring of the linter pipeline or individual rule logic would have no regression protection.Linter rules are particularly important to test because they encode domain-specific correctness checks (naming conventions, security policies, model size limits) that are easy to break silently during structural refactoring.
Part of the stacked PR series: #253 (C1) → #254 (C2) → #255 (D1).
Summary
*mpr.ReaderStacks on #254 (test/handler-mock-expand).