Repository navigation
fix(frontend): plumb VITE_BUG_REPORTING_ENABLED / VITE_BUG_INTAKE_URL as prod build args (#1489) - #1492
Conversation
… as prod build args HelpChatWidget (#1116) reads two build-time knobs to disable in-app bug reporting or repoint it off the hosted intake, but the prod build path never passed them. Vite inlines import.meta.env.* at build time, so an operator setting VITE_BUG_REPORTING_ENABLED=false in .env had no effect — every prod build shipped with reporting on, pointed at intake.abilityai.dev, with no supported off switch. Copy the existing VITE_API_URL plumbing verbatim: two ARG+ENV in Dockerfile.prod (before npm run build), two build.args in docker-compose.prod.yml, keeping compose default == ARG default == code default so an unset .env byte-reproduces today. Document both in .env.example with prod-only, no-secrets, and CSP-caveat warnings. Repoint path is CSP-blocked (connect-src hard-codes the intake host in both security-headers.conf and vite.config.js); disable path works end-to-end. CSP parameterization for a working self-host repoint is an umbrella #1485 follow-up. Fixes #1489 Refs #1485 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pure static tests (no Docker, no backend — mirroring
test_858_dockerfile_unbuffered.py) over the prod frontend build path:
Dockerfile.prod declares both ARG + ENV ${VAR} pass-throughs before
`RUN npm run build`, docker-compose.prod.yml forwards both via
${VAR:-default} build.args, and the three defaulting layers agree
(Dockerfile ARG == compose default == HelpChatWidget code default) so an
unset .env byte-reproduces today's behavior. Scoped to #1489; the general
VITE_* parity guard is a deferred #1485 follow-up.
Refs #1489, #1485
Co-Authored-By: Claude Opus 4.8 <[email protected]>
#1489) Update the in-app-bug-reporting flow's Config-knobs bullet to record that the #1116 build-time knobs are Vite build args (not runtime env) and are now plumbed through docker/frontend/Dockerfile.prod + docker-compose.prod.yml with three-layer default agreement; expand the CSP bullet with the repoint caveat. Add a Recent Updates index row. Refs #1489, #1485 Co-Authored-By: Claude Opus 4.8 <[email protected]>
45acf10 to
43badbe
Compare
|
Heads-up @vybe: rebased onto latest Rather than block this frontend PR on it, I folded in the fix as commit |
…split with auth.py Pre-existing dev-baseline failure (8 fixture errors, deterministic in isolation), surfaced here because #1492's lint fix unmasks it in CI ordering. routers/auth.py grew its imports over time but the fake-module stubs in this test drifted: - `from dependencies import (...)` gained get_current_user / is_token_revoked / oauth2_scheme / revoke_token_jti via the #187 JWT-revocation/logout work; the stub defined only authenticate_user + create_access_token. - `from models import User` (a Depends(get_current_user) param annotation on the #187 logout endpoint) was added; the models stub defined only Token. `from dependencies import (...)` / `from models import (...)` resolve every name at import time, so a missing stub attr errors the whole file at fixture setup. Add the four dependencies stubs + the User stub (bare lambdas / a bare class — none are exercised by the rate-limit paths under test). 8 errors -> 8 passed. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…wn (#1490) PR #1490 (fork-to-own) merged tests/unit/test_fork_to_own.py with three raw `del sys.modules['services.*']` and no baseline entry, reddening the sys.modules pollution lint on dev's tip — every open PR inherits it via the merge-ref. This PR rebased onto that tip, so record the three pre-existing violations in the lint baseline to restore green. Deliberately a baseline entry, NOT a code change: an autouse snapshot/restore fixture (the lint's other sanctioned remedy) was tried first but re-adds modules a test deliberately deletes, which broke test_owner_mismatch_forbidden under full-suite ordering (regression-diff flagged it as a new HEAD failure). Baselining touches zero test behavior and is the lint's explicit escape hatch for accepted pre-existing debt. Properly draining these three to monkeypatch.delitem is a #1490-owned follow-up for that file's author. Co-Authored-By: Claude Opus 4.8 <[email protected]>
43badbe to
6fd160e
Compare
|
Update on the folded dev-hygiene fixes (revised from my earlier comment) @vybe @dolho: 1. sys.modules lint (from #1490). I first tried the autouse snapshot/restore fixture on 2. Second pre-existing dev failure unmasked. With the lint no longer gating ahead of pytest, Both are pre-existing on |
vybe
left a comment
There was a problem hiding this comment.
Validated via /validate-pr: closing keyword ✅ (Fixes #1489), targets dev ✅, focused 8-file diff, security greps clean, feature-flow + .env.example updated, cross-layer default-agreement guard is exactly the right invariant. Ran the 15 touched unit tests locally — all pass (required checks don't run unit tests). Folded dev-hygiene fixes (sys.modules baseline for #1490 debt, auth stub sync) are justified — dev tip is red without them.
Summary
Plumbs the two advertised in-app bug-reporting build knobs —
VITE_BUG_REPORTING_ENABLEDandVITE_BUG_INTAKE_URL— through the production frontend build path so they actually reach the shipped image. Before this,HelpChatWidget.vue(#1116) read both viaimport.meta.env, butdocker/frontend/Dockerfile.proddeclared onlyVITE_API_URLanddocker-compose.prod.ymlforwarded only that — soVITE_BUG_REPORTING_ENABLED=falsein.envwas inert and every standard prod build shipped with reporting on, pointed at the hosted intake, with no supported off switch.Same packaging-gap class as #1039 / #1056, on the frontend build-arg surface instead of the compose
environment:surface (Vite statically inlinesimport.meta.env.*atnpm run build, so the lever must arrive as anARG/ENVbuild arg, not runtime env).Fixes #1489 · finding #4 of umbrella #1485.
Changes
docker/frontend/Dockerfile.prod—ARG VITE_BUG_REPORTING_ENABLED+ARG VITE_BUG_INTAKE_URL(with code-default values), exported asENVbeforeRUN npm run build.docker-compose.prod.yml— frontendbuild.argsforwards both with${VAR:-default}fallbacks..env.example— both documented, with a "VITE_* is world-readable, never a secret" warning and the CSP caveat.tests/unit/test_1489_vite_bug_build_args.py— 7 static guards over every layer, plus the load-bearing invariant that Dockerfile ARG default == compose${VAR:-…}==HelpChatWidget.vuecode default, so an unset.envbyte-reproduces today's behavior.in-app-bug-reporting.md+ index row updated.Scope / boundaries
VITE_BUG_INTAKE_URL→ self-hosted host) is still CSP-blocked because the intake host is hard-coded insecurity-headers.conf+vite.config.js; parameterizing the CSP from the build arg is a deferred Config Validation: 4 critical config issues found (2026-07-06) #1485 follow-up. The AC asks for the disable lever, which is delivered..envnatively).Relation to umbrella #1485
This closes finding #4 only. The other three findings (
OPERATOR_INTAKE_ENABLED/DO_NOT_TRACK,DISPATCH_BREAKER_ENABLED,PUBLIC_ACCESS_REQUESTS_ENABLED— all on the backend composeenvironment:surface) are closed by the sibling backend-trio PR. This frontend PR is intentionally split out because the build-arg surface is a distinct fix shape.Testing
tests/unit/test_1489_vite_bug_build_args.py— 7 passed locally.https://intake.abilityai.dev/v1/report-bugandtrue.🤖 Generated with Claude Code
Folded-in dev test-hygiene fixes (pre-existing, not part of #1489)
Rebased onto dev's tip, which is currently red from two pre-existing failures unrelated to the VITE build-arg change. Folded their fixes here to keep dev green through the rebase:
test_fork_to_own.pymerged with 3 rawdel sys.modules[...]and no baseline entry. Recorded them intests/lint_sys_modules_baseline.txt(the lint's sanctioned escape hatch; zero test-behavior change). A snapshot/restore fixture was tried first but broketest_owner_mismatch_forbiddenunder full-suite ordering — reverted. Propermonkeypatch.delitemdrain is a feat(create): fork-to-own agent creation + brain-orb git-sync exemptions (trinity-enterprise#93, #76) #1490-owned follow-up.test_login_rate_limit_split.pystub drift — its fakedependencies/modelsmodule stubs drifted behindrouters/auth.py's imports (SEC: JWT Tokens Not Invalidated on Logout — no revocation mechanism #187 JWT-revocation added 4dependenciesnames +models.User), erroring all 8 tests at fixture setup. Synced the stubs → 8 errors → 8 passed. No open issue existed; captured in the commit.