Skip to content

refactor: move all data.lib top-level functions to subcategories#1691

Merged
dheerajodha merged 2 commits intoconforma:mainfrom
dheerajodha:EC-1651
Mar 25, 2026
Merged

refactor: move all data.lib top-level functions to subcategories#1691
dheerajodha merged 2 commits intoconforma:mainfrom
dheerajodha:EC-1651

Conversation

@dheerajodha
Copy link
Copy Markdown
Contributor

resolves: EC-1651

Copy link
Copy Markdown
Contributor

@st3penta st3penta left a comment

Choose a reason for hiding this comment

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

It would be better to reduce the amount of stuff that ends up in the utils dir, and use meaningful subfolders where possible, even if they have one file each.

I think we could even completely avoid it, if we add these packages:

  • assertions
  • metadata
  • rule_data
  • sets
  • sigstore
  • strings
  • volatlie

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
checks/annotations_test.rego 100.00% <100.00%> (ø)
policy/build_task/build_labels/build_labels.rego 100.00% <100.00%> (ø)
...icy/build_task/build_labels/build_labels_test.rego 100.00% <100.00%> (ø)
policy/lib/arrays/array_helpers_test.rego 100.00% <100.00%> (ø)
policy/lib/assertions/assertions.rego 100.00% <ø> (ø)
policy/lib/assertions/assertions_test.rego 100.00% <100.00%> (ø)
policy/lib/image/image_test.rego 100.00% <100.00%> (ø)
policy/lib/json/schema_test.rego 100.00% <100.00%> (ø)
policy/lib/k8s/k8s_test.rego 100.00% <100.00%> (ø)
policy/lib/metadata/metadata.rego 100.00% <100.00%> (ø)
... and 117 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@simonbaird
Copy link
Copy Markdown
Member

Try make fmt to fix the format CI failure.

st3penta
st3penta previously approved these changes Mar 16, 2026
Copy link
Copy Markdown
Contributor

@st3penta st3penta left a comment

Choose a reason for hiding this comment

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

great job!

joejstuart
joejstuart previously approved these changes Mar 16, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

Important

Review skipped

Too many files!

This PR contains 173 files, which is 23 over the limit of 150.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6bbe1d14-4ef9-4bd3-8c25-745e59d46b30

📥 Commits

Reviewing files that changed from the base of the PR and between 6ddb8f6 and 721815d.

