Single-source the DRC deck registry across the Python and Ruby sides - #28
Open
Mauricio-xx wants to merge 2 commits into
Open
Single-source the DRC deck registry across the Python and Ruby sides#28Mauricio-xx wants to merge 2 commits into
Mauricio-xx wants to merge 2 commits into
Conversation
Extract the deck-name to rule-file mapping, the default-skip policy and the file-selection logic into intm4tm2_decks.py (deck names) and intm4tm2_decks.rb (mapping plus deck_files()), imported by run_drc.py and required by the intm4tm2.drc runset. The registries were previously duplicated as literals in both files and drifted by hand; now the two halves share one source and a CI check can assert they agree. The runset now raises on a registered-but-missing deck file instead of loading a silent empty string. Add KNOWN_UNTESTED_DECKS to the regression runner and defer its klayout import so the module is importable without a KLayout install (the registry check reads GOLDEN and KNOWN_UNTESTED_DECKS from it). Verified: 17/17 golden regression tables pass; the default all-deck path loads 20 decks with density skipped; the missing-deck raise fires.
Land the emission-based deck-registry checker (testing/check_deck_registry.py) and its pytest self-test (testing/test_deck_registry.py). The checker imports the Python registry, evals the Ruby registry via a ruby subprocess that emits BOTH branches of deck_files() (the default nil run and five requested-branch probes: full, strict-subset, empty, case-fold and mangled-name), imports run_regression for GOLDEN/KNOWN_UNTESTED and globs rule_decks/, then asserts the emitters agree: exit 0 all-hold / 1 failures-collected / 2 no-verdict with a named reason (probe-degeneracy included, so a vacuous probe is never a green). It runs klayout-free. Also document the runset's post-call drc_files mutation as out of the checker's model (symmetric to the Python read-then-filter residual), and repoint the mim deck's deck-selection note at intm4tm2_decks.rb. Verified: checker exit 0 against the tree; self-test 127/127.
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.
Single-source the DRC deck registry so the Python and Ruby halves cannot drift.
The registry (deck names, the default-skip policy, and the name to rule-file map) lived as hand-maintained literals in both run_drc.py and intm4tm2.drc, and the two copies had already drifted. This extracts the registry and the file-selection logic into two klayout-free shared modules, intm4tm2_decks.py and intm4tm2_decks.rb, that the Python entry point imports and the Ruby runset requires. Neither producer keeps its own copy any more.
A CI checker (testing/check_deck_registry.py) asserts the two sides agree by comparing the values each owner emits, never by re-parsing source: it imports the .py, evals the .rb through ruby, imports run_regression for the GOLDEN and known-untested sets, and globs rule_decks. It exits non-zero on drift and names its reason on any no-verdict path. A hermetic self-test (test_deck_registry.py, 127 cases, tmp_path only) covers the checker itself.
Behavior is unchanged except one hardening: a deck registered but missing from rule_decks now raises instead of loading silently as empty.
Verified on this branch: checker green, self-test 127/127, full DRC regression all tables pass. Wiring the checker into the tests workflow is a separate follow-up, so it does not gate here yet.