Skip to content

Fix industry-specific rego files for OPA check and Regal lint compliance#13

Merged
Prinevo merged 4 commits into
mainfrom
fix/industry-specific-rego-issues
Jul 1, 2025
Merged

Fix industry-specific rego files for OPA check and Regal lint compliance#13
Prinevo merged 4 commits into
mainfrom
fix/industry-specific-rego-issues

Conversation

@kmadan
Copy link
Copy Markdown
Contributor

@kmadan kmadan commented Jul 1, 2025

Summary

This PR resolves issues with industry-specific rego files to ensure they pass both OPA check and Regal lint validation.

Changes Made

🔧 Package Naming Fixes

  • Fixed all education industry files to use correct package naming convention industry_specific.education.v1.* instead of education.v1.*
  • Updated 12 education rego files across academic_integrity, assessment_and_evaluation, fairness_and_equity, safe_learning_environment, and student_data_privacy modules

🚗 Automotive Vehicle Safety Policy

  • Fixed trailing default rule placement (moved defaults to be grouped with their related rules)
  • Fixed assignment operator usage (:= instead of =)
  • Restructured test package to use separate test package with proper imports
  • Resolved messy-rule violations by grouping related incremental rules together
  • Applied proper OPA formatting

🏥 Healthcare Diagnostic Safety Policy

  • Fixed unresolved import issues by replacing complex function calls with direct score comparisons
  • Resolved dependency issues with global common functions

📝 Code Quality Improvements

  • Applied opa fmt formatting to ensure consistent code style
  • Fixed messy-rule violations where variable rules were separated by other variables or rules
  • Ensured proper test structure with separate test packages

Validation Results

OPA Check: PASSING (0 errors)

opa check --ignore custom/ .
# No output = success

Regal Lint: PASSING (0 violations)

regal lint --ignore-files custom/ .
# 86 files linted. No violations found.

Tests: Automotive tests passing (2/2)

opa test industry_specific/automotive/v1/vehicle_safety/
# PASS: 2/2

Files Modified

Education Package Name Fixes

  • industry_specific/education/v1/academic_integrity/ai_plagiarism_detection.rego
  • industry_specific/education/v1/academic_integrity/acceptable_ai_use.rego
  • industry_specific/education/v1/assessment_and_evaluation/human_in_the_loop_grading.rego
  • industry_specific/education/v1/assessment_and_evaluation/responsible_ai_proctoring.rego
  • industry_specific/education/v1/fairness_and_equity/digital_divide_mitigation.rego
  • industry_specific/education/v1/fairness_and_equity/equitable_admissions_systems.rego
  • industry_specific/education/v1/fairness_and_equity/unbiased_automated_grading.rego
  • industry_specific/education/v1/safe_learning_environment/age_appropriate_content.rego
  • industry_specific/education/v1/safe_learning_environment/instructional_tool_vetting.rego
  • industry_specific/education/v1/student_data_privacy/coppa_compliance.rego
  • industry_specific/education/v1/student_data_privacy/data_minimization.rego
  • industry_specific/education/v1/student_data_privacy/ferpa_compliance.rego

Automotive Policy Fixes

  • industry_specific/automotive/v1/vehicle_safety/vehicle_safety.rego
  • industry_specific/automotive/v1/vehicle_safety/vehicle_safety_test.rego

Healthcare Policy Fixes

  • industry_specific/healthcare/v1/diagnostic_safety/diagnostic_safety.rego

Impact

  • ✅ All industry-specific rego files now comply with OPA standards
  • ✅ Zero Regal lint violations across the entire codebase
  • ✅ Proper package naming consistency maintained
  • ✅ Test structure follows best practices
  • ✅ Code formatting is consistent and clean

This resolves the issues mentioned in the handoff session notes and ensures the CI pipeline will pass the required opa-checks status check.


Pull Request opened by Augment Code with guidance from the PR author

kmadan added 4 commits July 1, 2025 17:57
…licy

- Removed redundant check for input.safety_assessment.hara_analysis existence
- The subsequent property access already validates the object exists
- Resolves Regal lint 'redundant-existence-check' violation
@kmadan kmadan requested a review from Prinevo July 1, 2025 17:10
Copy link
Copy Markdown
Contributor

@Prinevo Prinevo left a comment

Choose a reason for hiding this comment

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

Good addiiton,

@Prinevo Prinevo merged commit af8c472 into main Jul 1, 2025
2 checks passed
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