feat(purge): "!field" entries in onlyWhenFieldsChange ignore a field #21

Merged
KofTwentyTwo merged 1 commits from feature/tag-rule-ignored-fields into develop 2026-10-14 16:32:41 +00:00
KofTwentyTwo commented 2026-10-14 16:30:26 +00:00 (Migrated from github.com)

Lets a tag rule ignore changes to fields that never affect the rendered page, with no schema change.

Why: kof22's nightly job updates cms_blog_post.view_count (Website-Backend#206). The blog post rule has no onlyWhenFieldsChange, so a view-count-only update would purge the post's paths every night. onlyWhenFieldsChange was only an allow-list, and listing every rendered field would break as fields are added.

What: in onlyWhenFieldsChange, an entry starting with ! is an ignored field.

  • Only ignored entries (!viewCount): an update whose changed fields are all ignored purges nothing; any other change purges as before.
  • Only plain entries: unchanged (allow-list).
  • Mixed: the allow-list applies, and ignored fields never count.
  • Inserts and deletes always purge, as before. The update record is still laid over the old record, so a partial update compares correctly.
  • The field's help text, README (tag rules) and CHANGELOG are updated.

Tests: mvnw -o -B verify green (93 tests, checkstyle, guardrails, coverage). There are TagRuleEngineTest cases for each mode, plus an end-to-end PurgePipelineTest where a view-count-only update records no purge request and a title change does.

Important for kof22: the !viewCount seed must ship together with the qbit-cdn bump that contains this. Older versions read !viewCount as an allow-list entry, so post edits would stop purging.

🤖 Generated with Claude Code

Lets a tag rule ignore changes to fields that never affect the rendered page, with no schema change. **Why:** kof22's nightly job updates `cms_blog_post.view_count` (Website-Backend#206). The blog post rule has no `onlyWhenFieldsChange`, so a view-count-only update would purge the post's paths every night. `onlyWhenFieldsChange` was only an allow-list, and listing every rendered field would break as fields are added. **What:** in `onlyWhenFieldsChange`, an entry starting with `!` is an ignored field. - Only ignored entries (`!viewCount`): an update whose changed fields are all ignored purges nothing; any other change purges as before. - Only plain entries: unchanged (allow-list). - Mixed: the allow-list applies, and ignored fields never count. - Inserts and deletes always purge, as before. The update record is still laid over the old record, so a partial update compares correctly. - The field's help text, README (tag rules) and CHANGELOG are updated. **Tests:** `mvnw -o -B verify` green (93 tests, checkstyle, guardrails, coverage). There are `TagRuleEngineTest` cases for each mode, plus an end-to-end `PurgePipelineTest` where a view-count-only update records no purge request and a title change does. **Important for kof22:** the `!viewCount` seed must ship together with the qbit-cdn bump that contains this. Older versions read `!viewCount` as an allow-list entry, so post edits would stop purging. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.