📒 Files selected for processing (173)
  • .regal/config.yaml
  • Makefile
  • antora/docs/modules/ROOT/pages/packages/build_task_build_labels.adoc
  • antora/docs/modules/ROOT/pages/packages/pipeline_required_tasks.adoc
  • antora/docs/modules/ROOT/pages/packages/pipeline_task_bundle.adoc
  • antora/docs/modules/ROOT/pages/packages/release_attestation_type.adoc
  • antora/docs/modules/ROOT/pages/packages/release_base_image_registries.adoc
  • antora/docs/modules/ROOT/pages/packages/release_buildah_build_task.adoc
  • antora/docs/modules/ROOT/pages/packages/release_cve.adoc
  • antora/docs/modules/ROOT/pages/packages/release_external_parameters.adoc
  • antora/docs/modules/ROOT/pages/packages/release_git_branch.adoc
  • antora/docs/modules/ROOT/pages/packages/release_github_certificate.adoc
  • antora/docs/modules/ROOT/pages/packages/release_hermetic_task.adoc
  • antora/docs/modules/ROOT/pages/packages/release_labels.adoc
  • antora/docs/modules/ROOT/pages/packages/release_olm.adoc
  • antora/docs/modules/ROOT/pages/packages/release_pre_build_script_task.adoc
  • antora/docs/modules/ROOT/pages/packages/release_prefetch_dependencies.adoc
  • antora/docs/modules/ROOT/pages/packages/release_provenance_materials.adoc
  • antora/docs/modules/ROOT/pages/packages/release_rhtap_multi_ci.adoc
  • antora/docs/modules/ROOT/pages/packages/release_rpm_build_deps.adoc
  • antora/docs/modules/ROOT/pages/packages/release_rpm_ostree_task.adoc
  • antora/docs/modules/ROOT/pages/packages/release_rpm_packages.adoc
  • antora/docs/modules/ROOT/pages/packages/release_rpm_pipeline.adoc
  • antora/docs/modules/ROOT/pages/packages/release_rpm_repos.adoc
  • antora/docs/modules/ROOT/pages/packages/release_rpm_signature.adoc
  • antora/docs/modules/ROOT/pages/packages/release_sbom.adoc
  • antora/docs/modules/ROOT/pages/packages/release_sbom_cyclonedx.adoc
  • antora/docs/modules/ROOT/pages/packages/release_sbom_spdx.adoc
  • antora/docs/modules/ROOT/pages/packages/release_schedule.adoc
  • antora/docs/modules/ROOT/pages/packages/release_slsa_build_build_service.adoc
  • antora/docs/modules/ROOT/pages/packages/release_slsa_build_scripted_build.adoc
  • antora/docs/modules/ROOT/pages/packages/release_slsa_provenance_available.adoc
  • antora/docs/modules/ROOT/pages/packages/release_slsa_source_correlated.adoc
  • antora/docs/modules/ROOT/pages/packages/release_slsa_source_version_controlled.adoc
  • antora/docs/modules/ROOT/pages/packages/release_source_image.adoc
  • antora/docs/modules/ROOT/pages/packages/release_tasks.adoc
  • antora/docs/modules/ROOT/pages/packages/release_test.adoc
  • antora/docs/modules/ROOT/pages/packages/release_trusted_task.adoc
  • antora/docs/modules/ROOT/pages/packages/release_volatile_config.adoc
  • antora/docs/modules/ROOT/pages/packages/stepaction_stepaction_image.adoc
  • antora/docs/modules/ROOT/pages/packages/task_results.adoc
  • antora/docs/modules/ROOT/pages/packages/task_step_image_registries.adoc
  • antora/docs/modules/ROOT/pages/packages/task_trusted_artifacts.adoc
  • checks/annotations_test.rego
  • policy/build_task/build_labels/build_labels.rego
  • policy/build_task/build_labels/build_labels_test.rego
  • policy/lib/arrays/array_helpers_test.rego
  • policy/lib/assertions/assertions.rego
  • policy/lib/assertions/assertions_test.rego
  • policy/lib/assertions_test.rego
  • policy/lib/image/image_test.rego
  • policy/lib/json/schema_test.rego
  • policy/lib/k8s/k8s_test.rego
  • policy/lib/metadata/metadata.rego
  • policy/lib/metadata/metadata_test.rego
  • policy/lib/rule_data/rule_data.rego
  • policy/lib/rule_data/rule_data_test.rego
  • policy/lib/sbom/rpm_test.rego
  • policy/lib/sbom/sbom.rego
  • policy/lib/sbom/sbom_test.rego
  • policy/lib/set_helpers_test.rego
  • policy/lib/sets/sets.rego
  • policy/lib/sets/sets_test.rego
  • policy/lib/sigstore/sigstore.rego
  • policy/lib/sigstore/sigstore_test.rego
  • policy/lib/string_utils_test.rego
  • policy/lib/strings/strings.rego
  • policy/lib/strings/strings_test.rego
  • policy/lib/tekton/bundles_test.rego
  • policy/lib/tekton/pipeline.rego
  • policy/lib/tekton/pipeline_test.rego
  • policy/lib/tekton/recorded_att_test.rego
  • policy/lib/tekton/refs_test.rego
  • policy/lib/tekton/task_results_test.rego
  • policy/lib/tekton/task_test.rego
  • policy/lib/tekton/trusted.rego
  • policy/lib/tekton/trusted_test.rego
  • policy/lib/time/time_test.rego
  • policy/lib/volatile/volatile_config.rego
  • policy/lib/volatile/volatile_config_test.rego
  • policy/pipeline/basic/basic.rego
  • policy/pipeline/basic/basic_test.rego
  • policy/pipeline/required_tasks/required_tasks.rego
  • policy/pipeline/required_tasks/required_tasks_test.rego
  • policy/pipeline/task_bundle/task_bundle.rego
  • policy/pipeline/task_bundle/task_bundle_test.rego
  • policy/release/attestation_type/attestation_type.rego
  • policy/release/attestation_type/attestation_type_test.rego
  • policy/release/base_image_registries/base_image_registries.rego
  • policy/release/base_image_registries/base_image_registries_test.rego
  • policy/release/buildah_build_task/buildah_build_task.rego
  • policy/release/buildah_build_task/buildah_build_task_test.rego
  • policy/release/cve/cve.rego
  • policy/release/cve/cve_test.rego
  • policy/release/external_parameters/external_parameters.rego
  • policy/release/external_parameters/external_parameters_test.rego
  • policy/release/git_branch/git_branch.rego
  • policy/release/git_branch/git_branch_test.rego
  • policy/release/github_certificate/github_certificate.rego
  • policy/release/github_certificate/github_certificate_test.rego
  • policy/release/hermetic_task/hermetic_task.rego
  • policy/release/hermetic_task/hermetic_task_test.rego
  • policy/release/labels/labels.rego
  • policy/release/labels/labels_test.rego
  • policy/release/lib/attestations_test.rego
  • policy/release/olm/olm.rego
  • policy/release/olm/olm_test.rego
  • policy/release/pre_build_script_task/pre_build_script_task.rego
  • policy/release/pre_build_script_task/pre_build_script_task_test.rego
  • policy/release/prefetch_dependencies/prefetch_dependencies.rego
  • policy/release/prefetch_dependencies/prefetch_dependencies_test.rego
  • policy/release/provenance_materials/provenance_materials.rego
  • policy/release/provenance_materials/provenance_materials_test.rego
  • policy/release/quay_expiration/quay_expiration.rego
  • policy/release/quay_expiration/quay_expiration_test.rego
  • policy/release/rhtap_multi_ci/rhtap_multi_ci.rego
  • policy/release/rhtap_multi_ci/rhtap_multi_ci_test.rego
  • policy/release/rpm_build_deps/rpm_build_deps.rego
  • policy/release/rpm_build_deps/rpm_build_deps_test.rego
  • policy/release/rpm_ostree_task/rpm_ostree_task.rego
  • policy/release/rpm_ostree_task/rpm_ostree_task_test.rego
  • policy/release/rpm_packages/rpm_packages.rego
  • policy/release/rpm_packages/rpm_packages_test.rego
  • policy/release/rpm_pipeline/rpm_pipeline.rego
  • policy/release/rpm_pipeline/rpm_pipeline_test.rego
  • policy/release/rpm_repos/rpm_repos.rego
  • policy/release/rpm_repos/rpm_repos_test.rego
  • policy/release/rpm_signature/rpm_signature.rego
  • policy/release/rpm_signature/rpm_signature_test.rego
  • policy/release/sbom/sbom.rego
  • policy/release/sbom/sbom_test.rego
  • policy/release/sbom_cyclonedx/sbom_cyclonedx.rego
  • policy/release/sbom_cyclonedx/sbom_cyclonedx_test.rego
  • policy/release/sbom_spdx/sbom_spdx.rego
  • policy/release/sbom_spdx/sbom_spdx_test.rego
  • policy/release/schedule/schedule.rego
  • policy/release/schedule/schedule_test.rego
  • policy/release/slsa_build_build_service/slsa_build_build_service.rego
  • policy/release/slsa_build_build_service/slsa_build_build_service_test.rego
  • policy/release/slsa_build_scripted_build/slsa_build_scripted_build.rego
  • policy/release/slsa_build_scripted_build/slsa_build_scripted_build_test.rego
  • policy/release/slsa_provenance_available/slsa_provenance_available.rego
  • policy/release/slsa_provenance_available/slsa_provenance_available_test.rego
  • policy/release/slsa_source_correlated/slsa_source_correlated.rego
  • policy/release/slsa_source_correlated/slsa_source_correlated_test.rego
  • policy/release/slsa_source_version_controlled/slsa_source_version_controlled.rego
  • policy/release/slsa_source_version_controlled/slsa_source_version_controlled_test.rego
  • policy/release/source_image/source_image.rego
  • policy/release/source_image/source_image_test.rego
  • policy/release/tasks/tasks.rego
  • policy/release/tasks/tasks_test.rego
  • policy/release/test/test.rego
  • policy/release/test/test_test.rego
  • policy/release/trusted_task/trusted_task.rego
  • policy/release/trusted_task/trusted_task_test.rego
  • policy/release/volatile_config/volatile_config.rego
  • policy/release/volatile_config/volatile_config_test.rego
  • policy/stepaction/stepaction_image/stepaction_image.rego
  • policy/stepaction/stepaction_image/stepaction_image_test.rego
  • policy/stepaction/stepaction_kind/stepaction_kind.rego
  • policy/stepaction/stepaction_kind/stepaction_kind_test.rego
  • policy/task/annotations/annotations.rego
  • policy/task/annotations/annotations_test.rego
  • policy/task/kind/kind.rego
  • policy/task/kind/kind_test.rego
  • policy/task/results/results.rego
  • policy/task/results/results_test.rego
  • policy/task/step_image_registries/step_image_registries.rego
  • policy/task/step_image_registries/step_image_registries_test.rego
  • policy/task/step_images/step_images.rego
  • policy/task/step_images/step_images_test.rego
  • policy/task/trusted_artifacts/trusted_artifacts.rego
  • policy/task/trusted_artifacts/trusted_artifacts_test.rego

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

- Restructure lib.utils into meaningful subdirectories:
  - lib.assertions (test assertion helpers)
  - lib.metadata (policy result builders)
  - lib.rule_data (configuration data access)
  - lib.sets (set/array utilities)
  - lib.sigstore (sigstore configuration)
  - lib.strings (string helpers)
  - lib.volatile (volatile config lifecycle)
- Replace import aliases with explicit package names for readability
- Update 129 files to use specific package imports
- Remove generic utils namespace to avoid anti-pattern

Addresses code review feedback to improve code organization and
readability by using self-documenting package names.

resolves: EC-1651

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove unnecessary stderr redirections (2>&1 and 2>/dev/null) from
TEST_CMD and COVERAGE_CMD. The mock functions in tests now properly
prevent network calls, making error output suppression unnecessary.

resolves: EC-1651

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@simonbaird simonbaird left a comment

Choose a reason for hiding this comment

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

It's gonna be more conflict pain the longer this stays unmerged. Feel free to merge early and make fixups in new PRs if needed.

@simonbaird
Copy link
Copy Markdown
Member

Nice work!

@dheerajodha dheerajodha merged commit 6f91359 into conforma:main Mar 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants