Skip to content

fix(2.4.7): community patterns normalize to scope=global on export and import#225

Merged
ttlequals0 merged 3 commits into
mainfrom
fix/community-scope-normalize
May 15, 2026
Merged

fix(2.4.7): community patterns normalize to scope=global on export and import#225
ttlequals0 merged 3 commits into
mainfrom
fix/community-scope-normalize

Conversation

@ttlequals0
Copy link
Copy Markdown
Owner

Summary

Pre-2.4.7 community patterns were imported with the source instance's scope (almost always 'podcast') but podcast_id was stripped on export. Result: scope=podcast rows with podcast_id=NULL that the matcher will never match. User caught it as soon as 2.4.6 imports landed and the Patterns page showed all 12 imports as Podcast scope with no podcast attached.

Per-podcast filtering for community rows happens via tag eligibility in text_pattern_matcher._filter_patterns_by_scope (sponsor_tags vs podcast_tags), not via the legacy scope column. Community rows should just be scope='global'.

Changes

  • community_export._strip_metadata forces scope='global' in the bundle regardless of source scope.
  • pattern_service.import_community_pattern forces scope='global' and None for podcast_id / network_id / dai_platform on every create. Defensive: a hand-crafted bundle that includes those fields gets them dropped at the boundary.
  • _normalize_community_scope migration in schema.py re-stamps every source='community' row to scope='global' and clears stale podcast_id / network_id. Stamped via community_scope_revision setting, idempotent.
  • 11 of 12 committed seed bundles rewritten from scope: podcast to scope: global; manifest regenerated.
  • Version 2.4.6 -> 2.4.7. CHANGELOG entry.

Version

2.4.7

Test plan

  • Unit tests pass (1087 total, +3 new)
  • tsc --noEmit clean
  • Docker GPU + CPU build + Trivy HIGH+CRITICAL+MEDIUM
  • Push versioned tags (no :latest / :cpu floating)
  • Portainer webhook deploy
  • Verify /api/v1/health reports 2.4.7
  • Post-deploy spot check: existing community rows show scope=global and podcast_id=null

…d import

Pre-2.4.7 the community export pipeline copied the source instance's
scope (almost always 'podcast') into the bundle, and the import pipeline
used it verbatim. podcast_id was already stripped on export, so the
imported row landed as scope='podcast' with podcast_id=NULL -- which the
matcher will never match against any podcast. Per-podcast filtering for
community patterns happens via tag eligibility in
text_pattern_matcher._filter_patterns_by_scope, not via the legacy scope
column; scope on community rows should just be 'global'.

Fixes:
- community_export._strip_metadata forces scope='global' in the bundle
  regardless of source scope.
- pattern_service.import_community_pattern forces scope='global' and
  None for podcast_id/network_id/dai_platform on every create.
- _normalize_community_scope migration in schema.py UPDATEs every
  source='community' row whose scope is not 'global' OR whose podcast/
  network ids are non-null. Stamped via community_scope_revision setting,
  idempotent.
- 11 of 12 committed seed bundles rewritten from scope:podcast to
  scope:global; manifest regenerated.

Tests: +2 in test_community_export covering scope=podcast and
scope=network source patterns (with non-null ids on the source to prove
they get stripped). +1 in test_pattern_service_rewrite covering import
of a legacy bundle that carries scope=podcast + podcast_id + network_id;
asserts they all get cleared on insert. 1087 unit tests pass.
@github-actions
Copy link
Copy Markdown

Community pattern validation

