Skip to content

refactor: reduce complexity in the top fallow refactoring targets - #556

Merged
MrYuion merged 1 commit into
developfrom
t3/refactor-top-fallow-targets
Oct 8, 2026
Merged

MrYuion merged 1 commit into
developfrom
t3/refactor-top-fallow-targets

Conversation

@MrYuion

@MrYuion MrYuion commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

fallow health --targets lists ten files as the top refactoring targets. Most are large services or utility files with many dependents. The others have one very complex function. Changes to these files are slow to review and easy to break.

Changes

Each file is split where its concerns separate, or its complex function is broken into named helpers. Duplicated logic is removed where it was found. Public library APIs do not change, and the specs did not need behaviour changes.

Target Change Fallow
bookings/booking-form.service.ts Move types, save payload, group helpers, resource helpers and loaders to 5 files. Split postForm into steps (cognitive 63 → 27). Cleared
events/event-form.service.ts Move save checks and change detection to event-save.fn.ts and event-form-changes.ts (1618 → 1350 LOC). Still listed (postForm)
catering/catering-order-tools.ts Move per-order helpers to catering-order-details.ts. Cleared
bookings/booking.utilities.ts Move the form model to booking-form.model.ts (596 → 251 LOC). Still listed
explore/explore-parking.service.ts Split book_fn into methods. Share one booking rules loader with the desk and space services. Cleared
concierge/desks-state.service.ts Split editDesk into helpers (cognitive 34 → 12). Cleared
bookings/booking-card.component.ts Use the shared name helpers. Drive the type icon and warning badges from computed values (template cognitive 31 → 18). Cleared
common/types/booking.class.ts Move constructor logic to helpers (cognitive 75 → 39). Still listed
concierge/room-management.service.ts Merge the duplicated save-and-refresh code. Cleared
events/utilities.ts Move the event form model to event-form.ts (435 → 159 LOC). Cleared

Some of the remaining complexity is long lists of field defaults (x || ''), for example in the Booking constructor and bookingFormValue. These were not split, because a split would change the score and not make the code simpler.

Review notes

  • editDesk now has an as unknown as PlaceZone cast. The old code already passed a BuildingLevel there, and the untyped modal value hid this.
  • The booking card should render the same output. A booking type that has no icon still shows the book icon with no tooltip.

Verification

  • Tests pass for bookings, events, catering, explore, common, concierge and workplace.
  • 18 of 19 apps build. stagehand fails its 1.40 MB initial bundle budget by about 1 kB. develop fails the same way without this change.
  • The Booking constructor refactor was compared against the old constructor with 4000 generated inputs. All field values and key order matched.
  • Rebased onto develop, including fix(bookings): store the flow type on a quick-book booking #546 (booking type fix) and fix(bookings): leave approval to the backend for users who cannot approve #548 (currentUserCanApprove check). These changes now live in the moved code. Both approval checks are kept in booking-form.service.ts, and the new specs for both PRs pass.
  • E2E: the workplace local project passes 13/13 against the isolated stack (e2e/stack/up.sh). All mock suites were run with the proxy set to a closed local port. Workplace, caterer-ui, outlook-addin, survey, map-kiosk, assistant-panel, enrolment, timetable and redirect pass. Booking-panel, visitor-kiosk, control, stagehand, signage and signage-manager fail the same tests on develop without this change. Concierge's Firefox project could not start the browser on this machine, and develop gives the same result. Its Chromium and WebKit tests pass.

Changes made by Claude Opus 5.5 (1M context) in Claude Code, running in T3 Code.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 8, 2026

Copy link
Copy Markdown

Deployment failed for project frontend-templates with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/placeos?upgradeToPro=build-rate-limit

Split large services and utility files along cohesive seams, extract
complex functions into named helpers, and remove duplicated logic.
Public library APIs do not change.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@MrYuion
MrYuion force-pushed the t3/refactor-top-fallow-targets branch from bcc15f2 to 399b811 Compare October 8, 2026 05:02
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
frontend-templates Ignored Ignored Preview Oct 8, 2026 5:02am UTC

@MrYuion
MrYuion merged commit fe71cc1 into develop Oct 8, 2026
2 checks passed
@MrYuion
MrYuion deleted the t3/refactor-top-fallow-targets branch October 8, 2026 08: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.

1 participant