Skip to content

Make built-in post-load callbacks public (#286) - #293

Merged
jtdub merged 2 commits into
nextfrom
issue-286-public-post-load-callbacks
Aug 5, 2026
Merged

Make built-in post-load callbacks public (#286)#293
jtdub merged 2 commits into
nextfrom
issue-286-public-post-load-callbacks

Conversation

@jtdub

@jtdub jtdub commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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:

Module Public names
platforms/cisco_ios/driver.py remove_ipv4_acl_remarks, remove_ipv6_acl_sequence_numbers (was _rm_...), add_acl_sequence_numbers
platforms/aruba_aoscx/driver.py split_interface_vlan_trunk_allowed
platforms/cisco_xr/driver.py fixup_xr_comments
platforms/hp_procurve/driver.py fixup_hp_procurve_aaa_port_access (stutter fixed, was _fixup_..._fixup), fixup_hp_procurve_device_profile, fixup_hp_procurve_vlan

The docs recipe now removes by identity — rules.post_load_callbacks.remove(remove_ipv4_acl_remarks) — instead of slice-filtering against a private import.

Notes:

  • Deliberately minimal per the issue: no remove_post_load_callback() helper, no __all__, no top-level re-exports (import from hier_config.platforms.<x>.driver, matching the existing split_vlan_id_lists precedent).
  • Pure renames — behavior, signatures, and registration order unchanged. No deprecated aliases: the old names were private and v4 is unreleased.
  • New tests: per-platform identity pins for all 8 callbacks (their imports double as rename regression guards) plus a recipe regression test proving removal keeps ACL remarks while the remaining callbacks still run.
  • docs/dev/creating-drivers.md now tells future driver authors to use public callback names.

Self-Review Checklist

  • poetry run ./scripts/build.py lint-and-test passes locally (lint + 95% test coverage).
  • Tests were written first (TDD) and cover the change, following the testing conventions.
  • CHANGELOG.md has an entry under ## [Unreleased] referencing this issue/PR ((#NNN)).
  • Documentation is updated if public API or driver behavior changed (and mkdocs build --strict passes if docs were touched).
  • Commit messages follow the contributing guide: imperative mood, subject ≤72 characters, body explains why.

AI-Assisted Contributions

Written with Claude Code; reviewed with the hier-config-review skill (no findings) and a four-angle cleanup pass (reuse/simplification/efficiency/altitude).

jtdub added 2 commits August 4, 2026 19:27
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.
@jtdub
jtdub requested a review from aedwardstx as a code owner August 5, 2026 00:36
@jtdub
jtdub merged commit cb6ffe5 into next Aug 5, 2026
6 checks passed
@jtdub
jtdub deleted the issue-286-public-post-load-callbacks branch August 5, 2026 00:38
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.

1 participant