Skip to content

refactor: deepen PHP service/auth/deck layers, JS search codec and Re:Builder stores (A11-A16) - #207

Open
cepalle wants to merge 2 commits into
feat/unify-search-tabsfrom
refactor/architecture-deepening
Open

cepalle wants to merge 2 commits into
feat/unify-search-tabsfrom
refactor/architecture-deepening

Conversation

@cepalle

@cepalle cepalle commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #195 (feat/unify-search-tabs).

Summary

 includes/
+├── service-client.php     # AcServiceClient / acServiceRequest / acServiceMulti (fixes missing $code >= 400 check in ownApiRequest)
+└── auth-session.php       # AuthSessionManager: AES-256-GCM (v2:) + legacy CBC fallback, per-request DB token cache
 plugins/core-altered-cards/
 ├── includes/
+│   └── deck-service.php   # DeckService replacing ~435 lines of inline handlers in decks.php & deck.php
 └── assets/
+    ├── card-search-query.js    # pure UMD query/URL/numeric-expression codec
+    └── card-search-effects.js  # UMD TomSelect effect/support controller (~850 lines extracted from card-search.js)
 plugins/rebuilder/app/src/app/
 ├── core/
+│   ├── deck-autosave-queue.ts  # single-flight, revision-tracked autosave state machine
+│   └── deck-print-model.ts     # pin/canonical/token-override model + shared guestDeckToWrite()
 ├── ui/nav/
+│   └── scroll-preservation.ts  # reusable RouteReuseStrategy scroll preservation helper
 └── features/decks/
+    ├── decks-url-codec.ts      # bidirectional URL query codec (with legacy site params)
+    └── decks-catalog.store.ts  # component-scoped data/resource/like/migration store for DecksPage

Evidence

  • Before: 6 separate hand-rolled cURL wrappers (one missing HTTP >= 400 error check), unauthenticated AES-256-CBC token storage with duplicate DB SELECTs per request, 1,000+ line DeckStore and 700+ line DecksPage, inline deck AJAX handlers, and a monolithic card-search.js.
  • After:
    • php tests/run.php → PASS (AuthSessionTest, ServiceClientTest, CollectionQueryTest, DesignSystemTest).
    • php plugins/core-altered-cards/tests/run.php → 235/235 passed (including DeckServiceTest).
    • node card-search.test.mjs → 74/74 passed; node card-search-tab-visibility.test.mjs → 22/22 passed.
    • Re:Builder npm run lint (ng lint + i18n:check) → 0 errors, 857 messages translated.
    • Re:Builder ng test --watch=false → 67/67 files, 396/396 tests passed; npm run build → OK.

Merge Danger

Door: Two-way

All procedural PHP facades (kcIsLoggedIn, kc_get_access_token, etc.), URL query contracts, and Angular store APIs are preserved. Existing CBC-encrypted remember cookies and DB refresh tokens decrypt transparently and re-encrypt as v2: AES-256-GCM on next write.

Blast Radius: Medium

Touches auth session encryption, service HTTP clients, classic card search scripts, deck pages, and Re:Builder stores; mitigated by full unit/integration test coverage and transparent legacy CBC fallback.

@gitguardian

gitguardian Bot commented Nov 28, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
41651119 Triggered Generic High Entropy Secret 91e708e plugins/rebuilder/app/src/app/core/deck-print-model.spec.ts View secret
40867104 Triggered Generic High Entropy Secret 91e708e plugins/rebuilder/app/src/app/core/deck-print-model.spec.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@cepalle
cepalle added this pull request to stack #208 November 28, 2026 08:28
@github-actions

Copy link
Copy Markdown

⚠️ Loading: CLS over budget

Not a failure: the CLS of a screen varies from one CI run to the next. Each screenshot is the settled page, the boxes that moved drawn on it (dashed: before, solid: after). Frame by frame: npm run loading:timeline -- <screen> in tests/e2e. Run: https://github.com/Altered-Community/alteredcore-website/actions/runs/46126019284

