Skip to content

Replace the ID range validation script#1163

Merged
gouttegd merged 2 commits intomasterfrom
replace-idrange-validation-program
Jan 5, 2025
Merged

Replace the ID range validation script#1163
gouttegd merged 2 commits intomasterfrom
replace-idrange-validation-program

Conversation

@gouttegd
Copy link
Contributor

@gouttegd gouttegd commented Jan 4, 2025

This PR replaces the validate_id_ranges.sc Scala script by a program dedicated to the management of ID range files, dicer-cli.

Rationale for this replacement:

  • Better validation: dicer-cli detects more errors than validate_id_ranges.sc, which only detects overlapping ranges. For example, this error in CL was only detected by dicer-cli.
  • No need for downloads at runtime. Executing the validate_id_ranges.sc script requires the Scala interpreter to download the script’s dependencies (such as the OWLAPI library) at runtime. The dicer-cli tool is self-sufficient.
  • Additional features. In addition to validating the ID range file, dicer-cli can also be used to easily add new ranges to the file.

With the validate_id_ranges.sc script removed, there is no longer any standard, ODK-generated workflow that requires a Scala interpreter, so Ammonite is moved from ODKLite to ODKFull.

Use the new program Dicer-CLI to validate the ID range file, instead of
the Scala script `validate_id_ranges.sc`.

There were at least two problems with that script:

* Beyond syntax errors, it only detects overlapping ranges; it does not
  detect ranges that are intrinsically invalid.
* Its execution requires the Scala interpreter to download dependencies
  at runtime.

The new dicer-cli program fixes both issues: it detects all invalid
ranges, and is self-sufficient.
Ammonite is no longer used by any standard, ODK-generated workflow -- it
was only used by the `make validate_idranges` workflow, which now uses a
dedicated program.

So we move Ammonite to the ODKFull image only, in line with the intended
usage of ODKLite -- ODKLite should contain everything that is required
by standard workflows, and nothing more.
@gouttegd gouttegd self-assigned this Jan 4, 2025
@gouttegd gouttegd requested a review from matentzn January 5, 2025 01:03
Copy link
Contributor

@matentzn matentzn left a comment

Choose a reason for hiding this comment

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

Big yes!

I wonder if it would make sense in cases like this to include a routine in the repo update process to clean up files that are no longer needed, like

template/src/scripts/validate_id_ranges.sc

Just a thought, not a blocker for this PR.

@gouttegd
Copy link
Contributor Author

gouttegd commented Jan 5, 2025

I wonder if it would make sense in cases like this to include a routine in the repo update process to clean up files that are no longer needed

Sounds like a good idea indeed.

@gouttegd gouttegd merged commit 1d0bfa5 into master Jan 5, 2025
1 check passed
@gouttegd gouttegd deleted the replace-idrange-validation-program branch January 5, 2025 10:42
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