Skip to content

Enforce default ±2 month gig-spacing in getCandidates and add date fallback parsing - #1037

Open
JoshuaVSherman wants to merge 1 commit into
devfrom
agy/1036-enforce-default-2-month-gig-spacing-in-g
Open

Enforce default ±2 month gig-spacing in getCandidates and add date fallback parsing#1037
JoshuaVSherman wants to merge 1 commit into
devfrom
agy/1036-enforce-default-2-month-gig-spacing-in-g

Conversation

@JoshuaVSherman

Copy link
Copy Markdown
Contributor

Summary

  • Enforces DEFAULT_GIG_SPACING_MONTHS = 2 in OutreachController.excludeUpcomingGigVenues and OutreachController.buildCandidateReason when a venue's gigInterval is 0 or unset (null/undefined), preventing candidates with nearby booked gigs from being pitched by default.
  • Respects explicit custom gigInterval values > 0 (e.g. 3, 6) when configured on a venue document.
  • Updates buildCandidateReason to evaluate spacing against gigIntervalMonths (defaulting to 2) and formats spacingNote as 'no gigs yet' when no gigs exist, or 'clear — nearest gig ~X mo away' when gigs are spaced adequately.
  • Adds parseTargetDates helper and updates parseTargetWeekend to parse ISO start and end dates from targetDates strings (e.g. 2026-10-16 to 2026-10-18, 2026-10-16 - 2026-10-18, 2026-10-16) when targetWeekend object is not provided in req.query.
  • Updates unit tests in test/unit/outreach/outreach-controller.spec.ts to assert the default 2-month spacing behavior and test targetDates fallback parsing.
  • Bumps package version to 2.11.10.

Closes #1036

How to test locally

  1. Unit test verification:
    • Run npx vitest run test/unit/outreach/outreach-controller.spec.ts to verify all candidate spacing and targetDates fallback tests pass.
  2. Behavioral verification of default 2-month spacing:
    • Create a test venue with gigInterval: 0 (or unset) and a gig 1 month away from target window w. Verify GET /outreach/candidates excludes the venue.
    • Create a test venue with gigInterval: 0 (or unset) and a gig 3 months away from w. Verify GET /outreach/candidates includes the venue with reason.gigIntervalMonths: 2 and reason.spacingNote: 'clear — nearest gig ~3 mo away'.
    • Create a test venue with explicit gigInterval: 3 and a gig 2.5 months away from w. Verify GET /outreach/candidates excludes the venue.
  3. Behavioral verification of targetDates string fallback:
    • Send GET /outreach/candidates?targetDates=2026-10-16 to 2026-10-18.
    • Verify w resolves to 2026-10-16 and candidate filtering properly excludes venues with gigs in September 2026.
  4. Run full test suite and linters:
    • npm run test:lint
    • npm run typecheck
    • npm run jscpd
    • npm test

Test evidence

> npm run test:lint
> eslint ./src --fix

> npm run typecheck
> tsc --noEmit -p tsconfig.prod.json && tsc --noEmit

> npm run jscpd
Found 39 clones.
time: 15.241ms

> npm test
 ✓ test/unit/outreach/outreach-controller.spec.ts (225 tests) 828ms
 Test Files  55 passed (55)
      Tests  1076 passed (1076)
   Duration  40.48s
Coverage: Statements: 94.19%, Branches: 87.23%, Functions: 84.53%, Lines: 94.51%

🤖 Work by Antigravity — Gemini Flash (Medium)

…allback parsing (web-jam-back#1036 "Enforce default ±2 month gig-spacing in getCandidates and add date fallback parsing")
@JoshuaVSherman
JoshuaVSherman marked this pull request as ready for review August 19, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce default ±2 month gig-spacing in getCandidates and add date fallback parsing

1 participant