Opened by bitbaum/fleet .github/workflows/internal-currency.yml.
The fleet's own packages ship features in MINORS, so
version-currency.mjs — which judges by major — reports nothing while
consumers drift. This is the instrument that sees it, and it opens
the fix rather than reporting it.
If this PR is red, that is the useful outcome: it names a repo that
cannot take the new version, which nothing else in the fleet would
have told us.
Co-authored-by: fleet-reconciler <fleet@bitbaum.invalid>
* chore(repo): drop ralph.sh residue, ignore the generated Prisma client at the root
ralph.sh was byte-identical to reparaturbonus-zh/ralph.sh ("Ralph Loop for
Revamp-Hirn") and PROMPT.md was its blank task template; nothing in CI, docs
or scripts referenced either.
backend/generated/ is produced by `prisma generate` (typecheck, build and
Dockerfile.backend all run it) and was already ignored by backend/.gitignore,
so it was never committed — but tools that only read the root ignore file
(the fleet jscpd sweep) counted its ~1,300 generated lines as duplicated
source and reported the repo at 4.4%. Listing it at the root too makes those
sweeps see what git sees.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor(backend): log through one pino instance, lint console.log out
The backend had pino-http for requests and bare console.log everywhere else
(index.js, jobs/, services/websocket.js — 26 lines). lib/logger.js now owns
the pino-http middleware and exposes its logger, so application logs and
request logs share level, destination and redaction. pino stays an indirect
dependency: pnpm does not hoist pino-http's copy, and a second pino would be
a second place to configure.
The backend had no linter at all. eslint.config.mjs enables exactly one rule,
no-console (warn/error allowed), so this cannot drift back; the root `lint`
now runs both halves, which is what `verify` and CI call.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor(ingest): one shared kit for the image/video/audio/database ingestion components and the /ingest pages
The four data-ingestion components each carried their own copy of the
upload state machine (idle → uploading → processing → complete/error), the
file picker + drag-drop + object-URL preview, the auth header, the response
reader, the drop zone, progress bar, error banner, result card and submit
button. The five /ingest/<kind> pages likewise repeated the page frame, the
"Recent …" panel with its loading/error/empty states, the status badge and
the detail panel, plus a private copy of formatFileSize/formatDate.
Now there is one of each:
- components/data-ingestion/shared.tsx — useIngestionUpload, useFilePreview,
authHeaders, readIngestionResponse and the shared markup pieces
- components/data-ingestion/icons.tsx — the inline SVG paths as data, one
OutlineIcon/SpinnerIcon component
- ingest/shared.tsx — IngestPage, RecentPanel, StatusBadge, DetailPanel and
the useRecentSources fetch
- lib/format.ts — formatFileSize/formatDuration/formatDate, with a test
Markup and copy are unchanged; the components render exactly what they did.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor(forms): type the stored form structure once, drop the dead quick-field builder
`/api/v1/forms` returned `schema as any` and every consumer re-derived its
shape. `StoredFormStructure` / `FormListRow` in types/saved-form.ts are now
the one description of what the builder writes into the Json column, used by
the route, SavedFormsLibrary, ModernFormBuilderLayout and the builder page.
DynamicForm loses its unused `addQuickField` duplicate of FormFieldBuilder's
own field factory and an unused `handleCreateGroup` argument; the autosave
draft effect reads the current form through a ref instead of listing the
form as a dependency (which is what the exhaustive-deps warning was pointing
at — re-running it per keystroke would clobber the user's input).
SavedFormsLibrary wraps fetchForms in useCallback so the token effect is
honest about what it depends on; its `handleLoginSuccess` was never wired to
anything. Rendered output is unchanged.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
* refactor(frontend): fix every ESLint warning, gate lint at --max-warnings 0, ban console.log
The frontend lint config had downgraded no-unused-vars, no-explicit-any,
ban-ts-comment, exhaustive-deps, no-unescaped-entities and no-img-element to
"warn" ("temporarily, for build success") and `eslint .` ran with no
warning cap, so 152 warnings sat there unread. Every one is fixed at the
source rather than silenced:
- no-explicit-any: real types — jose's private `email` claim, the next-auth
Session/User augmentation (`session.user.id` is set by the session
callback), OpenAI.APIError for the vision route's status checks, typed
event/data shapes elsewhere. The ambient `declare module '@dnd-kit/*'`
stub is gone: `@dnd-kit/utilities` is now a declared dependency so its own
types load.
- no-unused-vars: unused imports/params/state dropped. Seven components and
one hook turned out to be rendered nowhere (BuilderToolbar,
FormBuilderQuickStart, FormCreationHub, ModernSidebarStore, MultiStepForm,
MultiStepFormBuilderStore, QuickActions, useApiRequest) — deleted, and the
README paragraph that described the *Store wrappers updated.
- exhaustive-deps: callbacks memoised so the dependency arrays are truthful.
- ban-ts-comment / no-unescaped-entities: the comments were covering typed
code; the entities are escaped.
- The 5 console.log calls in frontend/src (debug leftovers in components
and services) are removed; console.warn/error stay. `no-console` (allow
warn/error) is now an error so they cannot come back, with scripts/**
exempt because printing is their job. (Of the 82 console.log in the repo,
26 were the backend — routed through pino in the previous commit — and
the rest are operator scripts, which print by design.)
The downgrade block is gone, so upstream next/core-web-vitals defaults
apply, and `lint` runs with `--max-warnings 0`: a warning fails the gate.
152 → 0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KAn51JHFcTrPeCjZDGXM8
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(ai): complete() owns the request, the per-vendor dedupe goes, and the tests can finally run
Three things, and the third is why the first two were invisible.
1. THE 429 BODY WAS READ AND DISCARDED. The hand-rolled `attempt`
ended a failed request at
`chat failed (${res.status}): ${detail.slice(0, 200)}` — fetched,
truncated, and read by nothing. The three kinds of 429 share that
status code and want opposite responses:
capacity — a burst; demoting is right.
daily — the vendor's whole org-wide budget is spent; every other
model there is already dead.
size — one request exceeded the per-minute allowance alone; the
next model down has a SMALLER ceiling, so demoting is
strictly worse.
The old `fetch` also had NO deadline, so a vendor that accepted the
connection and never answered held an ingestion job open forever and
the fallback beneath it was never reached.
2. THE PER-VENDOR DEDUPE IS GONE, and that is the point rather than a
tidy-up. It kept one link per vendor because "a second model at the
same vendor draws on the same daily budget". True of the DAILY case
and only that case — and it discarded the retry that rescues the two
failures that actually keep happening: a retired model id, and a model
that is momentarily busy while the vendor is fine. complete() makes
the distinction per failure KIND instead of up front, so a daily 429
still condemns the vendor (the dedupe's real benefit, kept) while a
404 demotes within it. Strictly more chain, not less.
3. NOTHING IN backend/ COULD RUN A TEST. `backend/package.json`'s script
was `echo "Error: no test specified" && exit 1`, and the root `test`
only ever ran the frontend. backend/utils/responseHandlers.test.js has
been sitting there, committed, executed by nothing — its own docstring
says so. So a chain change here would have shipped with no coverage,
and any test I added would have joined it in the dark.
Wired: backend `test` → `vitest run`, root `test` → frontend AND
backend. 71 frontend + 20 backend, ten of those twenty running for the
first time.
The 10 new tests drive every failure through a real response BODY,
because the body is the only thing that separates the three 429s. The
SIZE one asserts exactly one request was made — asserting that it threw
would not show the walk STOPPED, since everything failing throws too.
Mocks are real Response objects built per call: one body reads once, so
a shared instance makes link two fail with "Body has already been read",
a fake failure in front of the real one.
verify green.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHDLTKGirKU7He8q2YR2y4
* ci: install backend deps, or the test script I just wired makes the gate red
The previous commit pointed root `test` at both halves. CI installs only
`frontend`, so `pnpm run verify` would have reached `test:backend` and
died with "Command vitest not found" — a wired script and a red gate,
which is worse than the gate that was simply absent.
Adds an `Install (backend)` step and caches on both lockfiles. Verified
`pnpm install --frozen-lockfile` succeeds in backend/ against the
committed lockfile, which is what CI runs.
Also corrects the comment above `Verify`. It described the gate as
"lint + typecheck + build"; it is format + lint + typecheck + test +
build, and `test` now covers both halves. That comment is what a reader
trusts about what "verified" means in this repo, so leaving it describing
the old bundle would be its own quiet lie.
The job id stays `verify-frontend` even though it is now a misnomer:
renaming a job renames the status check, and a required check that
disappears blocks merges rather than failing loudly.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHDLTKGirKU7He8q2YR2y4
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
pnpm audit --fix override in backend/ and frontend/; all alerts were
transitive (lockfile-only). Remaining: extract-zip (high, via puppeteer)
has NO patched version upstream — it unzips the Chrome archive puppeteer
downloads from Google, accepted residual until upstream patches.
Smoke-verified the risky major jumps (uuid 8->11 under bull, lodash
4.18) load and run, since backend has no test suite. Also drops the
stale ai-kit codeload allowBuilds entry left behind by #248.
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
- npm/npx commands -> pnpm across all docs (packageManager pnpm@11.25.0); dropped npm-only --legacy-peer-deps and the `--` arg separator
- package-lock.json -> pnpm-lock.yaml in the preflight description
- Next.js 15 -> 16, Node 18+ -> 20+ (.nvmrc pins 24) wherever stated
- Jest "planned" -> Vitest active (frontend + backend, one runner); Playwright E2E documented as deferred from CI
- DEPLOYMENT.md CI/CD section now describes the real workflows: ci.yml verify gate, auto-merge sweep, deploy.yml -> selfhost-deploy to the Hetzner box (bitbaum, behind Caddy)
- README structure block matches the real layout (frontend/ + backend/, no apps/ or packages/); backend port 5000 -> 5001
- docs/README.md index renamed Formular -> DataCat and now links only documents that exist; erfassung README's never-written guides marked planned
- clone URLs your-org -> bitbaum/datacat; cd formular -> cd datacat
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
llm-analysis.js and aiAnalysisService.js each constructed their own
OpenAI client, hardcoded model: 'gpt-4', and threw/skipped outright
whenever OPENAI_API_KEY was unset — a single vendor, single model, with
no recovery path. The moment OpenAI has a billing hiccup, an outage, or
retires gpt-4, every text-analysis feature in this app goes dead until
someone notices and redeploys.
backend/lib/aiChain.js gives both services a real chain via ai-kit
(Groq -> OpenRouter free tier, same package already adopted fleet-wide
for this exact failure mode), plus a health tracker exposed
informationally on /health (never gates the endpoint's status — a dead
vendor key can't be fixed by a restart).
Vision/image analysis (imageIngestionService.js, video frame analysis,
openaiVisionService.ts) and Whisper audio transcription stay on OpenAI
directly: ai-kit's free chain carries no vision- or audio-capable free
models, so forcing those onto it would silently degrade output quality
rather than provide a real fallback. Documented as a known limitation
in .claude/CLAUDE.md's env var list.
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
* chore: add a formatter, matching the style this repo already writes
singleQuote=true was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.
Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* style: format with prettier (199 files)
Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore: teach git blame to skip the reformat
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(ci): put prettier where CI actually installs
The formatter was added to the root package.json, but CI installs with
working-directory: frontend and then runs npm run verify at the root, so root
devDependencies are never installed at all. format:check died with
'prettier: not found' before checking a single file.
Root now delegates into frontend the way every other root script already does,
and prettier is a devDependency of frontend, whose lockfile CI installs.
frontend also needs its own .prettierignore: prettier resolves that file
relative to the working directory, so the root one stopped applying the moment
the command ran from frontend/ — which is how README.md and Playwright output
ended up being checked.
* fix(ci): do not format contentlayer's generated output
format:check ran green locally and failed in CI on files that do not exist
locally: CI builds contentlayer before verify, so .contentlayer/generated is
present by the time prettier looks. One generated module imports with
assert { type: 'json' }, which prettier's parser rejects outright.
A local --check cannot see build output, so generated directories have to be
ignored by name rather than discovered.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
basic-ftp 5.1.0 → 5.3.1, closing:
#44 critical — path traversal in downloadToDir()
#96 high — unbounded multiline control response buffering DoS
#89 high — incomplete CRLF injection protection (arbitrary FTP command exec)
#91 high — unbounded memory consumption in Client.list()
basic-ftp is a deep transitive dependency (puppeteer -> @puppeteer/browsers
-> proxy-agent -> pac-proxy-agent -> get-uri -> basic-ftp), never imported
directly in this codebase — it's used only if get-uri resolves a proxy
auto-config file over an ftp:// URL, which this backend does not configure.
Low real-world exposure, but the fix costs nothing: get-uri's own
package.json already accepts ^5.0.2, so `npm update basic-ftp` resolves to
5.3.1 (the latest 5.x) within the range the parent package already permits —
no new direct dependency, no package.json change, no code touched.
Verified: get-uri/proxy-agent/puppeteer all require() cleanly after the bump.
NOT fixed here: `npm audit fix` for the remaining ~16 open alerts
(extract-zip, jws, lodash, minimatch, path-to-regexp, @trpc/server,
picomatch, uuid, and three frontend/@opentelemetry packages) is blocked by
a pre-existing, unrelated peer-dependency conflict — this repo runs zod v4
but openai@5.10.2 peer-requires zod v3, so `npm audit fix` refuses to
resolve anything without --force. Forcing through that risks silently
breaking whatever depends on openai's zod-validated schemas, and isn't safe
to do blind. Left as a separate, flagged item rather than forced through.
Claude-Session: https://claude.ai/code/session_01Y9rKLxddothnXEtY6KDziN
Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
* test: add the hermetic unit gate, and stop an empty env var blanking the brand
`verify` was lint + typecheck + build. The only suite in the repo was
`npx playwright test` — e2e, needing browsers and a running server, so it can
only run somewhere expensive enough that it rarely does. backend's `test` was
`echo "Error: no test specified" && exit 1`. There was no hermetic gate at all,
which is why the fleet audit lists this repo as needing a unit suite rather
than a verify edit.
Adds vitest (one runner, both packages), 43 tests, and puts `test` inside
`verify`. Script names now match the rest of the fleet: `test` is the hermetic
unit suite, `test:e2e*` is Playwright. Nothing live called `npm run test` — CI
calls `npm run verify`, and the only other reference is in
deploy.yml.disabled.
ONE REAL BUG FIXED, in the white-label merge:
Object.entries(envBranding).filter(([_, value]) => value !== undefined)
An UNSET env var is `undefined`, but a var that is present-and-empty is `''`.
`NEXT_PUBLIC_BRAND_NAME=` is an ordinary line to find in a .env, and that empty
string beat the default — blanking the product name, or the logo path, or the
domain, with nothing to say why. The filter now also rejects empty and
whitespace-only values. This matters here more than in most repos: DataCat
ships as TalentFlow, HealthIntake and LegalIntake, so the branding merge IS the
product's identity.
What the tests hold still:
- defaults are complete, and the theme is one the type allows — a blank
default reaches production as an empty <title> or a broken logo src
- a real env value overrides; an empty or whitespace one does not
- the merged config never grows a key the defaults do not declare
- every preset sets only keys BrandingConfig declares. A preset writing
`primary_color` next to a config reading `primaryColor` renders the default
and reports success — the expensive drift in a config layer is a key that
looks applied and is not.
- every preset merges to a complete config with valid hex colours
- responseHandlers keeps a uniform envelope: every handler sets a boolean
`success`, since a client that branches on it must never meet a response
without it
- `error()` NEVER attaches `details` in production. That is the leak guard —
details carry stack traces and driver messages — and it is one `if` away
from being refactored into always-on.
Negative-tested rather than assumed. Restoring the old `!== undefined` filter
turns exactly the two empty-value tests red; making `details` unconditional
turns exactly the production-leak test red.
Verified locally: lint clean, 43/43 tests. `typecheck` and `build` were NOT run
locally — `contentlayer build` fails on this Node with ERR_INVALID_ARG_TYPE,
the prerequisite PR #191 documents. CI runs the full `verify`, and this change
does not touch the typecheck or build paths.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(test): declare vitest in frontend so the new test typechecks
CI caught what my local run could not: `npm run typecheck` is
`cd frontend && npx tsc --noEmit`, so it typechecks frontend/src — including
the new branding.test.ts — but vitest was only installed at the repo root.
tsc could not resolve the module, and the four `it.each` callbacks then fell
back to implicit `any`.
Declared in frontend/package.json rather than excluded from tsconfig. Excluding
test files would have made the error go away while leaving the tests
un-typechecked, and a test that does not compile is not a gate.
This repo is not npm workspaces — frontend and backend install separately — so
a package that imports vitest has to declare it. The root copy stays because
that is where the runner is invoked from.
Verified: full `npm run verify` now passes locally end to end — lint clean,
tsc 0 errors, 43/43 tests, build clean. (Contentlayer generated correctly this
time via frontend's postinstall, which is what had blocked the local typecheck
earlier.)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(test): run vitest from frontend, the only place CI installs
Second CI failure on this branch, and my first fix was aimed at the wrong
layer. Exit code 127 — command not found — after lint and typecheck passed.
The cause is in .github/workflows/ci.yml: it installs with
`working-directory: frontend`. The ROOT node_modules never exists in CI. So a
root-installed vitest is not a dependency CI has, and `vitest run` from the
repo root could only ever fail there while passing on my machine, where I had
run `npm install` at the root by hand.
Moving the config into frontend/ rather than adding a root install step: the
runner has to launch from the one directory that has a node_modules, and that
is a fact about this repo's pipeline, not a preference. The config still sets
`root` back to the repo, because the suite spans frontend AND backend.
Root `vitest` devDependency removed for the same reason — declaring a package
that is never installed is a claim the repo cannot back.
Reproduced properly this time: `rm -rf node_modules` at the root, then
`npm run test` — 43/43 pass against CI's actual layout rather than a locally
convenient one. lint and typecheck also clean.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix: load vitest config as native ESM to survive Node 18 CI
vite 7 (pulled in by vitest ^3.2.7) dropped its CJS build entirely.
frontend/package.json has no "type": "module", so a .ts config gets
bundled and require()'d as CommonJS — and that bundle itself requires
'vite', which is ESM-only, throwing ERR_REQUIRE_ESM under Node 18 (the
version .nvmrc pins for contentlayer). Renaming to vitest.config.mts
makes Vite load it via native dynamic import instead, sidestepping the
CJS bridge. Verified: `npm run verify` (lint+typecheck+test+build)
green under both Node 18 and 22.
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Any Postgres provisioned before 9449719 (which removed backend/db/init.sql
in favor of Prisma-only schema management) still carries a
trigger_set_timestamp() trigger created by that old init.sql. Its
pre-860a589 form references NEW.updated_at against the actual camelCase
updatedAt column, so it throws on every UPDATE to users/forms regardless
of Prisma's own @updatedAt handling at the app level (the DB trigger fires
independently of how the UPDATE was issued).
9449719 stopped new databases from ever getting this trigger, but did
nothing for ones that already had it - the roadmap's suggested fix
("run this SQL once by hand") never got applied. Ship it as a real
Prisma migration instead: DROP TRIGGER/FUNCTION IF EXISTS, which is a
no-op on databases that never had the trigger and clears it on ones
that did.
Verified against a disposable postgres:15-alpine container: fresh DB
applies cleanly; a DB seeded with the old buggy trigger reproduces the
exact `record "new" has no field "updated_at"` failure, and the new
migration's DROP statements fix it.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
GHSA-96hv-2xvq-fx4p (high, memory-exhaustion DoS via tiny WebSocket
fragments) and GHSA-58qx-3vcg-4xpx (medium, uninitialized memory
disclosure). Installed ws (8.17.1/8.19.0, transitive via socket.io and
openai/puppeteer) predates both patches (8.21.0/8.20.1). Same overrides
pattern already proven in d814a78.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fresh npm audit / Dependabot triage: the "3 critical" push-banner count from
2026-08-04 was stale — GitHub's alert API currently shows 0 critical, 5 high,
6 medium (11 open). All within existing package.json semver ranges, so no
direct dependency was bumped:
- frontend: postcss 8.4.31->8.5.25 (3 CVEs), next 15.5.19->15.5.22 (1 CVE),
via `npm update`. Verified with lint, typecheck, and a Docker Node-18 build
matching CI's exact flags (deploy's known contentlayer/Node-20 crash risk).
- backend: pinned ip-address, socket.io-parser, undici to patched versions
via `overrides` (3 transitive high/medium CVEs) since backend has no
.npmrc/legacy-peer-deps and a pre-existing zod/openai peer conflict blocks
plain `npm install`. Smoke-tested by requiring index.js directly: all
services (including the one importing cheerio, which pulls in undici)
initialized without error.
Remaining open, not independently fixable without a breaking change (logged
in roadmap): next's own internally-bundled postcss@8.4.31 (low real exposure
- build-time only, no untrusted CSS input), and the next/postcss advisory
cluster already documented as needing a real upstream fix, not --force.
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
init.sql predated Prisma and had drifted out of sync with schema.prisma
(snake_case columns vs. the app's camelCase models, a manual
trigger_set_timestamp() trigger that Prisma's @updatedAt already
handles at the ORM level). docker-compose still mounted it into the
postgres container, so any fresh dev DB got seeded from the wrong
schema. Drop the file and the mount, and point the setup docs at
`npm run docker:migrate` / `prisma migrate dev` instead.
backend/routes/{audio,images,videos,websites,dbIngestion}.js accepted a
'demo-user' fallback for userId with no auth check at all — any caller could
read/write/delete any user's ingestion sources. Landed the (previously
uncommitted) `auth` middleware on every route in those five files, and
extended the JWT payload (frontend/src/server/auth/options.ts) with a nested
`user` claim so the real Express backend's jsonwebtoken-based middleware can
verify the same token the local jose-verified /api/v1/* routes already use.
That alone would have 401'd every audio/image/video/website/database
ingestion request, since none of the frontend components or pages calling
these routes ever sent an Authorization header. Wired the existing
useAuth()/session.accessToken pattern (already used by forms and
submissions) through all five ingestion components and their five host
pages so every fetch call now attaches the bearer token.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AuthContext hardcoded `token: null` — the NextAuth Credentials sign-in
never produced a backend-verifiable token, so every `if (!token) return`
gate in the app (Saved Forms, builder save/delete/duplicate/status-change,
submissions, profile) silently no-op'd for every real logged-in user.
Wired NextAuth's jwt/session callbacks to mint the same jose-signed token
the local /api/v1/* routes already verify, threaded it through
AuthContext, fixed http.ts (was reading a token from localStorage that
nothing ever sets) and added the missing PUT handler on /api/v1/user/me.
While verifying the profile save flow end-to-end against a real Postgres
instance, found a second, unrelated bug: backend/db/init.sql's
trigger_set_timestamp() trigger references `updated_at` (snake_case) but
Prisma's schema uses `updatedAt` (camelCase), so any UPDATE on `users` or
`forms` fails on a freshly-provisioned database. Fixed the trigger to
reference the real column name.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implement full database ingestion system for connecting to external PostgreSQL
databases and importing data into DataCat:
Backend:
- Add externalDatabaseService.js with connection testing, table listing,
schema introspection, data import, and custom query execution
- Add dbIngestion.js routes for all database operations
- Store imports as DataSource records with full metadata
Frontend:
- Add DatabaseIngestion component with step-by-step wizard UI
- Add database ingestion page with connection form and recent imports
- Update ingest hub to enable database option
Features:
- Connect to PostgreSQL databases with SSL support
- Browse tables and view column schemas
- Select columns, set limits, and add WHERE filters
- Execute read-only custom queries
- Track all imports with processing time and sample data
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements a comprehensive data ingestion hub supporting multiple source types:
Backend:
- Add routes for audio, image, video, and website ingestion
- Implement services with OpenAI Vision/Whisper integration for AI analysis
- Add DataSource and DataSourceAnalysis models to Prisma schema
- Support file uploads, OCR, transcription, and web scraping
Frontend:
- Create /ingest hub page with cards for all source types
- Add dedicated pages for audio, image, video, and website ingestion
- Implement reusable ingestion components with upload/capture UIs
- Add Data Ingestion link to main landing page
Features:
- Image/document OCR with document type detection
- Audio transcription with speaker detection
- Video analysis with frame extraction
- Website content scraping with Puppeteer
- Real-time processing status and results display
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated vulnerable packages where possible.
Some vulnerabilities remain due to next-contentlayer peer dependency conflicts.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added comprehensive .gitignore to prevent accidental secret exposure
- Removed node_modules directories from git tracking (5199 files)
- Protects .env files, credentials, keys, and other sensitive data
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Feat: Add backend route and controller to update a form's status.
- Feat: Add a status-change dropdown to the form cards.
- Feat: Add a 'Copy Link' button for published forms.
- UI: Use @headlessui/react for a clean dropdown menu.
- Feat: Add a backend controller and route to fetch submissions for a form.
- Feat: Create a new page at '/submissions/[formId]' to display submission data.
- UI: Add a 'Submissions' button to the form cards to link to the new page.
- Feat: Add 'submissions' table to the database.
- Feat: Add backend controllers and routes for creating submissions and fetching public forms.
- Feat: Create a new dynamic page at '/form/[id]' to render and handle public form submissions.
- Feat: Add 'updateForm' controller and PUT route to the backend.
- Feat: Add 'editingFormId' state to the frontend to track edit mode.
- Refactor: Rename 'handleSaveAsTemplate' to 'handleSaveForm'.
- Refactor: The save function now handles both creating (POST) and updating (PUT) forms.
- Fix: Add description state to properly handle editing form descriptions.
- UI: Rename 'Save as Template' button to 'Save Form'.
- Feat: Add a 'deleteForm' controller and route to the backend.
- Refactor: Lift 'savedForms' state from 'SavedForms' to 'ModernFormBuilderLayout'.
- Refactor: The parent component now fetches and manages the forms data.
- Fix: Deleting a form now instantly updates the UI by filtering the local state.
- Feat: Add a 'getForms' controller and route to the backend.
- Feat: Refactor 'SavedForms.tsx' to fetch and display user's forms from the API.
- Refactor: Remove mock data and replace with state driven by the API call.
- Fix: Resolve prop-drilling and type errors in FilterControls integration.
- Feat: Add forms table to the database schema.
- Feat: Create backend controller and route for saving forms.
- Feat: Connect the frontend 'SaveTemplateModal' to the new API endpoint.
- Refactor: Remove old 'useTemplateManager' hook in favor of backend API.
- Feat: Set up Node.js Express backend with PostgreSQL.
- Feat: Implement JWT-based user registration and login endpoints.
- Feat: Add protected route and authentication middleware on the backend.
- Feat: Create Login and Register pages on the frontend.
- Feat: Implement global AuthContext for frontend state management.
- Feat: Update top navigation to be auth-aware (Login/Logout).