Make built-in post-load callbacks public (#286) - #293
Merged
Conversation
The documented recipe for disabling a built-in post-load callback imported a private name (_remove_ipv4_acl_remarks), so a rename would silently break downstream drivers. Rename all eight built-in callbacks to public names in their driver modules, giving them stable identities that users remove with rules.post_load_callbacks.remove(callback). Two names are cleaned up beyond the underscore strip: _rm_ipv6_acl_sequence_numbers -> remove_ipv6_acl_sequence_numbers and the stuttering _fixup_hp_procurve_aaa_port_access_fixup -> fixup_hp_procurve_aaa_port_access. Identity-pin tests per platform and a recipe regression test guard the new public surface; the docs recipe now removes by identity instead of slice-filtering.
Rename test_rm_ipv6_acl_sequence_numbers to match the callback's new public spelling, drop docs-recipe prose that restated itself (the frozen-model comment duplicated the sentence above the snippet; the ValueError caveat folds into that sentence), and trim the changelog entry to the user-visible change.
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.
Summary
Closes #286.
The documented recipe for disabling a built-in post-load callback (Administrator Guide → Customizing Driver Rules) imported a private name —
_remove_ipv4_acl_remarks— so an internal rename would silently break downstream drivers. This PR gives all eight built-in callbacks stable public identities, renamed in place in their driver modules:platforms/cisco_ios/driver.pyremove_ipv4_acl_remarks,remove_ipv6_acl_sequence_numbers(was_rm_...),add_acl_sequence_numbersplatforms/aruba_aoscx/driver.pysplit_interface_vlan_trunk_allowedplatforms/cisco_xr/driver.pyfixup_xr_commentsplatforms/hp_procurve/driver.pyfixup_hp_procurve_aaa_port_access(stutter fixed, was_fixup_..._fixup),fixup_hp_procurve_device_profile,fixup_hp_procurve_vlanThe docs recipe now removes by identity —
rules.post_load_callbacks.remove(remove_ipv4_acl_remarks)— instead of slice-filtering against a private import.Notes:
remove_post_load_callback()helper, no__all__, no top-level re-exports (import fromhier_config.platforms.<x>.driver, matching the existingsplit_vlan_id_listsprecedent).docs/dev/creating-drivers.mdnow tells future driver authors to use public callback names.Self-Review Checklist
poetry run ./scripts/build.py lint-and-testpasses locally (lint + 95% test coverage).CHANGELOG.mdhas an entry under## [Unreleased]referencing this issue/PR ((#NNN)).mkdocs build --strictpasses if docs were touched).AI-Assisted Contributions
Written with Claude Code; reviewed with the
hier-config-reviewskill (no findings) and a four-angle cleanup pass (reuse/simplification/efficiency/altitude).