Skip to content

Free-tier LLM dev-mode fixes + re-enable e2e product-flow specs#4

Merged
Archibald312 merged 4 commits into
mainfrom
fix/free-tier-llm-dev-mode
May 15, 2026
Merged

Free-tier LLM dev-mode fixes + re-enable e2e product-flow specs#4
Archibald312 merged 4 commits into
mainfrom
fix/free-tier-llm-dev-mode

Conversation

@Archibald312
Copy link
Copy Markdown
Owner

Summary

  • Make free-tier Gemini usable from npm run dev (previously the guard rejected before assertFreeTierAllowed could even check the allowlist) and surface clearer errors when it refuses.
  • Re-enable all four Playwright product-flow specs (projects, documents, chat, tabular) that had been wrapped in test.describe.skip() because selectors drifted from the current UI.

The e2e work is testid-only on the frontend (no behavior changes) — each load-bearing control in the four flows got a data-testid, and the specs were rewritten against the current architecture. Full suite is 13/13 green locally in ~1.4 min.

What changed in the e2e re-enablement

  • projects — rename now goes through the row's kebab menu (clicking the row navigates into the project); create waits for the /projects/{id} redirect before asserting.
  • documents — upload routes through AddDocumentsModal (file input is hidden inside the modal, only mounted when open); spec opens the modal, sets files, waits for Confirm to re-enable, clicks Confirm.
  • chat — navigates through the project's assistant tab and uses the empty-state "+ Create New" to spawn a chat, which redirects to the chat detail page where ChatInput actually lives. Citation chips render as numeric <button>s (not literal [1]), so a citation-marker testid replaces the old regex.
  • tabular — when invoked in project mode, AddNewTRModal auto-selects ready docs; uses the toolbar "Add Columns" button since the empty-state only renders with zero docs.

Setup gaps surfaced during this work

Documented in e2e/README.md:

  • Test Supabase project needs backend/schema.sql applied (existing step, but its absence was the first wall I hit).
  • backend/.env.test needs real Cloudflare R2 credentials (R2_ENDPOINT_URL, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_BUCKET_NAME) — the README previously only documented Supabase + Gemini. Free-tier R2 is sufficient for e2e usage.
  • The Gemini key in .env.test may expire — rotate via https://aistudio.google.com/app/apikey when chat/tabular start failing with API_KEY_INVALID.

TECHDEBT.md is updated: the high-priority "Re-enable skipped Playwright specs" item is fully closed, with each spec moved to the Done section.

Test plan

  • npm run test:e2e — 13/13 green locally
  • CI green on this PR
  • Spot-check the diff for any non-testid frontend changes that shouldn't be there (there shouldn't be — search for additions that don't contain data-testid or aria-label)

🤖 Generated with Claude Code

Archibald312 and others added 4 commits May 14, 2026 19:15
- freeTierGuard: skip allowlist check when no documents are attached —
  document-free calls (e.g. column prompt generation) carry no
  customer-data risk so blocking them on a missing allowlist was wrong
- tabular route: surface the real exception message in the 502 response
  instead of swallowing it in a bare catch, making LLM failures debuggable
- documents/projects upload routes: expand AggregateError to show all
  sub-errors and log the full exception server-side

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The early return for no-document calls must come after the allowlist
presence check, not before. Missing FREE_TIER_FIXTURE_ALLOWLIST should
still throw even when no documents are attached (config validation), but
once the allowlist is confirmed present, doc-free calls can pass through.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The four product-flow Playwright specs were wrapped in test.describe.skip()
because their selectors had drifted from the current UI. This commit adds
data-testid attributes to the load-bearing controls in each flow and rewrites
the specs against the current architecture.

Frontend changes are testid-only (no behavior changes) on:
- ProjectsOverview, RowActions, NewProjectModal — projects table
- ProjectPage, AddDocumentsModal — document upload and row actions
- ChatInput, AssistantMessage, ProjectAssistantTab — chat flow
- AddNewTRModal, AddColumnModal, TabularReviewView, TRTable, TabularCell,
  ProjectReviewsTab — tabular review flow

Spec rewrites:
- projects: rename now uses the row's kebab menu (clicking the row navigates
  into the project); create waits for /projects/{id} redirect.
- documents: upload now goes through AddDocumentsModal (file input is hidden
  inside the modal, only mounted when open).
- chat: navigates through the project's assistant tab and clicks the
  empty-state to create a chat, which redirects to the chat detail page
  where ChatInput lives. Citation chips render as numeric buttons (not [1]).
- tabular: when invoked in project mode, AddNewTRModal auto-selects ready
  docs; uses the toolbar Add Columns button since the empty-state only
  shows with zero docs.

Setup gaps surfaced during this work, documented in e2e/README.md:
- Test Supabase project needs backend/schema.sql applied.
- backend/.env.test needs real R2 credentials (R2_ENDPOINT_URL,
  R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, R2_BUCKET_NAME) — README
  previously only documented Supabase + Gemini.

Full suite: 13/13 green locally in ~1.4 min.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The e2e job built backend/.env.test from secrets but didn't include any
R2 vars, so document uploads in the documents/chat/tabular specs hit
"Resolved credential object is not valid" inside the AWS SDK. Add four
new required secrets and wire them through the heredoc.

Local runs were green because the developer's hand-maintained
backend/.env.test already had them.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@Archibald312 Archibald312 merged commit febebea into main May 15, 2026
7 of 8 checks passed
@Archibald312 Archibald312 deleted the fix/free-tier-llm-dev-mode branch May 15, 2026 14:16
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