Skip to content

Conversation

@scunningham
Copy link
Contributor

Fix tests; the stats count was not being tested properly leading to false negatives.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds node scope support to the compiler and fixes test issues where stats counts were not being properly validated, leading to false negatives in tests.

Changes:

  • Changed StatsT type from map[string]any to map[string]int64 for type safety
  • Added a negative boolean field to test cases to distinguish between tests that expect problems vs. those that shouldn't
  • Changed compiler scope from ScopeDefault to ScopeNode and added a default plugin for the node scope

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/pkg/ux/ux.go Changed StatsT type definition from map[string]any to map[string]int64 for consistent type handling
internal/pkg/ux/eval.go Updated FinalStats to cast uint32 values to int64 to match new StatsT type
internal/pkg/ux/eval_test.go Removed redundant type assertions since StatsT now returns int64 directly
test/preq_test.go Added negative field to test struct and switched to proper conditional logic for validating stats based on test expectations; removed unnecessary uint32 cast
internal/pkg/engine/engine.go Added node scope plugin and changed compilation scope from ScopeDefault to ScopeNode
Comments suppressed due to low confidence (1)

test/preq_test.go:191

  • The test case 'Example21-miss' in TestMissExamples uses the same rule and data files as 'Example21' in TestSuccessExamples. However, 'Example21' in TestSuccessExamples is marked with negative: true (expecting no problems), while 'Example21-miss' expects no problems. This appears to be a duplicate test case. Consider removing the duplicate or clarifying the different expected behaviors with distinct test data.
		"Example21-miss": {
			rulePath: "../examples/21-negative-example.yaml",
			dataPath: "../examples/21-example.log",
		},

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@scunningham scunningham marked this pull request as ready for review January 14, 2026 16:59
@scunningham scunningham requested a review from aleksmaus January 14, 2026 17:00
@scunningham scunningham merged commit 4a790ba into main Jan 14, 2026
8 checks passed
@scunningham scunningham deleted the fix_tests branch January 14, 2026 17:43
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.

3 participants