Simplify Delta Command for maintenance#8
Draft
nfaggian wants to merge 2 commits into
Draft
Conversation
Remove dead code and unify data-fetching patterns.
Frontend:
- Delete src/core/team-utils.ts (inline formatNameList into utils.ts)
- Delete getDatabase() from api.ts (never called)
- Delete filterTimelineRows() from TeamFilters.tsx (never called)
- Remove duplicate formatCurrencyShort() in dashboard-analytics.ts
- Consolidate getUtilizationColor/TextColor/CellStyle into a single
utilizationVariant() helper returning { bar, text, cell }
- Replace KPICard's free-form iconColor string prop with a typed
accent tone ('blue' | 'violet' | ...)
- Drop unnecessary CHART_GRID_COLOR / CHART_TICK_COLOR aliases
- Route API calls through Next.js rewrites when called from the
browser so client components share the same api.ts client
- Convert Opportunities and Projects pages to server-rendered
components (matching the Team page pattern); mutations use
router.refresh() instead of manual re-fetching, eliminating
loading spinners and two ad-hoc fetch calls
- Delete scripts/capture-ui.mjs (one-off dev screenshot helper)
Backend:
- Delete migrate_legacy_runtime() and LEGACY_RUNTIME_PATH now that
the YAML->JSON migration is long complete
- Inline the _data_path() wrapper (just database_path())
- Add missing EngineerStatus import in store.py
- Drop legacy config/runtime.{json,yaml} entries from .gitignore
- Remove the now-obsolete migration test
Repo:
- Delete llms-full.txt (1.2 MB unused ADK docs dump)
- Delete apps/delta-command/data/ (leftover from earlier data location)
Verified: npm run build passes; uv run pytest passes 14/14.
Co-authored-by: Nathan Faggian <nathan.faggian@gmail.com>
Trim the API surface, kill compute-on-read side effects, and let the
frontend derive every metric from a single GET call. Net: ~550 fewer
lines across backend and frontend.
Backend
- Collapse 7 read endpoints (dashboard, engineers, opportunities,
projects, timeline, and their filter variants) into ONE endpoint:
GET /api/state -> whole database
The frontend derives every metric, KPI, and timeline column from it.
- Delete PATCH /api/engineers (was unused by the UI)
- Delete metrics.py, DashboardMetrics model, compute_dashboard_metrics
(frontend already computes everything via dashboard-analytics.ts)
- Delete utilization_timeline.py entirely. The timeline shape is now
purely stored data. seed_team.py owns timeline creation, the PATCH
endpoint only mutates existing cells, and column metadata (label,
isCurrent) is derived on the client from today's date via
deriveTimelineWeeks()
- get_utilization_timeline no longer writes to disk on GET (was
silently backfilling missing weeks). All reads are now pure.
- Remove CORS middleware — Next.js rewrites make it unnecessary
- Drop DELTA_CONFIG_PATH alias (keep DELTA_DATA_PATH only)
- Replace per-field alias= declarations with a single module-level
alias_generator=to_camel on every model. Cuts models.py in half.
- Drop the 'from __future__ import annotations' preamble everywhere
(Python 3.12+ handles it natively)
Frontend
- api.ts now has one getState() + three PATCH helpers. Deleted
getEngineers, getOpportunities, getProjects, getDashboardMetrics,
getUtilizationTimeline.
- Every page.tsx destructures from a single getState() call
- UtilizationTimelineView takes engineers directly and derives
{ weekStart, label, isCurrent } from stored cells — no separate
timeline endpoint or response type
- Delete UtilizationTimelineWeek/Cell/Row/UtilizationTimeline types
and DashboardMetrics interface
- TeamPageClient stat cards extracted into a small StatCard helper
- Refresh both READMEs to describe the new (much smaller) surface
Verified: 9/9 backend tests pass; npm run build passes; all four
pages render correctly against the running backend.
Co-authored-by: Nathan Faggian <nathan.faggian@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two passes over the codebase from a maintainer's perspective. Net: ~34,000 fewer lines (mostly the unused
llms-full.txtdump) plus a ~550-line reduction in actual source across backend and frontend.Pass 1 — Dead code and duplication (
8dfab9e)llms-full.txt,apps/delta-command/data/db.json,scripts/capture-ui.mjsgetDatabase(),filterTimelineRows(),formatCurrencyShort()— all unusedmigrate_legacy_runtime()(migration long complete) and its testutilizationVariant()returning{ bar, text, cell }KPICard's free-formiconColorstring with a typed accent tonerouter.refresh())Pass 2 — Aggressive simplification for maintenance (
50f4747)The API surface, the Pydantic layer, and the reactive computation were doing more than they needed to. Cut them down.
Single-endpoint API
Backend now has one GET and three PATCHes:
/api/state— whole database/api/opportunities/api/projects/api/timelineDeleted:
/api/dashboard,/api/engineers(GET + PATCH),/api/opportunities(GET),/api/projects(GET),/api/utilization/timeline(GET). Also deleted their filter query params, thelist_engineerssearch logic, and theupdate_engineer_utilizationcode path (unused by the UI).No more compute-on-read
get_utilization_timeline()was silently backfilling missing weeks and writing to disk on GET. That's gone. Timeline shape is now purely stored data —seed_team.pyowns creation,PATCH /api/timelineonly mutates existing cells, and column metadata (label,isCurrent) is derived on the client viaderiveTimelineWeeks().Fewer metric definitions
metrics.py(backend) anddashboard-analytics.ts(frontend) were both computing overlapping numbers. Deletedmetrics.py,compute_dashboard_metrics, and theDashboardMetricsmodel. The frontend already computes everything from raw state.Pydantic boilerplate
Replaced per-field
alias="camelCase"declarations with a module-levelalias_generator=to_camel.models.pyhalves in size. Also droppedfrom __future__ import annotations(Python 3.12+ handles it).Other trims
DELTA_CONFIG_PATHalias (one env var only)utilization_timeline.pymodulegetEngineers/getOpportunities/getProjects/getDashboardMetrics/getUtilizationTimelinein favor of a singlegetState()UtilizationTimeline*frontend types (backend no longer returns them)Verification
All four pages render correctly against the live backend.