desktop · editor, Main, second visit: skeleton until the first screen, styled, no layout shift

CLS 0.1129 (budget 0.01)

Shifts
2101 ms  0.0001
  x1057 y343 38×38 → x1057 y308 38×38 (path < svg.ac-icon < ac-icon)
  x137 y98 75×16 → x137 y93 75×16 (a.back < div.text < div.identity)
2308 ms  0.0004
  x820 y108 180×30 → x750 y108 180×30 (span.pill < ac-terrain-totals < div.terrain)
  x1016 y111 87×24 → x946 y111 157×24 (ac-badge.ac-badge.ac-badge--orange < button.legality < app-deck-bar.reduced)
  x803 y97 1×52 → x733 y97 1×52 (span.sep < app-deck-bar.reduced < div.top)
2547 ms  0.1124
  x24 y306 1028×448 → x24 y574 1028×326 (p.note < div.body < ac-card.ac-card.block)
  x24 y778 1028×122 → x0 y0 0×0
  x545 y707 506×46 → x0 y0 0×0
  x25 y707 506×46 → x0 y0 0×0
  x157 y242 147×40 → x181 y242 171×40 (button.ac-button.ac-button--secondary < div.toolbar < app-test-hand)

desktop · editor, Mon deck, first visit: skeleton until the first screen, styled, no layout shift

CLS 0.0817 (budget 0.01)

Shifts
1332 ms  0.0004
  x815 y0 202×59 → x832 y0 202×59 (li.nav-item.dropdown < ul.navbar-nav.az-nav-list < div.az-navband-inner)
  x460 y0 131×59 → x478 y0 131×59 (li.nav-item < ul.navbar-nav.az-nav-list < div.az-navband-inner)
  x698 y0 117×59 → x715 y0 117×59 (li.nav-item < ul.navbar-nav.az-nav-list < div.az-navband-inner)
  x351 y0 110×59 → x368 y0 110×59 (li.nav-item.dropdown < ul.navbar-nav.az-nav-list < div.az-navband-inner)
  x591 y0 107×59 → x609 y0 107×59 (li.nav-item.dropdown < ul.navbar-nav.az-nav-list < div.az-navband-inner)
4834 ms  0.081
  x24 y242 1028×658 → x24 y310 1028×590 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x0 y0 0×0 → x25 y878 318×22 (div.filters-foot < aside.filters < div.filters-drawer)
  x1127 y365 186×20 → x1163 y365 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y329 186×20 → x1163 y329 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y293 186×20 → x1163 y293 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
5472 ms  0
  x73 y736 10×18 → x85 y736 10×18 (span < button < ac-icon-toggle-group)
5606 ms  0
  x220 y736 8×18 → x234 y736 8×18 (span < button < ac-icon-toggle-group)
6527 ms  0
  x147 y736 9×18 → x159 y736 9×18 (span < button < ac-icon-toggle-group)
6587 ms  0
  x292 y736 9×18 → x304 y736 9×18 (span < button < ac-icon-toggle-group)
7374 ms  0.0003
  x402 y374 248×32 → x467 y374 183×32 (div.clear < ac-filter-bar.chips < div.toolbar)

desktop · editor, Mon deck, second visit at 1024 px: skeleton until the first screen, styled, no layout shift

CLS 0.0309 (budget 0.01)

Shifts
1686 ms  0.0002
  x681 y343 38×38 → x681 y308 38×38 (path < svg.ac-icon < ac-icon)
  x137 y98 75×16 → x137 y93 75×16 (a.back < div.text < div.identity)
1765 ms  0.0001
  x897 y14 103×32 → x880 y14 120×32 (button.az-account-btn < div.az-topbar-inner < div.az-topbar)
1798 ms  0.0304
  x24 y242 652×558 → x24 y310 652×490 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x751 y365 146×20 → x787 y365 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x751 y293 146×20 → x787 y293 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x751 y329 146×20 → x787 y329 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x717 y331 24×14 → x753 y331 24×14 (img.rarity < ac-deck-row.panel.readonly < div.group)
