fix(events-crawler): stricter relevance for NVCL and Capilano - #100
Conversation
Savar's 2026-08-09 review flagged that NVCL's and Capilano's generic
tech-help content (Drop-in technology help, Windows/Mac laptop help,
MS Office: Intro to Word/Excel) is too broad — it teaches skills the
audience already has, unlike immigration/settlement content. Confirmed
with him directly, including dropping the MS Office / spreadsheet suite.
Rather than revert last week's loosening globally (the technology-help
term is genuine, wanted content at Surrey, which no one flagged), add a
per-source STRICT filter: relevance.ts splits into CORE_TERMS and
DIGITAL_LITERACY_TERMS, and isSettlementRelevant(title, { strict }) uses
CORE only. Sources opt in via Source.strictRelevance, set on nvcl +
capilano. The default union is byte-equivalent to before, so the other
sources are unaffected.
Verified with dryrun --no-filter --titles over every filtered source's
whole window (cap raised locally): NVCL drops 6 distinct digital titles
(13 rows) and keeps its 5 genuine ones (English Corner x3, newcomer
circletime, Open door community hub); Capilano unchanged; the other five
filtered sources have zero flips.
Also folds in the latent left-word-boundary fixes from BACKLOG (a global
regex hardening, opposite failure direction): a leading \b on lease,
rental, tenant, resume — plus renting (swallowed by "parenting"), which
the original sweep missed. Zero live incidence, so zero flips on any
source; locked in relevance_test.ts as DROP fixtures paired with
real-word keeps. Re-verified the alternative set: only these 5 \b changes
moved, nothing dropped in the split.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe crawler now supports per-source strict relevance filtering. NVCL and Capilano use settlement-only matching. Relevance terms include word boundaries, and tests cover accent folding, substring false positives, and strict-mode behavior. ChangesRelevance filtering
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@supabase/functions/events-crawler/lib/relevance.ts`:
- Line 76: Remove or qualify the bare literacy term in CORE_TERMS within
supabase/functions/events-crawler/lib/relevance.ts:76-76 so STRICT_RELEVANCE_RE
excludes digital-literacy titles while preserving intended qualified matches.
Add a Digital Literacy title to STRICT_FLIP in
supabase/functions/events-crawler/lib/relevance_test.ts:168-190 to verify the
strict-mode behavior.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 36af5db0-7b7f-4e84-8489-c7ea8282c8c9
📒 Files selected for processing (13)
BACKLOG.mdsupabase/functions/events-crawler/adapters/bibliocommons.tssupabase/functions/events-crawler/adapters/capilano.tssupabase/functions/events-crawler/adapters/communico.tssupabase/functions/events-crawler/adapters/livewhale.tssupabase/functions/events-crawler/adapters/nvcl.tssupabase/functions/events-crawler/adapters/surrey.tssupabase/functions/events-crawler/adapters/tribe.tssupabase/functions/events-crawler/dryrun.tssupabase/functions/events-crawler/lib/relevance.tssupabase/functions/events-crawler/lib/relevance_test.tssupabase/functions/events-crawler/lib/sources.tssupabase/functions/events-crawler/lib/types.ts
…iteracy" CodeRabbit caught a completeness gap in strict mode: bare `literacy` in CORE_TERMS (kept for Family/Adult reading literacy) also matches "Digital Literacy", so STRICT_RELEVANCE_RE would re-admit exactly the digital-literacy content strict is meant to drop. Latent — no such title in the current NVCL/Capilano windows, so the corpus diff didn't surface it — but real. Add a `(?<!digital\s)` guard to the term. The default filter still keeps "Digital Literacy" via its own `digital literacy` term, so default verdicts are unchanged (re-verified: zero flips on every non-strict source, NVCL still 13, identical to the pre-fix capture). Lock both directions in relevance_test.ts: "Digital Literacy Basics" as a STRICT_FLIP, "Adult Literacy Program" as a STRICT_KEEP. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Addressed the Fix: added a |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
Why
Savar's 2026-08-09 review of the widened relevance output flagged that NVCL's and Capilano's generic tech-help content is too broad — "Drop-in technology help", "Windows/Mac laptop help", "MS Office: Intro to Word/Excel". His reasoning: the audience already knows how to use a smartphone/laptop, so generic tech-help doesn't serve them the way immigration/settlement content does. Confirmed with him directly, including dropping the MS Office / spreadsheet suite — not an assumption.
His guidance was explicit: don't loosen uniformly across all orgs — a stricter filter for specific organizations is fine. A plain revert of last week's loosening (PR #96) can't work, because the main offender term
technology helpis shared with Surrey (21 rows across Surrey + NVCL), and no one flagged Surrey.What
A per-source strict filter:
lib/relevance.tssplits the single union intoCORE_TERMS(status/settlement, language, employment, finance, housing, named programs, health) +DIGITAL_LITERACY_TERMS.isSettlementRelevant(title, { strict })uses CORE only under strict. Alternation order doesn't affect.test(), so the default union is byte-equivalent to before.Source.strictRelevance(lib/types.ts) gates it, set onnvcl+capilano(lib/sources.ts).dryrun.tsforward the flag;dryrun --list/--titlesnow reflect strict.Also folds in the latent left-word-boundary fixes from BACKLOG (a global hardening, opposite failure direction — titles the filter wrongly keeps): a leading
\bonlease,rental,tenant,resume, plusrenting(swallowed by "parenting") which the original sweep missed. Zero live incidence today.Evidence
Captured every filtered source's whole 4-month window with
dryrun.ts --no-filter --titles(cap raised locally), before vs after:The
\bfixes produced 0 flips on any source (zero live incidence). Regex alternative-set diff: 84 before → 84 after, only the 5\bchanges moved — nothing lost in the split.Tests / checks
deno test lib/relevance_test.ts→ 4/4 pass (2 new strict tests + boundary DROP fixtures paired with real-word keeps).deno checkclean. (supabase/functionsis excluded from the Next tsc/eslint gates.)Scope / deploy
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests