Skip to content

Task 019: Consolidate dev URL resolution helpers - #18

Merged
Igloczek merged 3 commits into
masterfrom
task/019-consolidate-dev-url-helpers
Jun 30, 2026
Merged

Igloczek merged 3 commits into
masterfrom
task/019-consolidate-dev-url-helpers

Conversation

@Igloczek

@Igloczek Igloczek commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator

Implements tasks/019-consolidate-dev-url-helpers.md from the ponytail audit backlog.

Goal

One function for resolving dev backend base URL instead of duplicated logic in two files.

Scope

  • Merge getResBaseURL() (src/util-frontend.ts) and getDevApiBaseURL() / fetchDevApi() (src/util/dev-api-base.ts) into a single module.
  • Preserve Codespaces hostname, localStorage.dev, and port behavior.
  • Delete redundant file or reduce it to re-exports during migration.

Acceptance criteria

  • Single source of truth for dev API/asset base URL (one exported function).
  • src/util/dev-api-base.ts deleted or ≤10 LOC of re-exports.
  • Dev mode (bun run dev) still loads API and static assets correctly.
  • bun run lint passes.
  • bun run build:frontend succeeds.

Depends on

Nothing.

Verification

bun run lint
bun run build:frontend
rg "getResBaseURL|getDevApiBaseURL|fetchDevApi" src

Audit reference

Finding #26 — overlapping dev URL resolution.

@Igloczek

Copy link
Copy Markdown
Collaborator Author

/ponytail-review

  • Before: getResBaseURL() in util-frontend.ts and resolveDevApiBaseURL() in dev-api-base.ts duplicated the same env/localStorage/Codespaces branching; socket.ts repeated it a third time.
  • After: One cached getDevBaseURL() used for API fetches, static assets, public pages, and WebSocket connection URL.
  • Risk: Low — logic is unchanged; return type unified to empty string (falsy) instead of mixing "" and null.

11 files changed, 99 insertions(+), 138 deletions(-)

@Igloczek
Igloczek force-pushed the task/019-consolidate-dev-url-helpers branch from 1cb8e74 to 21c8961 Compare June 30, 2026 12:03
Igloczek added 3 commits June 30, 2026 14:24
Merge duplicated getResBaseURL() and getDevApiBaseURL() logic into a
single cached helper in src/util/dev-base-url.ts. Update consumers to
import the canonical function and reduce dev-api-base.ts to re-exports.

Task 019 — audit finding #26.
@Igloczek
Igloczek force-pushed the task/019-consolidate-dev-url-helpers branch from 21c8961 to 75abb2b Compare June 30, 2026 12:24
@Igloczek
Igloczek merged commit 993124d into master Jun 30, 2026
1 check passed
@Igloczek
Igloczek deleted the task/019-consolidate-dev-url-helpers branch June 30, 2026 12:58
Igloczek added a commit that referenced this pull request Aug 8, 2026
…pers

Task 019: Consolidate dev URL resolution helpers
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