3270 ms  0.0002
  x103 y370 127×40 → x135 y370 127×40 (button.ac-button.ac-button--secondary < div.toolbar < section.results)

desktop · editor, Mon deck, second visit at 1280 px: skeleton until the first screen, styled, no layout shift

CLS 0.0868 (budget 0.01)

Shifts
2083 ms  0.0868
  x24 y242 908×558 → x24 y310 908×490 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x0 y0 0×0 → x25 y778 318×22 (div.filters-foot < aside.filters < div.filters-drawer)
  x1153 y14 103×32 → x1136 y14 120×32 (button.az-account-btn < div.az-topbar-inner < div.az-topbar)
  x1007 y329 146×20 → x1043 y329 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1007 y293 146×20 → x1043 y293 144×20 (span.name < ac-deck-row.panel.readonly < div.group)

desktop · editor, Mon deck, second visit: skeleton until the first screen, styled, no layout shift

CLS 0.0814 (budget 0.01)

Shifts
2381 ms  0.0001
  x1057 y343 38×38 → x1057 y308 38×38 (path < svg.ac-icon < ac-icon)
  x137 y98 75×16 → x137 y93 75×16 (a.back < div.text < div.identity)
2600 ms  0.081
  x24 y242 1028×658 → x24 y310 1028×590 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x0 y0 0×0 → x25 y878 318×22 (div.filters-foot < aside.filters < div.filters-drawer)
  x1127 y365 186×20 → x1163 y365 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y329 186×20 → x1163 y329 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y293 186×20 → x1163 y293 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
3442 ms  0.0003
  x402 y374 248×32 → x467 y374 183×32 (div.clear < ac-filter-bar.chips < div.toolbar)

desktop · editor, Recherche, first visit: skeleton until the first screen, styled, no layout shift

CLS 0.0809 (budget 0.01)

Shifts
4904 ms  0
  x73 y668 10×18 → x85 y668 10×18 (span < button < ac-icon-toggle-group)
  x147 y668 9×18 → x159 y668 9×18 (span < button < ac-icon-toggle-group)
  x292 y668 9×18 → x304 y668 9×18 (span < button < ac-icon-toggle-group)
  x220 y668 8×18 → x234 y668 8×18 (span < button < ac-icon-toggle-group)
5012 ms  0
  x1313 y14 103×32 → x1296 y14 120×32 (button.az-account-btn < div.az-topbar-inner < div.az-topbar)
5086 ms  0.0806
  x24 y242 1028×658 → x24 y310 1028×590 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x0 y0 0×0 → x25 y878 318×22 (div.filters-foot < aside.filters < div.filters-drawer)
  x1127 y329 186×20 → x1163 y329 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y293 186×20 → x1163 y293 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y365 186×20 → x1163 y365 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
5712 ms  0.0003
  x402 y374 248×32 → x467 y374 183×32 (div.clear < ac-filter-bar.chips < div.toolbar)

desktop · editor, Recherche, second visit at 1024 px: skeleton until the first screen, styled, no layout shift

CLS 0.0309 (budget 0.01)

Shifts
1844 ms  0.0002
  x681 y343 38×38 → x681 y308 38×38 (path < svg.ac-icon < ac-icon)
  x137 y98 75×16 → x137 y93 75×16 (a.back < div.text < div.identity)
1914 ms  0.0001
  x897 y14 103×32 → x880 y14 120×32 (button.az-account-btn < div.az-topbar-inner < div.az-topbar)
1944 ms  0.0304
  x24 y242 652×558 → x24 y310 652×490 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x751 y365 146×20 → x787 y365 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x751 y293 146×20 → x787 y293 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x751 y329 146×20 → x787 y329 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x717 y331 24×14 → x753 y331 24×14 (img.rarity < ac-deck-row.panel.readonly < div.group)
