Skip to content

fix(front): remove the duplicate API_BASE declaration that breaks the build - #121

Merged
sergi-torres merged 1 commit into
mainfrom
fix/duplicate-api-base
Jul 28, 2026
Merged

fix(front): remove the duplicate API_BASE declaration that breaks the build#121
sergi-torres merged 1 commit into
mainfrom
fix/duplicate-api-base

Conversation

@sergi-torres

@sergi-torres sergi-torres commented Jul 28, 2026

Copy link
Copy Markdown
Owner

What

main declares const API_BASE twice, at frontend/src/lib/api.ts:78 and :79:

const API_BASE = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000";
const API_BASE =
  process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:8000";

This removes the first one. The renamed variable is the one to keep — it is the entire point of WO-01 (#82): the deployed frontend was talking to localhost because it read the wrong env var name.

Why

The frontend cannot be built or deployed from main right now.

  • npx next build fails outright
  • tsc reports TS2451 twice
  • three test files no longer parse: verify.test.ts, style-profiles.test.ts, StyleDnaPanel.test.ts

How this got in

Merging #115 (WO-01) and #119 (WO-11) — two independent branches that both touch frontend/src/lib/api.ts — kept both sides of the collision instead of choosing one.

Worth noting for the process, not for blame: each PR passed Frontend lint + typecheck on its own head. Neither was ever typechecked against the other's result, because that combination only came into existence at merge time. A conflict resolved by keeping both sides produces valid-looking diff hunks and invalid TypeScript, and nothing in the pipeline looked at the merged tree before it landed on main.

If branch protection can require "branches must be up to date before merging", that closes this class of failure for the remaining PRs.

How IBM Bob helped

  • Custom Mode used: none
  • Bob session export: n/a

Found by a Claude Code agent working on #44, which hit the broken build while trying to launch the app to click through its own feature. It reported and stopped rather than fixing it as a side quest, per the dispatch protocol — the same rule that produced #99, #100, #102 and #107.

Screenshots / output

$ grep -n "API_BASE" frontend/src/lib/api.ts | head -2
78:const API_BASE =
79:  process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:8000";

One declaration, using the renamed variable. The Frontend lint + typecheck job on this PR is the real verification.

Checklist

  • Tests pass locally (make test)
  • Lint passes (make lint)
  • If schema changed (StyleProfile / Passport) → bumped version + updated docs/
  • If new env var → added to .env.example
  • If new/changed endpoint → updated docs/api_contract.yaml
  • Documentation in the relevant README.md updated
  • At least one teammate reviewed

Merge this before anything else. With the deadline on Jul 31 and a live demo to rehearse, every hour main spends unbuildable is an hour nobody can deploy, screenshot or record.

… build

Merging #115 (WO-01, the NEXT_PUBLIC_API_URL -> NEXT_PUBLIC_API_BASE_URL
rename) and #119 (WO-11) kept both sides of the collision in api.ts, so main
declares const API_BASE twice. tsc reports TS2451 twice, `next build` fails
outright, and three test files no longer parse. The frontend cannot be built
or deployed from main.

Keep the renamed variable, which is the whole point of WO-01: the deployed
frontend was talking to localhost because it read the wrong env var name.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
author-ai Ready Ready Preview, Comment Jul 28, 2026 5:23pm

@sergi-torres
sergi-torres merged commit 95b6cd8 into main Jul 28, 2026
8 checks passed
@sergi-torres
sergi-torres deleted the fix/duplicate-api-base branch July 28, 2026 17:27
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