Skip to content

refactor(protected-options): consolidate protected-name rules, release 1.0.3#130

Merged
mt8 merged 1 commit intomainfrom
fix/129-protected-options-helper
Apr 19, 2026
Merged

refactor(protected-options): consolidate protected-name rules, release 1.0.3#130
mt8 merged 1 commit intomainfrom
fix/129-protected-options-helper

Conversation

@mt8
Copy link
Copy Markdown
Owner

@mt8 mt8 commented Apr 19, 2026

Summary

  • New ProtectedOptions helper owns the single source of truth for which option names Optrion refuses to touch: WordPress core options, Optrion's own optrion_* 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.
  • Matching follows the wp_options.option_name collation 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.
  • Also fixes the bottom bulk-action bar sitting flush against the table — it now has the same top margin as the top bar.
  • Version bumped to 1.0.3.

Test plan

  • composer lint (via wp-env)
  • npm run test (95 tests, 282 assertions)
  • CI matrix on this PR
  • Tag 1.0.3 after merge → release workflow publishes zip + latest alias

Closes #129

…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
@mt8 mt8 merged commit abdebf0 into main Apr 19, 2026
8 checks passed
@mt8 mt8 deleted the fix/129-protected-options-helper branch April 19, 2026 22:17
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.

Refactor: centralize protected option-name rules in one helper

1 participant