Skip to content

Add rules engine framework and exit code validation#2

Open
milansamuel609 wants to merge 3 commits into
web-servers:mainfrom
milansamuel609:feat/rules-engine-framework
Open

Add rules engine framework and exit code validation#2
milansamuel609 wants to merge 3 commits into
web-servers:mainfrom
milansamuel609:feat/rules-engine-framework

Conversation

@milansamuel609
Copy link
Copy Markdown

@milansamuel609 milansamuel609 commented May 27, 2026

PR Overview:

Introduces the validation data model and exit code verification logic for the JBoss Web Server diagnostics tool pipeline. This forms the foundation for the validation command (Week 1) that evaluates server states and maps results to system exit codes.

Core Structural Additions:

  • SeverityLevels (Enum): Defines the core diagnostic severities: ERROR, WARN, and INFO.

  • Finding (Model Class): Root data model defining the attributes required to scan, flag, and display debugging information (e.g., rule ID, category, severityLevels, summary, file, and fix).

  • ValidateCommand (Logic): Contains the core logic (determineExitCode) to evaluate findings and map them to standard system exit codes.

Architectural Approaches:

  • Decoupled the validation severity logging from exit code logic, ensuring that a single ERROR severity finding escalates the entire process exit code appropriately.

  • Structured the Finding model to capture the exact source file and resolution steps immediately to streamline developer troubleshooting.

Testing & Verification:

mvn verify

Test Specifications:

  • Current Implementation: Created 3 new unit tests in ValidateCommandTest to verify that the determineExitCode logic accurately maps lists of findings (Empty/OK, Warnings-only, and Errors) based on the severityLevel attribute.

  • Future Scope: While testing currently relies on severityLevels to verify exit codes, the logic can be expanded in future PRs to utilize all Finding model attributes for more precise and accurate evaluation.

Status: All 7 existing framework tests passed, and the 3 newly added validation tests passed successfully.

Rules Engine Framework: Establishes the core architecture and interfaces to execute diagnostic checks across the environment.

Exit Code Validation: Integrates logic within ValidateCommand to map aggregated findings directly to system exit codes.
Comment thread src/main/java/org/jboss/jws/diag/validate/ValidateCommand.java Outdated
Comment thread src/test/java/org/jboss/jws/diag/validate/ValidateCommandTest.java
Comment thread src/main/java/org/jboss/jws/diag/common/SeverityLevels.java Outdated
Comment thread src/main/java/org/jboss/jws/diag/validate/model/Finding.java Outdated
Comment thread src/main/java/org/jboss/jws/diag/validate/model/Finding.java Outdated
Comment thread src/main/java/org/jboss/jws/diag/validate/Rule.java Outdated
@milansamuel609
Copy link
Copy Markdown
Author

milansamuel609 commented May 29, 2026

Hi @dsoumis,

I have addressed the feedback:

  • Renamed SeverityLevels to Severity to match the design document and standard Java conventions.
  • Refactored the Finding model to implement the Builder pattern, improving code readability.
  • Updated the validation logic to correctly handle all scenarios.

Testing and Verification:

  • I have verified this against both the original cases and the new scenarios.
  • The code is passing all 17 test cases (original + new) successfully.
  • I have used similar set of validation rules to verify the test cases as the current implementation is mainly based on the severity.

Thank you so much for this guidance; it has been incredibly helpful. I’ve worked on projects on my own before, but I’ve never had this much exposure to how things are done in an industry setting. I’m really looking forward to learning much more from you! :)

Comment thread src/main/java/org/jboss/jws/diag/validate/model/Finding.java
Comment thread src/main/java/org/jboss/jws/diag/validate/model/Finding.java Outdated
Comment thread src/main/java/org/jboss/jws/diag/validate/RuleContext.java Outdated
@milansamuel609
Copy link
Copy Markdown
Author

Hi @dsoumis,

I have addressed all three changes. Please review when you get a chance.

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.

2 participants