Skip to content

Add plain HTML frontend served by the API at /app - #40

Closed
amar-python wants to merge 1 commit into
mainfrom
web-plain-frontend
Closed

amar-python wants to merge 1 commit into
mainfrom
web-plain-frontend

Conversation

@amar-python

Copy link
Copy Markdown
Owner

Adds web/index.html, a single-file frontend with no build step, and serves it from the API at /app. The existing csv-table-hub-main/ frontend is unchanged.

What the page does (all through the existing API)

  • Import: drop several CSVs; preview via POST /api/csv/preview; choose column types; load into a new table or a T&E table (preselects the teTableMatch suggestion); skip or replace files already imported (overwrite)
  • Upload report: rows imported, failed and duplicate, row errors, processing log, copy invalid rows or the report as CSV, replace or retry
  • Migrated files: GET /api/csv/files with S.No. and pagination; row viewer for new tables (/tables/{name}/rows); delete, with a clear message when API_ALLOW_DESTRUCTIVE is off
  • T&E tables: GET /api/te/tables (deployed or not, approximate row counts)
  • Deletion log: GET /api/audit/log, paged
  • Header: database health badge from /api/health; an API key button that sends X-API-Key; light/dark theme

Backend change: api/main.py mounts web/ at /app with StaticFiles when the folder exists. The page is same-origin, so CORS_ORIGINS doesn't change. The mount is skipped if web/ isn't shipped.

Tests

  • New unit test: /app/ serves the page
  • scripts/test_report.py --markers "unit or regression or security or snapshot" --strict: PASS
  • make lint and make health: pass
  • tests/test_api_integration.py and tests/test_te_loader_integration.py: pass against PostgreSQL 16
  • Browser end-to-end against that database with API_KEY set: missing-key message, key entry, 5-file import (new tables, an empty file, one T&E file with a rejected row), duplicate then replace, row viewer, delete, deletion log, T&E page, dark theme and 400px width; no console errors

Try it

cd "<path to PostgreDataMigrationAppWithCSVLoader>"
.\scripts\start-api.ps1
Start-Process "http://localhost:8000/app"

🤖 Generated with Claude Code

https://claude.ai/code/session_011kQy94A5cnQL9N86Q6Tkhi


Generated by Claude Code

web/index.html is a single-file, build-free frontend for the FastAPI
backend: import with server-side preview, column types, new-table or
T&E-table mode and skip/replace duplicates; migrated files with a row
viewer and delete; T&E table row counts; and the deletion log. It sends
X-API-Key when a key is set in the page.

api/main.py mounts web/ at /app when the folder exists, so the page is
same-origin and needs no CORS change. Adds a unit test for /app and a
README section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011kQy94A5cnQL9N86Q6Tkhi

Copy link
Copy Markdown
Owner Author

integration (postgres service) is red, but not because of this PR.

main has failed the same way since 269ffe2 (8 Sep), with the same 19 tests: tests/test_api_coverage.py T&E tests and tests/test_te_loader_integration.py. They all fail with T&E table "organisations" not found in schema te_dev.

Cause: the job sets PGDATABASE: postgres, so the API under test connects to the postgres database. deploy_all.sh dev creates the te_dev schema in te_mgmt_dev, so the API never finds the T&E tables. I reproduced it locally on PostgreSQL 16:

  • PGDATABASE=postgres: those tests fail
  • PGDATABASE=te_mgmt_dev: they pass, and the full scripts/test_report.py --strict run passes (0 failed, 0 skipped)

Proposed fix (.github/workflows/quality-gate.yml, outside this PR's scope):

      - name: Full test suite — final result with skip accounting
        env:
          PGDATABASE: te_mgmt_dev
        run: python3 scripts/test_report.py --strict

No fix PR exists yet. I haven't re-run the job, because main already shows the same deterministic failure. The other two checks on this PR pass.


Generated by Claude Code

Copy link
Copy Markdown
Owner Author

Closing per ART decision 9 (approved 2026-10-26, DECISIONS/2026-10-26-art-milestone-0.md). ART v2 sets React/TypeScript as the frontend constraint, so this plain-HTML frontend is out of scope. The branch web-plain-frontend is left in place as reference.


Generated by Claude Code

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.

2 participants