Repository navigation
ci: check Python and JS KB sync in kb-check.yml - #1539
Open
shivamtiwari3 wants to merge 1 commit into
Open
shivamtiwari3 wants to merge 1 commit into
shivamtiwari3 wants to merge 1 commit into
Conversation
The KB check verified assets/content_types_kb.min.json and (via the Rust workflow) the Rust generated files, but nothing checked the Python and JS files generated from the KB. A label rename or an is_text change could leave python/src/magika/types/content_type_label.py, js/src/content-type-label.ts and js/src/content-types-infos.ts stale. Run python/scripts/sync.py for python and js and fail if the tracked generated files changed. Also trigger the workflow when those generated files or python/scripts/sync.py change.
This branch has not been deployed
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.
Fixes #1535.
Summary
.github/workflows/kb-check.ymlverified thatassets/content_types_kb.min.jsonis in sync (sync_kb.py --check) and the Rust workflow verified the Rust generated files, but nothing checked the Python and JS files generated from the KB. A content type label rename or anis_textchange could leave these stale:python/src/magika/types/content_type_label.pyjs/src/content-type-label.tsjs/src/content-types-infos.tsChange
uv run python/scripts/sync.py pythonanduv run python/scripts/sync.py js, then fail ifgit diff --exit-codereports changes to the three generated files, with a message pointing atjust sync-kb.python/scripts/sync.py, the Python generated file, and the two JS generated files to the workflow'spathstriggers.Testing
uv run python/scripts/sync.py pythonand... jsare idempotent on a clean tree (no diff).content_type_label.py); the new check reports it out of sync and exits non-zero.python -c "import yaml; yaml.safe_load(...)"parses the workflow.Note
@reyammer mentioned doing this via the new
just sync-kb. I kept it to the Python/JS steps described in the issue so the workflow doesn't rebuild the Rust side (whichrust-test.ymlalready checks), but I'm happy to switch touvx --from rust-just just sync-kbif you prefer a single entry point.