refactor(protected-options): consolidate protected-name rules, release 1.0.3#130
Merged
refactor(protected-options): consolidate protected-name rules, release 1.0.3#130
Conversation
…e 1.0.3 The rules for "which option names Optrion refuses to touch" were spread across Cleaner, Quarantine, Importer, and the REST list endpoint, each spelling them slightly differently. Collapse them into a single `ProtectedOptions` helper that owns: - name normalization (matching the `wp_options.option_name` collation semantics: case-insensitive, trailing whitespace tolerant) - the per-category checks (core / Optrion internal / quarantine rename) - a human-readable `protected_reason()` for operator-facing messages - SQL `NOT LIKE` fragments for the list endpoint Every destructive module now routes through it, so the UI's hide-from- list behavior and the guards behind the destructive endpoints stay in lockstep. Adds tests covering each module's refusal of every protected category, in both canonical and non-canonical spellings. Also fixes the bottom bulk-action bar sitting flush against the table by giving `.optrion-bulk` a symmetric top margin to match the spacing of its top-of-page sibling. Closes #129
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
ProtectedOptionshelper owns the single source of truth for which option names Optrion refuses to touch: WordPress core options, Optrion's ownoptrion_*namespace, and the quarantine rename namespace.Cleaner,Quarantine,Importer, and the options-list REST filter all derive their behavior from the helper now. No more per-module spellings drifting apart.wp_options.option_namecollation semantics (case-insensitive, trailing whitespace tolerant) so a non-canonical spelling cannot slip past one module while still matching the row on the SQL side.Test plan
composer lint(via wp-env)npm run test(95 tests, 282 assertions)1.0.3after merge → release workflow publishes zip + latest aliasCloses #129