Re-accept hyphen-delimited hook sections with deprecation warning#89
Merged
Conversation
5.3.1 anchored hook section matching strictly on ":", which broke downstream hooks (notably mxmake) that emit [namespace-section] sections. Re-accept the historical "-" delimiter for backward compatibility, log a one-time deprecation warning per offending section, and normalize hook namespaces that bake a trailing "-" into the namespace string itself (e.g. namespace = "mxmake-"). Recognized hook section forms (in order of preference): [namespace] exact match [namespace:subsection] colon delimiter, canonical [namespace-subsection] hyphen delimiter, deprecated, logs warning The original bug stays fixed: a package whose name merely starts with the namespace without a delimiter (e.g. uvst.addon for namespace "uv") is still a package, not a hook section.
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
5.3.1 anchored hook section matching strictly on
:, which broke downstream hooks (notablymxmake) that emit[namespace-section]sections — those sections were reclassified as packages and trippedValueError("Section X has no URL set!")on the firstmxdevrun after upgrade.This PR re-accepts the historical
-delimiter for backward compatibility, logs a one-time deprecation warning per offending section, and normalizes hook namespaces that bake a trailing-into the namespace string (e.g.namespace = "mxmake-").Recognized hook section forms:
[namespace][namespace:subsection][namespace-subsection]The original #88 bug stays fixed: a package whose name merely starts with the namespace without a delimiter (e.g.
uvst.addonfor namespace"uv") is still a package, not a hook section.Why
mxmakedeclaresnamespace = "mxmake-"and emits[mxmake-env],[mxmake-<template>]sections in every generatedmx.ini. Under 5.3.1 these are misclassified as packages → hard-fail. Rather than force every downstream user to regenerate theirmx.iniin lockstep with 5.3.1, accept the old form with a deprecation pointing users at the new syntax.A separate issue will be filed against
mxstack/mxmaketo plan the migration to colon syntax.Test plan
test_hook_section_with_hyphen_delimiter_is_supported_but_deprecated—[mxmake-env]is a hook section AND a deprecation warning is loggedtest_legacy_namespace_with_trailing_hyphen_is_normalized—namespace = "mxmake-"works for both[mxmake-env]and[mxmake:files]test_hyphen_prefix_without_delimiter_is_still_a_package—uvst.addonregression from Fix hook namespace swallowing packages with a matching name prefix #88 still holdstest_hook_section_with_namespace_delimiter_belongs_to_hook— colon form still workstox -e lintpasses