refactor(web): split base.css by section (pinned import order) and api.ts by domain #197

Merged
dominik.polakovics merged 1 commit from afk/195 into main 2026-07-25 23:03:39 +02:00

The two mechanical splits from the line-cap policy (#193). Both are behavior-preserving: no visual change, no import-path change for any caller. Rebased 2026-07-25 onto main 3ec0c68, porting main's additive changes to both files (Settings IA css from #198, container-runner API surface from #205/#207) into the split layout.

base.css → web/src/styles/ (27 files, pinned import order)

  • base.css stays the entry point but now contains only a header comment and 27 @import lines; Vite inlines them in order, so the cascade is pinned exactly as before.
  • Rules were extracted by exact line range along the existing section banners — no reordering, merging, or cleanup. Adjacent banners were grouped only where contiguous (e.g. Chips + Clone progress), so global rule order is untouched by construction. Main's post-branch Settings IA section (#198) became settings-ia.css, imported last to match its append-at-end cascade position.
  • Largest file is chat.css at 584 lines; all far under the 2000 CSS cap.

Proof of visual no-op: the concatenation of the 27 files in import order diffs clean against main's base.css (only prettier-trimmed blank lines at slice edges differ), and the production build emits a byte-identical CSS asset vs a fresh origin/main build — same content hash index-Dg3Jci_b.css, sha256-verified. The sandbox has no browser, and identical emitted CSS is a strictly stronger guarantee than a visual smoke.

api.ts → web/src/api/ (15 domain modules, pure barrel)

  • api.ts is now a pure barrel (export * from './api/…' in original section order); all ~36 importers of '../api' are untouched, as is api.test.ts (under cap, left whole per the issue).
  • Modules follow the file's // --- … --- banners: core (BASE, request, ApiError, errorMessage, setUnauthorizedHandler), auth, credentials, repos, providers, runs, chat, spawn (parked + spawn defaults), issues, secrets, afk, tokens, push, settings, crs. Types moved with their endpoints. Main's container-runner additions (#205/#207) landed in their home modules: Runner + repo fields in repos, the container_* setting keys in settings.
  • Export-surface parity verified against main's api.ts: nothing removed; the only additions reaching the barrel are request (core) and coerceBool (settings), which had to be exported for cross-module use. The import graph is a DAG.

Verification (on the rebased head)

  • tsc --noEmit + vite build green; emitted CSS hash identical to an origin/main build (see above).
  • vitest run: 64 files, 933 tests passed.
  • eslint . and prettier --check . clean.

Sequencing note (#193)

#193 has not landed yet, so there is no baseline.json to delete entries from — that acceptance item is a no-op today. Whichever lands second: if #193 lands after this, its baseline seed (computed at branch time) simply won't include base.css/api.ts; if #193 lands first, regenerate the baseline on this branch before merge (one command per #193) so the two entries drop out, as the ratchet enforces.

Closes #195

The two mechanical splits from the line-cap policy (#193). Both are behavior-preserving: no visual change, no import-path change for any caller. Rebased 2026-07-25 onto main 3ec0c68, porting main's additive changes to both files (Settings IA css from #198, container-runner API surface from #205/#207) into the split layout. ## base.css → `web/src/styles/` (27 files, pinned import order) - `base.css` stays the entry point but now contains only a header comment and 27 `@import` lines; Vite inlines them in order, so the cascade is pinned exactly as before. - Rules were extracted by exact line range along the existing section banners — no reordering, merging, or cleanup. Adjacent banners were grouped only where contiguous (e.g. Chips + Clone progress), so global rule order is untouched by construction. Main's post-branch *Settings IA* section (#198) became `settings-ia.css`, imported last to match its append-at-end cascade position. - Largest file is `chat.css` at 584 lines; all far under the 2000 CSS cap. **Proof of visual no-op:** the concatenation of the 27 files in import order diffs clean against main's `base.css` (only prettier-trimmed blank lines at slice edges differ), and the production build emits a byte-identical CSS asset vs a fresh origin/main build — same content hash `index-Dg3Jci_b.css`, sha256-verified. The sandbox has no browser, and identical emitted CSS is a strictly stronger guarantee than a visual smoke. ## api.ts → `web/src/api/` (15 domain modules, pure barrel) - `api.ts` is now a pure barrel (`export * from './api/…'` in original section order); all ~36 importers of `'../api'` are untouched, as is `api.test.ts` (under cap, left whole per the issue). - Modules follow the file's `// --- … ---` banners: `core` (BASE, request, ApiError, errorMessage, setUnauthorizedHandler), `auth`, `credentials`, `repos`, `providers`, `runs`, `chat`, `spawn` (parked + spawn defaults), `issues`, `secrets`, `afk`, `tokens`, `push`, `settings`, `crs`. Types moved with their endpoints. Main's container-runner additions (#205/#207) landed in their home modules: `Runner` + repo fields in `repos`, the `container_*` setting keys in `settings`. - Export-surface parity verified against main's `api.ts`: nothing removed; the only additions reaching the barrel are `request` (core) and `coerceBool` (settings), which had to be exported for cross-module use. The import graph is a DAG. ## Verification (on the rebased head) - `tsc --noEmit` + `vite build` green; emitted CSS hash identical to an origin/main build (see above). - `vitest run`: 64 files, 933 tests passed. - `eslint .` and `prettier --check .` clean. ## Sequencing note (#193) #193 has not landed yet, so there is no `baseline.json` to delete entries from — that acceptance item is a no-op today. Whichever lands second: if #193 lands after this, its baseline seed (computed at branch time) simply won't include `base.css`/`api.ts`; if #193 lands first, regenerate the baseline on this branch before merge (one command per #193) so the two entries drop out, as the ratchet enforces. Closes #195
refactor(web): split base.css by section and api.ts by domain
All checks were successful
ci / native (pull_request) Successful in 6m55s
acde43dd50
base.css (3945 lines) is now an ordered @import list only; every rule
moved verbatim into 26 per-section files under web/src/styles/, exact
cascade order preserved (emitted CSS asset is byte-identical: the
index-CviIMW_d content hash is unchanged).

api.ts (1563 lines) is now a pure barrel; content moved verbatim into
15 domain modules under web/src/api/ along the existing section
banners. All importers of '../api' untouched; export surface unchanged
except `request` and `coerceBool`, now exported for cross-module use.

Closes #195

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
Owner

[autoland] verdict: pass

Clean PASS. CI green (ci / native success, run 221). Behavior-preserving verified independently: the 26 styles/*.css files concatenated in @import order are content-identical to the original base.css; api.ts barrel has zero export drops (only additive request + coerceBool, both disclosed). Title conventional, Closes #195 present, diff scope exactly the two splits. No baseline.json on main yet, so the #193 sequencing item is a no-op.

[autoland] verdict: pass Clean PASS. CI green (ci / native success, run 221). Behavior-preserving verified independently: the 26 styles/*.css files concatenated in @import order are content-identical to the original base.css; api.ts barrel has zero export drops (only additive request + coerceBool, both disclosed). Title conventional, Closes #195 present, diff scope exactly the two splits. No baseline.json on main yet, so the #193 sequencing item is a no-op.
dominik.polakovics force-pushed afk/195 from acde43dd50
All checks were successful
ci / native (pull_request) Successful in 6m55s
to 964a79c486
All checks were successful
agent-tools / publish (pull_request) Has been skipped
agent-tools / smoke (pull_request) Successful in 10m15s
ci / native (pull_request) Successful in 9m45s
ci-nix / flake-check (pull_request) Successful in 25m50s
2026-07-25 22:32:06 +02:00
Compare
Author
Owner

Rebased onto current main (3ec0c68, was 62 commits behind) and re-ported the split over main's additive changes to both files:

  • base.css — main appended one new self-contained section, Settings IA (issue #198) (153 lines, from 7da7d61). It becomes a new 27th file styles/settings-ia.css, imported last — matching its append-at-end cascade position, so global rule order stays untouched by construction.
  • api.ts — main added the container-runner surface (f446550, f4d5d74): Runner type + runner/container_*/image_ref fields on Repo and RepoPatch went into api/repos.ts; the container_pids/container_nofile/container_memory setting keys went into api/settings.ts. All ported verbatim, same relative positions. The barrel is unchanged.

Re-verification on the rebased head (964a79c):

  • Concatenation of the 27 files in import order diffs clean against main's base.css (blank-line-insensitive, as before).
  • Production build emits a byte-identical CSS asset vs a fresh origin/main build: same content hash index-Dg3Jci_b.css, sha256 11052d74… on both sides.
  • Export-surface parity vs main's api.ts: zero drops; the only additions remain the previously disclosed request (core) and coerceBool (settings).
  • tsc --noEmit + vite build green; vitest run 64 files / 933 tests passed; eslint and prettier --check clean.

Still no baseline.json on main, so the #193 sequencing note is unchanged.

Rebased onto current main (3ec0c68, was 62 commits behind) and re-ported the split over main's additive changes to both files: - **base.css** — main appended one new self-contained section, *Settings IA (issue #198)* (153 lines, from 7da7d61). It becomes a new 27th file `styles/settings-ia.css`, imported last — matching its append-at-end cascade position, so global rule order stays untouched by construction. - **api.ts** — main added the container-runner surface (f446550, f4d5d74): `Runner` type + `runner`/`container_*`/`image_ref` fields on `Repo` and `RepoPatch` went into `api/repos.ts`; the `container_pids`/`container_nofile`/`container_memory` setting keys went into `api/settings.ts`. All ported verbatim, same relative positions. The barrel is unchanged. Re-verification on the rebased head (964a79c): - Concatenation of the 27 files in import order diffs clean against main's `base.css` (blank-line-insensitive, as before). - Production build emits a **byte-identical CSS asset** vs a fresh origin/main build: same content hash `index-Dg3Jci_b.css`, sha256 `11052d74…` on both sides. - Export-surface parity vs main's `api.ts`: zero drops; the only additions remain the previously disclosed `request` (core) and `coerceBool` (settings). - `tsc --noEmit` + `vite build` green; `vitest run` 64 files / 933 tests passed; `eslint` and `prettier --check` clean. Still no `baseline.json` on main, so the #193 sequencing note is unchanged.
Author
Owner

[autoland] verdict: pass

This was generated by AI while landing a PR.

PASS. Relied on green Forgejo CI (all 4 checks success: ci/native, ci-nix/flake-check, agent-tools/smoke, agent-tools/publish) — not re-run.

Behavior-preserving verified independently on the rebased head:

  • base.css: reconstruction of the 27 styles/*.css modules in @import order is identical (blank-line-insensitive) to origin/main's base.css — cascade order pinned by construction.
  • api.ts: pure barrel (export * in original section order); zero export drops vs origin/main, only additive request + coerceBool, both disclosed.

Title Conventional Commits, Closes #195 present, diff scope exactly the two splits. No CONCERNS.

[autoland] verdict: pass > *This was generated by AI while landing a PR.* PASS. Relied on green Forgejo CI (all 4 checks success: ci/native, ci-nix/flake-check, agent-tools/smoke, agent-tools/publish) — not re-run. Behavior-preserving verified independently on the rebased head: - base.css: reconstruction of the 27 styles/*.css modules in @import order is identical (blank-line-insensitive) to origin/main's base.css — cascade order pinned by construction. - api.ts: pure barrel (export * in original section order); zero export drops vs origin/main, only additive request + coerceBool, both disclosed. Title Conventional Commits, Closes #195 present, diff scope exactly the two splits. No CONCERNS.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Cloonar/coding-lab!197
No description provided.