Repository navigation
refactor(utilities): move escapeRegExp out of the event-quality module - #959
Conversation
|
🚅 Deployed to the SahajCloud-pr-959 environment in sahajcloud
1 service not affected by this PR
|
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Nine lines, one definition, four deep imports, no behaviour change. The diff is the size of its ticket.
A four-line file invites the question whether it earns one. src/lib/utilities/ is the home src/AGENTS.md names for cross-boundary helpers, carries no barrel, and already holds 18 files of this shape (gender 10 lines, isRecord 12). Four consumers across event quality and two managers specs put this on the generic-helper side, not the fold-into-its-caller side. No contract surface is touched.
One point is routed to its own ticket rather than flagged here. heuristics.ts:131 still exports lexicalPlainText, a generic Lexical flattener that src/collections/UserSubmissions/lifecycle/proposedChanges.ts:7 reaches through the event-quality barrel. That is #958's own argument one file over, and Payload ships convertLexicalToPlaintext for it (seoDocument.ts:64, registrationDetails.ts:174). Folding it in would change behaviour, and this PR's value is that it changes none.
Findings: none. No inline threads.
What was checked
git grep escapeRegExp src tests scripts seedson the head: one definition, every import the deep path. All four acceptance criteria met.lib-boundary.spec.tsread rather than counted. Both consumers sit undersrc/lib/, which the spec skips before its one-consumer gate, so it passes whether or not #957 lands.RegExp.escapeisundefinedon Node 22.22, and.node-versionpins 22.17.0. No built-in to prefer, and no escape library inpackage.json.- The #957 collision is real and contained.
ci.ymlruns onmerge_group, so whichever PR queues second typechecks against the updated base and fails in the queue, not onmain. - Preview answers 200. The empty list is expected, and the body says why.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
A four-line generic string escape lived in `src/lib/eventQuality/heuristics.ts`, a module about judging an event listing's quality. Its consumers had already outgrown that scope: two `managers` integration specs read the helper for a magic-link token regex, which meant importing an event-quality module for a string escape. `src/lib/utilities/` is the folder `src/AGENTS.md` names for purposeful cross-boundary helpers, and it carries no barrel by design, so the import is the deep path. The function body is moved verbatim — asserted by the move itself, which refused to run unless the new file matched the removed block byte for byte. No re-export is left behind: a second spelling of the import path is what makes the next move ambiguous. Claude-Session: https://claude.ai/code/session_018dRgyV3VRtUMWRcsV6nyFe Co-authored-by: Claude <[email protected]>
#957 added a glossary.ts importer of the old heuristics export after this branch was cut, so the merge queue failed typecheck on every attempt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
escapeRegExpmoves tosrc/lib/utilities/, so nothing imports an event-quality module for a string escape.Change outline
Files
A four-line generic string helper leaves the module about judging an event listing's quality, and takes the folder
src/AGENTS.mdnames for purposeful cross-boundary helpers.Four call sites follow it, each as the deep path —
utilities/carries no barrel by design.heuristics.tsno longer exports the helper. Its barrel never re-exported it, so no downstream import loses a symbol.Preview
Nothing a reviewer can see changes — the escape returns the same string, so the listing-quality column and the auto-title judgement render exactly as before. This is the page serving the code the move touches.
Data: not seeded.
previewUrl.seedis unset for this repo and a preview carries no content, so that link opens on an empty list.Test results
pnpm lint,pnpm typecheck,pnpm typecheck:tests,pnpm test:unit(182 files, 2375 cases)lib-boundary+event-quality-checks37 passed;manager-invite.int+manager-magic-link.int46 passedNotes for reviewer
src/collections/MeditationTranscripts/glossary.ts, which is not onmain— it arrives with feat(meditations): a transcript collection, word list and normaliser #957, still open. So this branch re-points four call sites, not six. Whichever of the two merges second owes a one-line import change: thatglossary.tsreadsescapeRegExpfrom@/lib/eventQuality/heuristics, which this branch removes. CI on the second PR fails typecheck and names it.lib-boundary.spec.tsby counting threesrc/consumers, including that glossary. Without it the count is two, and both sit insidesrc/lib/, which the spec exempts from the one-consumer check outright. It passes either way, confirmed by running the spec rather than counting imports.RegExp.escapeis not an option to drop it for — it isundefinedon this repo's Node 22 floor, andtsconfig.json'slibis ES2022.src/AGENTS.md'sutilities/list is left alone. It names 11 of the folder's 19 files, so it is illustrative rather than a census, and one more entry would not make it exhaustive./code-review highplus/simplify's four lenses, run inline over the whole nine-line diff rather than fanned out to four agents. No findings, nothing dismissed./security-reviewskipped: no changed path matchessecurityReview.triggerPattern.Closes #958
🤖 Generated with Claude Code
https://claude.ai/code/session_018dRgyV3VRtUMWRcsV6nyFe