Repository navigation
refactor(libs): remove ~9,000 lines of dead and duplicated code - #653
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
MrYuion
left a comment
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo
One real issue: the time zone list built from Intl.supportedValuesOf drops current IANA names in Chrome and Safari. See the inline comment.
What I checked at 1947249119:
- Every removed export, selector and pipe name: no remaining uses in
apps/,libs/,e2e/ortools/. Matches that remain are local copies that already existed (MapPolygonData,EventNote,TimePeriod,RecurrenceDetailsand others in@placeos/common). ngc --noEmitwithstrictTemplatesfor all 19 apps,tscfor all 30 spec tsconfigs, ande2e:typecheck. All clean.nx testfor common, assets, form-fields, mocks and catering. All pass.- The merged code keeps its behaviour:
a-counter [compact]matches the oldcompact-counterclass and template,ensureHiddenCategory/ensureAssetTypeuse the raw ts-client queries like the old copies, the CRUD mock helper keeps the old ids and PUT/DELETE semantics, and the removed/api/staff/v1/signage*mocks have no callers.
Nit (file not in the diff): the comment at e2e/support/concierge/locker.seed.ts:16 still names queryLockerBankAssets, which this PR removes.
1947249 to
71b658b
Compare
|
Note 🤖 Claude Opus 5.5 responding on behalf of Alex Sorafumo The |
…ltip retries The catering select modal saved favourite menu items under the desk favourites key, so they mixed into desk favourites. Both catering views now use SETTING_KEYS.FAVORITE_CATERING. ExploreDeskInfoComponent retried its position lookup every 200 ms with no limit when its parent element was missing. It now stops after 10 tries.
… wiring Removes components, pipes, a guard and a directive in libs/components and libs/form-fields that nothing imports or renders (including the old 608-line indoor-maps copy of maps-indoors), inputs that no caller binds, and the upload permissions modal path. The app-level provider for that modal was removed in f6aa2e0, so the component-level providers never reached the root UploadsService and the modal could not open. authenticated-image.pipe.ts is renamed authenticated-image.ts as it no longer holds a pipe.
Removes settings.interfaces.ts (imported nowhere), the Vorlon and keep-alive services, the unused feature guard, a spec helper that pulled @ngneat/spectator/jest into the production barrel, unused general.ts helpers (including a buggy mapLastValueFrom), unused guest/staff functions, the user label modal, and unused Stripe types and members.
…d events Removes DesksService and its confirm modal, about 25 unused query and helper functions, the asset group pipe, the catering order options modal, unused members and inputs, and the events copies of interfaces and helpers that had drifted from @placeos/common. AssetStateService no longer loads an asset list and asset bookings that nothing read, which saves two requests on every options change. A loading entry now covers the availability request instead.
Removes the signage staff API mock handlers (no app calls those paths), unused mock data helpers, src/mocks.ts, and a few unused map-editor exports.
Fourteen components wrote their own "add the ID or remove it" code before saving a favourites setting. They now use toggleListItem() from @placeos/common.
The desk, locker, parking and catering asset files each had a copy of the code that finds or creates their hidden asset category and type. assets.fn.ts now has one cached version. It retries after a create collision and shares the category and type lists, so fewer duplicate requests go out. A failed list request now rejects and is not cached. Before, it was treated as an empty list, which could create a duplicate type and hide existing resources until reload.
upload-file-field and upload-list-field had the same upload method. It is now uploadAttachment(), which passes the File straight to uploadFiles, so the blob-util dependency is removed. compact-counter was a copy of a-counter with another layout. It is now the `compact` input of a-counter.
The 16 show/create/update/delete handlers in assets.mock.ts now come from one helper. Also removes the empty metadata fields from mock endpoints and merges the identical display and microphone modules.
Catering and assets each had the same cached zone rules loader, and bookings and events each had the same app name and version stamp. Each is now one helper. Also removes padString, which copied padLength, and simplifies padLength and flatten with native methods.
Replaces 29 copies of the NG_VALUE_ACCESSOR provider block with provideValueAccessor(() => Component) from @placeos/common.
Replaces the 983-line hand-written time zone table with
Intl.supportedValuesOf('timeZone'), plus UTC and the Etc/GMT
fixed-offset zones. Deprecated aliases such as Asia/Saigon are no longer
suggested, but stored values still show and save.
Chrome and Safari return legacy names such as Asia/Calcutta from Intl.supportedValuesOf. Map them to the current IANA names so that searches for Kolkata, Kyiv or Ho Chi Minh find a match.
No template renders desks-topbar. Only its own spec and a mock in the desks component spec referenced it.
The desks view and the desk manager parsed the CSV and gave new rows an id in two copies. DesksStateService.importDesksCsv now does both.
The code flow and the desk flow both queried the org's desk assets and matched the legacy id. queryDeskAssetByLegacyId now does this. queryAllAssetPages is private again, because only assets.fn.ts uses it.
71b658b to
0966141
Compare
|
Deployment failed for project frontend-templates with the following error: Learn More: https://vercel.com/placeos?upgradeToPro=build-rate-limit |
Problem
The libs had built up a lot of code that nothing uses, plus several copies of the same logic. I went through all 12 libs to remove and merge what I could. The work also found two small bugs.
Solution
One commit per block, so each can be reviewed alone. The branch removes about 9,650 lines and adds about 1,050.
Bug fixes. The catering select modal saved favourite menu items under the desk favourites key. The explore desk tooltip retried its position lookup every 200 ms with no limit.
Dead code. I removed components, pipes, services and functions with no references in
apps/orlibs/, including a 608-line copy ofmaps-indoors, the upload permission modal (switched off since f6aa2e0),settings.interfaces.ts,DesksService, and mock endpoints that no app calls.Shared helpers.
toggleListItem()for 14 favourite toggles. One cached hidden asset type lookup for desks, lockers, parking and catering.uploadAttachment(), which also drops theblob-utildependency.compact-counteris now<a-counter [compact]="true">.provideValueAccessor()for 29 provider blocks. Plus a table-driven asset CRUD mock and a few smaller helpers.Time zones.
timezones.tsis now built fromIntl.supportedValuesOf('timeZone'), plus UTC and theEtc/GMTfixed-offset zones. Chrome and Safari return some legacy names (for exampleAsia/Calcutta), so a small map changes them to the current IANA names (Asia/Kolkata). It was 983 lines and is now 62.Desk asset work from fix: desk assets support in workplace and concierge #656 and fix(desks): CSV import no longer erases desk data #657. The branch is rebased onto it. The new
*InZonequeries for desks, lockers and parking use onequeryTypeAssetsInZone()helper, and the per-zone queries now use the same paged query. The concierge desk CSV import is now oneDesksStateService.importDesksCsv(). The code flow and the desk flow sharequeryDeskAssetByLegacyId(). I also removeddesks-topbar, which no template renders.Behavior changes
AssetStateServiceno longer loads an asset list and asset bookings that nothing read, so each options change sends two fewer requests. A loading entry now covers the availability request.Asia/Ho_Chi_MinhandEurope/Kyiv. The list follows the browser's time zone data, so it can change between browsers. Stored values still show and save.Not done
I left these out on purpose. The desk, locker and parking list fields and select modals could be merged, but the result needs many config inputs and is harder to read than the separate components. Also open:
libs/bookings/src/lib/parking.service.ts:57drops the result oflist.map(...)and its region check looks inverted. Someone who knows the parking region rules should look at that.Verification
nx affected -t testpasses for 30 projects. Under parallel load, twosignage-managerspecs ("searches without a parent selection") can fail because they wait 450 ms of real time for a debounce. They pass when run alone, and this branch does not changesignage-manager.nx affected -t buildpasses for 19 apps. Aworkplacedevelopment build compiles the mocks.Reviewed with sol-loop: 16 rounds over the first 12 blocks with gpt-6.1-sol on xhigh. Sol verdict: approved
Changes made by Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, running in T3 Code. The first audit used Claude subagents. GPT-6.1 Sol (Codex) reviewed each block.🤖 Generated with Claude Code