Skip to content

refactor(utilities): move escapeRegExp out of the event-quality module - #959

Merged
sydevs-bot merged 2 commits into
mainfrom
claude/refactor-958-escape-regexp-utility
Oct 23, 2026
Merged

sydevs-bot merged 2 commits into
mainfrom
claude/refactor-958-escape-regexp-utility

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • escapeRegExp moves to src/lib/utilities/, so nothing imports an event-quality module for a string escape.
  • No behaviour change: the body is moved byte for byte, and no re-export is left behind.

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.md names for purposeful cross-boundary helpers.

 src/lib/
 ├── eventQuality/
-│   ├── heuristics.ts      # the quality judgements, and escapeRegExp()
+│   ├── heuristics.ts      # the quality judgements; imports escapeRegExp
 │   └── autoTitle.ts       # still reads normalizeForComparison from ./heuristics
 └── utilities/
+    └── escapeRegExp.ts    # the escape, and nothing else

Four call sites follow it, each as the deep path — utilities/ carries no barrel by design.

 src/lib/eventQuality/heuristics.ts        WEEKDAY_RE, containsPhrase
 src/lib/eventQuality/autoTitle.ts         matchesTemplateShape
 tests/int/manager-invite.int.spec.ts      the sign-in link regex
 tests/int/manager-magic-link.int.spec.ts  the sign-in link regex
-  from '@/lib/eventQuality/heuristics'  (or './heuristics')
+  from '@/lib/utilities/escapeRegExp'

heuristics.ts no 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.

  • Events list — the quality column, computed through the moved helper

Data: not seeded. previewUrl.seed is unset for this repo and a preview carries no content, so that link opens on an empty list.

Test results

  • Lean gate: ✓ pnpm lint, pnpm typecheck, pnpm typecheck:tests, pnpm test:unit (182 files, 2375 cases)
  • Targeted specs: lib-boundary + event-quality-checks 37 passed; manager-invite.int + manager-magic-link.int 46 passed
  • Build: N/A — Railway builds the preview

Notes for reviewer

  • The ticket's call-site table lists src/collections/MeditationTranscripts/glossary.ts, which is not on main — 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: that glossary.ts reads escapeRegExp from @/lib/eventQuality/heuristics, which this branch removes. CI on the second PR fails typecheck and names it.
  • The ticket's ⚠ clears lib-boundary.spec.ts by counting three src/ consumers, including that glossary. Without it the count is two, and both sit inside src/lib/, which the spec exempts from the one-consumer check outright. It passes either way, confirmed by running the spec rather than counting imports.
  • No duplicate escape survives anywhere: a repo-wide grep finds one implementation. RegExp.escape is not an option to drop it for — it is undefined on this repo's Node 22 floor, and tsconfig.json's lib is ES2022.
  • src/AGENTS.md's utilities/ 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.
  • Adversarial pass: /code-review high plus /simplify's four lenses, run inline over the whole nine-line diff rather than fanned out to four agents. No findings, nothing dismissed.
  • /security-review skipped: no changed path matches securityReview.triggerPattern.

Closes #958

🤖 Generated with Claude Code

https://claude.ai/code/session_018dRgyV3VRtUMWRcsV6nyFe

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-959 October 15, 2026 21:48 Destroyed
@railway-app

railway-app Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-959 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Oct 23, 2026 at 11:08 pm UTC
1 service not affected by this PR
  • mailpit

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 15, 2026
@sydevs-bot

sydevs-bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 22:01Z review-pr · attempt 1 · session · done
  • 22:01Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 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 seeds on the head: one definition, every import the deep path. All four acceptance criteria met.
  • lib-boundary.spec.ts read rather than counted. Both consumers sit under src/lib/, which the spec skips before its one-consumer gate, so it passes whether or not #957 lands.
  • RegExp.escape is undefined on Node 22.22, and .node-version pins 22.17.0. No built-in to prefer, and no escape library in package.json.
  • The #957 collision is real and contained. ci.yml runs on merge_group, so whichever PR queues second typechecks against the updated base and fails in the queue, not on main.
  • 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

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 15, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 15, 2026 22:10
@sydevs-bot
sydevs-bot requested a review from Ardnived October 15, 2026 22:10
@sydevs-bot
sydevs-bot enabled auto-merge October 15, 2026 22:10
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 15, 2026
@sydevs-bot sydevs-bot moved this from Revising to Approved in SYDevelopers Technical Roadmap Oct 15, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 15, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 16, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 17, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 17, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 18, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 18, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 18, 2026
claude and others added 2 commits October 23, 2026 16:01
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]>

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-959 — 750aa76a Deployed Oct 23, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

refactor(utilities): move escapeRegExp out of the event-quality module

3 participants