Skip to content

[MBA-3824] Retire the .NET booking/capacity slice; legacy booking URLs redirect to /app for every centre - #97

Merged
devin-ai-integration[bot] merged 2 commits into
estate/legacy-baselinefrom
devin/mba-3824-retire-booking-slice-v3
Nov 11, 2026
Merged

devin-ai-integration[bot] merged 2 commits into
estate/legacy-baselinefrom
devin/mba-3824-retire-booking-slice-v3

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Summary

MBA-3824 (M5). Since M4 every booking/capacity write already goes through the gateway to scheduling-service and legacy logins are denied writes, so the .NET booking/capacity slice, the four booking procs and booking-api's write SQL were dead code. This PR deletes them. The gateway now redirects every legacy booking URL to /app for every centre, including centres never on the M3 allow-list, unresolvable ids and URLs with no centre key. routing.coexistence-mode=relay is unchanged. Design and the expected M1 transcript differences are in docs/adr/0004-retire-portal-booking-slice.md.

Diff is net-negative: 70 files, +406 / -1792.

Gateway (services/routing-gateway)

  • StranglerFilter.portal(): a PortalRoutes match now goes to retired(ex, m) instead of decide(...) ? redirect : forward. GET/HEAD get 302 and POST gets 303, with X-Route: modern and reason legacy page retired. The allow-list still applies only to API routes.
  • PortalRoutes.match(): retired pages still match when the centre key is missing. redirect() keeps candidateNumber: /Booking/MyBookings?candidateNumber=NW00000042 → /app/my-bookings?candidateNumber=NW00000042. A missing or unresolvable centre falls back to /app/.
  • MyBookings.tsx / candidate.ts (UI only, no domain logic): useCandidateNumber(initial) takes ?candidateNumber= before the first render. The old bookmark opens that candidate's bookings, and only that candidate's bookings are requested (fixes the review's A/B race).

Portal (AssessmentDelivery.*)

  • Deleted the booking controller, views, models and service layer; AdminController.Capacity GET/POST; the AdminCapacity route; AdminService.ChangeCapacity/GetSessionRow; SqlErrorHelper; SeatCounter and its tests.
  • /Eligibility and /Results used two reads from IBookingService. These moved, with the same queries, to IEligibilityService.ListExams() and IResultsService.FindCandidate(). BookingStatus constants moved to Rules/BookingStatus.cs. The "Booked" column on /Admin/Sessions is now counted in the EF query (BOOKED+ATTENDED, same rule).
  • The Bookings tab, the candidate quick-find and the per-session Capacity links point at the legacy URLs (~/Booking, ~/Booking/MyBookings, ~/Admin/Sessions/Capacity/{id}). The gateway redirects them.

booking-api / DB

  • booking-api write endpoints are routed entirely by the gateway, which already serves v1 writes from scheduling-service. BookingService, the write DAO methods and the request/response models are deleted. A write that reaches :8081 directly now gets 410 LEGACY_WRITE_RETIRED (in M4 it got 403 LEGACY_WRITE_DENIED).
  • db/procs/090_retire_booking_procs.sql drops usp_BookSeat, usp_CancelBooking, usp_ChangeCapacity and usp_RescheduleBooking (DROP ... IF EXISTS). Their create scripts 020–023 are deleted and stay in git history (tag legacy-baseline).
  • 040_single_writer.sql no longer has the DENY EXECUTE lines for those procs. test_usp_GetCapacityAudit.sql now writes its capacity rows the way the old proc did. In LegacySingleWriterIT the proc check expects error 2812 (Could not find stored procedure).
  • New CI guard: scripts/check-retired-booking-writes.sh (.github/workflows/retired-booking-writes.yml). It fails if portal C# or booking-api main code references the four procs, updates SeatsAvailable, or writes Booking/Waitlist.

Expected M1 characterization differences (transcripts not edited; full table in ADR 0004)

  • M5-PORTAL-REDIRECT (29): AC-01/03/05/07, BK-01/03/05/07(setup)/08/10, CN-01/03/05/07, CP-01..05/07/08, MX-03, RS-01/03/05/07(setup)/08/10, RT-14. Through :8000 the retired portal step returns 303/302 to /app and writes nothing, so later after snapshots differ. Directly on :8080 it returns 404.
  • M5-PROC-DROPPED: BK-07, CP-06, CP-09, RS-07. SQL error 2812 instead of the proc's 50000.
  • M5-API-WRITE-410: api-channel writes (AC-02/04/06/08, BK-02/04/06/09/11, CN-02/04/06/08, CP-07, MX-03, RS-02/04/06/08/09, RT-15). Direct :8081 returns 410. Through :8000 behaviour is the same as M4.
  • M5-MIXED: MX-01. Unchanged: RT-01..13, MX-02.

Deleted files (25)

  • AssessmentDelivery.Business/Rules/SeatCounter.cs
  • AssessmentDelivery.Services/Booking/BookingListItem.cs
  • AssessmentDelivery.Services/Booking/BookingOutcome.cs
  • AssessmentDelivery.Services/Booking/BookingService.cs
  • AssessmentDelivery.Services/Booking/IBookingService.cs
  • AssessmentDelivery.Services/Booking/SessionListItem.cs
  • AssessmentDelivery.Services/Booking/SessionSearchCriteria.cs
  • AssessmentDelivery.Services/Common/SqlErrorHelper.cs
  • AssessmentDelivery.Tests/UnitTests/SeatCounterTests.cs
  • AssessmentDelivery.Web/Controllers/BookingController.cs
  • AssessmentDelivery.Web/Models/BookingModels.cs
  • AssessmentDelivery.Web/Views/Admin/Capacity.cshtml
  • AssessmentDelivery.Web/Views/Booking/Book.cshtml
  • AssessmentDelivery.Web/Views/Booking/Cancel.cshtml
  • AssessmentDelivery.Web/Views/Booking/Index.cshtml
  • AssessmentDelivery.Web/Views/Booking/MyBookings.cshtml
  • AssessmentDelivery.Web/Views/Booking/Reschedule.cshtml
  • db/procs/020_usp_BookSeat.sql
  • db/procs/021_usp_CancelBooking.sql
  • db/procs/022_usp_ChangeCapacity.sql
  • db/procs/023_usp_RescheduleBooking.sql
  • services/booking-api/src/main/java/com/northwind/assessment/booking/model/BookingRequest.java
  • services/booking-api/src/main/java/com/northwind/assessment/booking/model/BookingResponse.java
  • services/booking-api/src/main/java/com/northwind/assessment/booking/model/RescheduleRequest.java
  • services/booking-api/src/main/java/com/northwind/assessment/booking/service/BookingService.java

Tests (head c287816; CI: grep guard, scheduling-service verify incl. LegacySingleWriterIT, Snyk, Socket all green)

Command Result
MSBuild.exe AssessmentDelivery.sln -p:Configuration=Debug (VS 2022 Build Tools, .NET 4.8) build succeeded, 0 errors
packages/NUnit.ConsoleRunner.3.16.3/tools/nunit3-console.exe AssessmentDelivery.Tests/bin/Debug/AssessmentDelivery.Tests.dll 72/72 passed
services/routing-gateway: mvn -B test (JDK 21) 29/29 passed, including new retiredPortalPagesRedirectForEveryCentre (empty allow-list, CHI01, unresolved id)
services: ./mvnw -pl booking-api test (JDK 8) 9/9 passed, including new BookingControllerTest (410)
frontend: npm ci && npm run typecheck passed
bash scripts/check-retired-booking-writes.sh OK. Failed as expected before the two leftover comments were fixed.
sqlcmd -i db/procs/090_retire_booking_procs.sql (run twice), 040_single_writer.sql, db/checks/test_usp_GetCapacityAudit.sql on SQL Server 2022 Express rc 0, 37/37 checks passed; EXEC usp_BookSeat → Msg 2812
LegacySingleWriterIT (Testcontainers) passed in CI (verify job, Testcontainers)

Evidence

Browser walkthrough through :8000 on c287816 (testing agent, real SQL Server). Steps: (a) legacy bookmark /Booking/MyBookings?candidateNumber=NW00000901 while another candidate (NW00000001) was remembered: only B's bookings appear and only B's are requested, also after a hard reload. (b) Modern booking in /app: NW00000902 at SFO01 (never on the M3 allow-list), session 154, booking 50000002, seats 10 → 9; the relay projected it into legacy dbo.Booking. (c) Legacy /Results?candidateNumber=NW00000902 through :8000 renders the legacy page (X-Route: legacy).

walkthrough

Remembered A Bookmark B (only B's rows) Modern booking Legacy /Results, same candidate (:8000)

Before (base b88cdaf portal) / after (this branch). Same inputs: Centers (21 centres, 462 sessions); Eligibility NW00000001 / CTA-CLD3 / 2026-11-11 → NO, retake date 26 Nov 2026; Results NW00000001 → score 541 FAIL.

Before After
/Admin/Centers
/Eligibility
/Results

HTTP matrix through :8000 (all passed):

  • Every retired URL returned GET 302 / POST 303 with the expected Location and X-Route: modern, then 200 on the Location. This includes SFO01, the repeat run with the allow-list narrowed to BOS01,SEA01,AKL01, and /Admin/Sessions?centerId=999999 → /app/.
  • Direct :8080 retired pages returned 404.
  • Direct :8081 book/cancel/reschedule returned 410 LEGACY_WRITE_RETIRED.
  • /Admin/Centers, /Eligibility and /Results returned 200 with X-Route: legacy.
  • The header Bookings tab and quick-find land on /app.
  • All four procs are absent.

Caveat: during testing a local service restart reseeded AssessmentDelivery and removed the earlier booking 50000001, so the final local reconciliation showed 1 mismatch. That came from the test environment, not this change; booking 50000002 was checked separately in legacy storage.

Devin Review

  • Fixed: bookmark A/B race (c287816).
  • Not changed: "Missing-centre sessions link stays on legacy" (BUG_..._0002). The retired URL in the ticket's redirect map is /Admin/Sessions?centerId=. Bare /Admin/Sessions still goes to the kept legacy action, which redirects to Centers as before (README, docs/SYSTEM_OVERVIEW.md portal routes).
  • Flag "Query changes while bookings stays mounted": not changed. Legacy bookmarks arrive through a full-page 302, so MyBookings always mounts fresh, and no in-app link changes candidateNumber.
  • Flag "Multiline writes evade the CI guard": accepted as a limitation. The grep script is a tripwire; the hard enforcement is 040_single_writer.sql (legacy logins are denied Booking/Waitlist/seat writes) plus code review.

Devin-Org: engineering

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/f760cafeb74443b79b54ad7da6c381f5
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/f760cafeb74443b79b54ad7da6c381f5?variant=devin
Requested by: @mbatchelor81


Note

Devin errored when opening this Pull Request as mbatchelor81.
As a fallback, Devin opened this PR as itself.


🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

…g URLs redirect to /app for every centre

Co-Authored-By: Mason <masonbatchelor81@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

… first load (no stale A/B race)

Co-Authored-By: Mason <masonbatchelor81@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@devin-ai-integration
devin-ai-integration Bot merged commit 192a423 into estate/legacy-baseline Nov 11, 2026
7 checks passed
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.

0 participants