3282 ms  0.0002
  x103 y370 127×40 → x135 y370 127×40 (button.ac-button.ac-button--secondary < div.toolbar < section.results)

desktop · editor, Recherche, second visit at 1280 px: skeleton until the first screen, styled, no layout shift

CLS 0.0321 (budget 0.01)

Shifts
1968 ms  0.0271
  x24 y242 908×558 → x24 y310 908×490 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x1153 y14 103×32 → x1136 y14 120×32 (button.az-account-btn < div.az-topbar-inner < div.az-topbar)
  x1007 y329 146×20 → x1043 y329 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1007 y293 146×20 → x1043 y293 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1007 y365 146×20 → x1043 y365 144×20 (span.name < ac-deck-row.panel.readonly < div.group)
2079 ms  0.005
  x0 y0 0×0 → x25 y710 318×65 (button.ac-button.go < div.filters-foot < aside.filters)
  x325 y698 38×38 → x325 y555 38×38 (path < svg.ac-icon < ac-icon)

desktop · editor, Recherche, second visit: skeleton until the first screen, styled, no layout shift

CLS 0.081 (budget 0.01)

Shifts
2023 ms  0.0001
  x1057 y343 38×38 → x1057 y308 38×38 (path < svg.ac-icon < ac-icon)
  x137 y98 75×16 → x137 y93 75×16 (a.back < div.text < div.identity)
2130 ms  0
  x1313 y14 103×32 → x1296 y14 120×32 (button.az-account-btn < div.az-topbar-inner < div.az-topbar)
2172 ms  0.0806
  x24 y242 1028×658 → x24 y310 1028×590 (span.ac-skeleton.ac-skeleton--card < ac-virtual-grid.grid.grid--cols < app-search-results)
  x0 y0 0×0 → x25 y878 318×22 (div.filters-foot < aside.filters < div.filters-drawer)
  x1127 y329 186×20 → x1163 y329 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y293 186×20 → x1163 y293 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
  x1127 y365 186×20 → x1163 y365 184×20 (span.name < ac-deck-row.panel.readonly < div.group)
3451 ms  0.0003
  x402 y374 248×32 → x467 y374 183×32 (div.clear < ac-filter-bar.chips < div.toolbar)

mobile · editor, Aperçu, first visit: skeleton until the first screen, styled, no layout shift

CLS 0.1046 (budget 0.01)

Shifts
4237 ms  0.1046
  x16 y125 358×595 → x16 y237 358×595 (div.grid < ac-deck-section < app-deck-preview)
  x292 y67 92×36 → x292 y63 92×44 (button.ac-icon-button.cdk-menu-trigger < div.actions < header)

mobile · editor, Aperçu, second visit: skeleton until the first screen, styled, no layout shift

CLS 0.1046 (budget 0.01)

Shifts
1377 ms  0.1046
  x16 y125 358×595 → x16 y237 358×595 (div.grid < ac-deck-section < app-deck-preview)
  x292 y67 92×36 → x292 y63 92×44 (button.ac-icon-button.cdk-menu-trigger < div.actions < header)

mobile · editor, Recherche, first visit: skeleton until the first screen, styled, no layout shift

CLS 0.1157 (budget 0.01)

Shifts
4102 ms  0.1157
  x0 y125 390×719 → x0 y237 390×607 (ac-virtual-grid.grid < app-search-results < section.results)
  x292 y67 92×36 → x292 y63 92×44 (button.ac-icon-button.cdk-menu-trigger < div.actions < header)

mobile · editor, Recherche, second visit: skeleton until the first screen, styled, no layout shift

CLS 0.1157 (budget 0.01)

Shifts
1382 ms  0.1157
  x0 y125 390×719 → x0 y237 390×607 (ac-virtual-grid.grid < app-search-results < section.results)
  x292 y67 92×36 → x292 y63 92×44 (button.ac-icon-button.cdk-menu-trigger < div.actions < header)

github-actions Bot added a commit that referenced this pull request Nov 28, 2026

This branch has not been deployed

No deployments
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