Skip to content

Remove PUT /venue/:id once all callers use PATCH - #1038

Merged
JoshuaVSherman merged 2 commits into
devfrom
agy/991-remove-put-venue-id-once-all-callers-use
Aug 28, 2026
Merged

Remove PUT /venue/:id once all callers use PATCH#1038
JoshuaVSherman merged 2 commits into
devfrom
agy/991-remove-put-venue-id-once-all-callers-use

Conversation

@JoshuaVSherman

Copy link
Copy Markdown
Contributor

Summary

  • Remove the legacy PUT /venue/:id route from src/model/venue/venue-router.ts, retaining PATCH /venue/:id as the honest partial-merge update verb (web-jam-back#991 "Remove PUT /venue/:id once all callers use PATCH").
  • Update test/unit/venue/venue-router.spec.ts to assert that PUT /venue/:id returns 404 (route not found), while PATCH /venue/:id continues to handle partial updates and address validations.
  • Expand test/unit/venue/venue-router.spec.ts to test all router endpoints (GET /venue, POST /venue, GET /venue/cities, GET /venue/:id, PATCH /venue/:id, DELETE /venue/:id, POST /venue/:id/touch), achieving 100% test coverage on venue-router.ts.
  • Clean up outdated comments referencing PUT for venue updates in src/model/venue/venue-controller.ts, src/model/venue/venue-schema.ts, test/unit/venue/normalize-address.spec.ts, test/unit/venue/venue-controller.spec.ts, and AGENTS.md.
  • Verified across web-jam-back, JaMmusic, and web-jam-tools that no active callers use PUT /venue/:id.
  • Bump patch version in package.json to 2.11.10.

Closes #991

How to test locally

1. Automated Verification

Run the complete test suite and verify linting, typechecking, duplicate detection, and coverage:

npm run test:lint && npm run typecheck && npm run jscpd && npm test

2. Behavioral API Route Verification

Start the backend server (npm start or npm run dev) and exercise the route changes with an authenticated admin/agent token:

  1. Verify PUT /venue/:id returns 404:

    curl -X PUT http://localhost:8888/venue/65e9b8f2c3d1e2f3a4b5c6d7 \
      -H "Authorization: Bearer $TEST_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"phone": "540-555-0199"}'

    Expected Result: HTTP 404 Not Found (route was removed).

  2. Verify PATCH /venue/:id updates fields successfully:

    curl -X PATCH http://localhost:8888/venue/65e9b8f2c3d1e2f3a4b5c6d7 \
      -H "Authorization: Bearer $TEST_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"phone": "540-555-0199"}'

    Expected Result: HTTP 200 OK with updated venue object.

  3. Verify PATCH /venue/:id enforces address immutability:

    curl -X PATCH http://localhost:8888/venue/65e9b8f2c3d1e2f3a4b5c6d7 \
      -H "Authorization: Bearer $TEST_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{"address": ""}'

    Expected Result: HTTP 400 Bad Request (address cannot be removed; supply a corrected address instead).

Test evidence

> web-jam-back@2.11.10 test
> eslint ./src && npm run jscpd && npm run typecheck && rimraf coverage && npm run test:unit

> web-jam-back@2.11.10 jscpd
> jscpd src

100.00% duplicates detected. 0 duplicates found in 47 files.
Scanning... 0/47
Scanning... 47/47
------------------------------------------------
Complexity threshold: 100
Format: ts
------------------------------------------------
Files: 47
Lines: 4945
Clones: 0
Duplicated lines: 0 (0.00%)
Tokens: 29548
Duplicated tokens: 0 (0.00%)
Time: 96.936ms
------------------------------------------------

> web-jam-back@2.11.10 typecheck
> tsc --noEmit -p tsconfig.prod.json && tsc --noEmit

 RUN  v4.1.5 /tmp/agy-worktrees/web-jam-back-agy-991-remove-put-venue-id-once-all-callers-use
 Coverage enabled with v8

 ✓ test/unit/lib/caption-text.spec.ts (13 tests) 31ms
 ✓ test/unit/lib/meta-publish.spec.ts (9 tests) 30ms
 ✓ test/unit/lib/cors.spec.ts (8 tests) 41ms
 ✓ test/unit/auth/capabilities.spec.ts (11 tests) 42ms
 ✓ test/unit/lib/email.spec.ts (6 tests) 41ms
 ✓ test/unit/auth/roleGrants.spec.ts (8 tests) 42ms
 ✓ test/unit/venue/normalize-address.spec.ts (21 tests) 50ms
 ✓ test/unit/lib/migration-cli.spec.ts (7 tests) 57ms
 ✓ test/unit/lib/calendar.spec.ts (2 tests) 57ms
 ✓ test/unit/outreach/cadence.spec.ts (13 tests) 56ms
 ✓ test/unit/lib/artist.spec.ts (9 tests) 66ms
 ✓ test/unit/lib/routeUtils.spec.ts (6 tests) 66ms
 ✓ test/unit/venue/venue-router.spec.ts (8 tests) 203ms
 ✓ test/unit/venue/venue-controller.spec.ts (66 tests) 1157ms

 Test Files  55 passed (55)
      Tests  572 passed (572)
   Start at  03:36:58
   Duration  23.86s

 % Coverage report from v8
-------------------|---------|----------|---------|---------|-------------------
File               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
-------------------|---------|----------|---------|---------|-------------------
All files          |   94.94 |    89.28 |   90.64 |   95.73 |                   
 src/model/venue   |   95.45 |    92.45 |     100 |   96.96 |                   
  ...ze-address.ts |     100 |      100 |     100 |     100 |                   
  ...controller.ts |   94.83 |     92.2 |     100 |   96.48 | ...38,646,696,736 
  venue-facade.ts  |       0 |        0 |       0 |       0 |                   
  venue-router.ts  |     100 |      100 |     100 |     100 |                   
  venue-schema.ts  |     100 |      100 |     100 |     100 |                   
-------------------|---------|----------|---------|---------|-------------------

🤖 Work by Antigravity — Gemini Flash (Medium)

@JoshuaVSherman
JoshuaVSherman force-pushed the agy/991-remove-put-venue-id-once-all-callers-use branch from f9bc3ee to 91d5d10 Compare August 28, 2026 09:44

@JoshuaVSherman JoshuaVSherman 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.

PR Review Summary

✅ Approved

Must Fix Items

✅ None

Checklist Verification

  • Mergeability: ✅ No conflicts with dev.
  • Semver Bump: 🟡 package.json version (2.11.10) does not strictly exceed origin/dev's current tip (2.11.10) (see Suggestions).
  • Snyk: ✅ Clean.
  • Scope: ✅ Matches linked issue #991.
  • Package-Lock Engine Alignment: ✅ N/A (no engine changes).
  • Test Plan: ✅ Concrete behavioral curl and unit test verification steps provided.
  • Architectural Judgment: ✅ Clean removal of legacy PUT route; router test suite expanded to 100% coverage.
  • Guardrails: ✅ Clean.

🟡 Suggestions

  • 🟡 Version bump — package.json's version (2.11.10) does not strictly exceed origin/dev's current tip (2.11.10) due to recent dev merges; rebase onto dev and bump to 2.11.11 before merge (Step 2 item 5).

@JoshuaVSherman

Copy link
Copy Markdown
Contributor Author

PR Review Summary

🛑 Changes Requested

🛑 Must Fix Items

  • 🛑 CircleCI "build" is failing — run all tests failed in test/unit/artist-scoping.spec.ts (scoped admin bio update is stamped and scoped to their artist returned HTTP 401 instead of 200).

…and bump version to 2.11.11 (web-jam-back#991)
@JoshuaVSherman
JoshuaVSherman marked this pull request as ready for review August 28, 2026 09:52
@JoshuaVSherman
JoshuaVSherman merged commit d39f37c into dev Aug 28, 2026
2 checks passed
@JoshuaVSherman
JoshuaVSherman deleted the agy/991-remove-put-venue-id-once-all-callers-use branch August 28, 2026 09:56
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.

Remove PUT /venue/:id once all callers use PATCH

1 participant