fix: Refactor site-list generator for deterministic sorting, safer wr…#2905
Open
atewari-rh wants to merge 1 commit intosherlock-project:masterfrom
Open
fix: Refactor site-list generator for deterministic sorting, safer wr…#2905atewari-rh wants to merge 1 commit intosherlock-project:masterfrom
atewari-rh wants to merge 1 commit intosherlock-project:masterfrom
Conversation
…ites, and CI-friendly checks Signed-off-by: atewari <atewari@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This issue improves the
devel/site-list.pyworkflow so site metadata generation is deterministic, safer to run repeatedly, and easier to validate in CI.The script now enforces project-specific ordering rules (digit-prefixed names first, then alphabetical), validates input data quality, and introduces a CLI interface for both checking and writing outputs.
Why these changes were needed
The previous implementation worked, but had a few gaps that made maintenance and automation harder:
Default lexical sorting did not clearly enforce the desired ordering strategy (digit-first, then normal alphabetical).
Relative paths could fail when the script was run from a different folder.
Re-running could fail if
output/already existed.There was no dedicated way to validate sort/order correctness without rewriting files.
Direct write operations can leave files half-written if interrupted.
The generated
sites.mdxdescription could become stale over time.Missing or invalid
urlMainfields could fail later with less actionable errors.What changed
1) Deterministic custom sorting
"$schema"at the top ofdata.json2) Reliable path handling
pathliband script-relative defaults so the script works regardless of where it is invoked from.3) Safer structure and execution
main()withif __name__ == "__main__":guard.4) Validation of input records
urlMain.5) Atomic file writes
6) CLI support for automation
--check→ verify ordering without writing--write→ write sorteddata.jsonand generatedsites.mdx--data-file→ custom data source path--output-dir→ custom output directory7) Dynamic generated metadata
sites.mdxdescription now uses the actual number of supported sites automatically.How to use the current script
From the repository root (or anywhere, since paths are script-relative by default):
Check-only mode (ideal for CI)
This aims to solve issue #2904