Passed (11)

  • patterns/community/capital-one-44026a0f.json (sponsor: Capital One)
  • patterns/community/carvana-a934bf9a.json (sponsor: Carvana)
  • patterns/community/carvana-f41cf617.json (sponsor: Carvana)
  • patterns/community/instacart-b77d02bc.json (sponsor: Instacart)
  • patterns/community/kayak-3f2f65ff.json (sponsor: Kayak)
  • patterns/community/mint-mobile-17b2b4b8.json (sponsor: Mint Mobile)
  • patterns/community/monday-com-9e83a5f6.json (sponsor: Monday.com)
  • patterns/community/progressive-1c07273d.json (sponsor: Progressive)
  • patterns/community/simplisafe-c114bd7f.json (sponsor: SimpliSafe)
  • patterns/community/squarespace-b052ed12.json (sponsor: Squarespace)
  • patterns/community/zyn-3c348177.json (sponsor: Zyn)

Validation passed. Ready for review.

See patterns/CONTRIBUTING.md for the full submission guide.

The workflow pins actions/labeler@v5 but the config still used v4 syntax
('label: [glob]'). v5 rejects that with 'found unexpected type for
label X (should be array of config options)'. The labeler job has been
failing silently on every PR since 2.4.0; the 'pattern' label never
got auto-applied to any of the community-pattern PRs.

Switch to v5 syntax. Same intent: PRs touching patterns/community/**/*.json
get the 'pattern' label.
@github-actions
Copy link
Copy Markdown

Community pattern validation

Passed (11)

  • patterns/community/capital-one-44026a0f.json (sponsor: Capital One)
  • patterns/community/carvana-a934bf9a.json (sponsor: Carvana)
  • patterns/community/carvana-f41cf617.json (sponsor: Carvana)
  • patterns/community/instacart-b77d02bc.json (sponsor: Instacart)
  • patterns/community/kayak-3f2f65ff.json (sponsor: Kayak)
  • patterns/community/mint-mobile-17b2b4b8.json (sponsor: Mint Mobile)
  • patterns/community/monday-com-9e83a5f6.json (sponsor: Monday.com)
  • patterns/community/progressive-1c07273d.json (sponsor: Progressive)
  • patterns/community/simplisafe-c114bd7f.json (sponsor: SimpliSafe)
  • patterns/community/squarespace-b052ed12.json (sponsor: Squarespace)
  • patterns/community/zyn-3c348177.json (sponsor: Zyn)

Validation passed. Ready for review.

See patterns/CONTRIBUTING.md for the full submission guide.

The reason field is the detector's own rationale string -- usually
something like 'Brilliant (pattern #309)', but on boundary-extension
hits the reviewer's free-text observation lands there instead (e.g.,
'Quo (business phone system)' on a Zyn-pattern match that swept up an
adjacent Quo ad). Showing it as a bare description below the sponsor
badge looks like a contradiction. Prefixing 'Match:' frames it as a
note about the detection rather than a second sponsor claim.

UI-only tweak. No data shape change.
@github-actions
Copy link
Copy Markdown

Community pattern validation

Passed (11)

  • patterns/community/capital-one-44026a0f.json (sponsor: Capital One)
  • patterns/community/carvana-a934bf9a.json (sponsor: Carvana)
  • patterns/community/carvana-f41cf617.json (sponsor: Carvana)
  • patterns/community/instacart-b77d02bc.json (sponsor: Instacart)
  • patterns/community/kayak-3f2f65ff.json (sponsor: Kayak)
  • patterns/community/mint-mobile-17b2b4b8.json (sponsor: Mint Mobile)
  • patterns/community/monday-com-9e83a5f6.json (sponsor: Monday.com)
  • patterns/community/progressive-1c07273d.json (sponsor: Progressive)
  • patterns/community/simplisafe-c114bd7f.json (sponsor: SimpliSafe)
  • patterns/community/squarespace-b052ed12.json (sponsor: Squarespace)
  • patterns/community/zyn-3c348177.json (sponsor: Zyn)

Validation passed. Ready for review.

See patterns/CONTRIBUTING.md for the full submission guide.

@ttlequals0 ttlequals0 merged commit d1131f9 into main May 15, 2026
13 of 14 checks passed
@ttlequals0 ttlequals0 deleted the fix/community-scope-normalize branch May 15, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant