feat: add folder-grouped tabular review rows - #274
Conversation
95d040e to
5f996cf
Compare
|
Thanks for splitting this out of #54. The idempotent migration with a legacy backfill, the create-path rollback, and the revoke + RLS on the two new tables — matching, even exceeding, the repo's backend-owned-table pattern — are genuinely good work. The core problem is that the feature currently ends at the database. Must-fix:
Smaller: several helpers ignore Supabase errors (a transient failure yields a silently empty review), and adding the two new tables to the stack test's To make this easy to act on I've opened ecarjat#1 against your branch: row-based generation and rendering wired end to end, the tsc errors and migration date fixed, tests added — merge it or cherry-pick. It sits directly on your branch as three focused commits; the rebase onto main (including the |
There was a problem hiding this comment.
Details in my comment below — the schema work is solid, but generation/rendering aren't wired to the new rows yet, the frontend typecheck fails, and the migration needs re-dating. There's a follow-up PR against your branch implementing the fixes.
|
Pushed follow-up commit 6ae1f98 with the completed folder-grouped tabular review experience. What changed:
Validation completed: backend TypeScript build, 33 tabular route tests, focused frontend tests, frontend type-checking, ESLint, and diff checks. |
…to codex/folder-grouped-tabular-reviews # Conflicts: # backend/schema.sql
…with lib tests WHY THIS MATTERS Main's "Frontend build and tests" job has been red for everyone: statements 52.14% vs the 54% floor and branches 62.57% vs 73%. A coverage ratchet only works if regressions are paid down with tests — if we lower the floor instead, the ratchet becomes a decoration and every future untested merge quietly erodes the suite. This commit restores green by testing the code that caused the drop, then re-arms the ratchet at the new level. WHAT HAPPENED The ratchet floors were measured in #255 (2266446) before three merges landed untested code inside the gated scope (src/app/lib/**): - #263 (db-pagination) + #274 (folder-grouped tabular reviews) grew mikeApi.ts's listTabularReviews/listTabularReviewIds into query-string builders with seven conditional params each, added the document_grouping field, the uploadReviewDocument orchestration, and the tabular chat/cell endpoints — nearly all unexercised. Lines 1044-1456 were the bulk of the uncovered report. - #280 (workflow slash triggers) leans on the workflow endpoints (listWorkflows feeds the slash menu), which were also untested. Because coverage is a global percentage over the gated files, adding untested statements/branches anywhere in scope dilutes the totals even though no tested line got worse. HOW THE FIX WORKS Extend the existing mikeApi.test.ts fetch/session mocking pattern to the regressed surface, asserting behavior (URLs, methods, exact payloads, error contracts), not just execution: - listTabularReviews/listTabularReviewIds: every pagination knob serialized under its snake_case name, scope="all" omitted (backend default), abort signals forwarded, and the ids query scoped identically to the list query — the invariant that keeps select-all-then-delete from deleting reviews the user cannot see. - createTabularReview/updateTabularReview: document_grouping (the #274 field) passes through unchanged; PATCH sends only the given fields. - uploadReviewDocument: project vs standalone upload routing, and that the follow-up PATCH appends to existing document_ids instead of replacing them (the review-shrinking failure mode). - Multipart uploads: FormData with auth header only (a manual JSON content type would break the boundary), optional filename field, and the plain-Error-with-response-text failure contract. - Tabular chats/cells, workflow list/hide/unhide, query and payload defaults (getDocumentUrl version param, createChat "{}" body, parent_folder_id null-vs-undefined, empty error bodies). - supabase.ts: importing without env vars fails loudly at module load — the desired crash-at-startup behavior for a misconfigured build. - deleteTabularReviewsWithConcurrency: empty input short-circuits; concurrency<=0 clamps to one worker instead of silently deleting nothing. - utils.diceCoefficient: sub-bigram inputs score 0. Coverage moves from 52.14/62.57/34.67/52.41 (stmts/branch/funcs/lines) to 81.18/98.24/55.64/79.18. Per the ratchet's own rule ("floors only go up: when you add tests, raise them in the same PR"), the floors move to 79/96/53/77 — about two points under the new measurement, so one small innocent addition doesn't instantly re-redden main, while a real drop still fails CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Summary
Focused replacement for #54, rebased on the current
mainbranch.Changes
Why
Lets a tabular review process all documents in a project subfolder as one logical row without coupling the change to the separate page-limit or PDF.js cleanup work from #54.
Testing
npm test --prefix frontendnpm test --prefix backendnpm run build --prefix backend