You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Daily data-mcp test failing: parties-drift.db.test.mjs #314
a v42 database whose v43 hop is refused stays usable: open_session lists its filings and reports the refusal, and the drafting filing renders from case data
Category: bug: a render of a drafting filing on a database held at schema v42 fails with no such table: arguments, where the test expects it to render. State: ready-for-agent: the cause is found, the fix is one guarded read, and a narrow red test states it. Location: cloud: the new test runs in the sandbox with the SQLite workaround in .claude/commands/implement-queue.md step 5; nothing needs Windows, data or a secret.
Verification:
The nightly run (job test, 2026-11-26) fails test 7 of source/lawyer/mcp/test/parties-drift.db.test.mjs ("a v42 database whose v43 hop is refused stays usable...") at submissionFormsRender, with sqlite3.OperationalError: no such table: arguments. The stack runs renderWrittenArguments (src/submission/forms/render-companions.ts, the call fetchOpposingArguments(ctx.dbPath, ctx.proceeding.id)) into fetchOpposingArguments (src/submission/forms/opposing-points.ts).
fetchOpposingArguments reads arguments (columns side, anticipated, component, pinpoint) and argument_rebuts with no schema guard. Both exist only from schema v82 (migrations.sql: ALTER TABLE submissions RENAME TO arguments in the v82 hop; argument_rebuts created there). MIN_READABLE_SCHEMA_VERSION is 42 (src/submission/forms/bootstrap.ts), so any held database from v42 to v81 fails this render.
Every other render read already guards this: argumentsTable() in src/submission/forms/query.ts uses hasTable(dbPath, "arguments") from src/submission/schema-capabilities.ts and reads a held database's submissions rows as our own arguments, with no opposing side.
Reproduced in the sandbox with a new narrow test (below): red on main.
Decisions
On a database without the arguments table, fetchOpposingArguments returns an empty list, so the mockup prints no "Opposing arguments" section. Reason: it matches argumentsTable(), which gives a held database no opposing side, and the section is mockup-only. Rejected: reading the legacy opposing_points table on a held database, which adds a second read path for a database the next open migrates anyway.
Plan
In fetchOpposingArguments (source/lawyer/mcp/src/submission/forms/opposing-points.ts), return [] before either query when hasTable(dbPath, "arguments") (from ../schema-capabilities.js) is false. Note the held-database behaviour in its doc comment.
Add the test source/lawyer/mcp/test/opposing-arguments-held.db.test.mjs given under Red tests.
Run npm run build in source/lawyer/mcp, then python scripts/build_plugin.py at the repo root, and commit source, test and the rebuilt plugins/ together. The change is a patch for lawyer.
Scope
May change: source/lawyer/mcp/src/submission/forms/opposing-points.ts, the new test file, and the built plugins/ folders that scripts/build_plugin.py rewrites from them. Out of bounds: schema files and migrations, the render layout of a current-schema database, and the failures of #311 and #313.
Done when
cd source/lawyer/mcp && npm run build && node --test test/opposing-arguments-held.db.test.mjs passes (in the cloud, with the SQLite workaround; the fixture helper resets PYTHONPATH, so point COCLERK_PYTHON at a wrapper that adds the sitecustomize.py folder).
python scripts/build_plugin.py --check reports every plugin matches its source.
// A database held below schema v82 has no `arguments` or `argument_rebuts` table: the opposing// arguments inventory of a render reads as none there, never a "no such table" failure.importassertfrom"node:assert/strict";import{mkdtempSync,rmSync}from"node:fs";import{tmpdir}from"node:os";import{join}from"node:path";importtestfrom"node:test";const{ fetchOpposingArguments }=awaitimport("../build/submission/forms/opposing-points.js");const{ submissionDbAt }=awaitimport("./helpers/template-db.mjs");test("a v42 database lists no opposing arguments and reads no arguments table",(t)=>{constdir=mkdtempSync(join(tmpdir(),"coclerk-opposing-held-"));t.after(()=>rmSync(dir,{recursive: true,force: true,maxRetries: 10,retryDelay: 200}));constdbPath=join(dir,"submission.sqlite");submissionDbAt(dbPath,42);assert.deepEqual(fetchOpposingArguments(dbPath,1),[]);});
Command: cd source/lawyer/mcp && node --test test/opposing-arguments-held.db.test.mjs
Failing on main: assert.deepEqual(fetchOpposingArguments(dbPath, 1), []); throws OperationalError: no such table: arguments.
The original parties-drift.db.test.mjs test 7 is unchanged, so the repo's hook refuses to run it; the nightly run's failure, quoted above, counts as its red.
Already fixed on main by 31728e8 (#312), which guards fetchOpposingArguments against a database with no arguments table, exactly as this brief's Plan step 1 asks, and released in Lawyer 0.34.3 (8e89717).
This brief's red test, written into a worktree of origin/main at 8e89717 and built there: COCLERK_PYTHON=<sqlite 3.51 wrapper> node --test test/opposing-arguments-held.db.test.mjs passes (1 pass, 0 fail). The test file was not committed: its path is already used by #312's test, which covers the same read on a seeded v42 database.
Left to CI: the next daily data-mcp run should pass test 7 of parties-drift.db.test.mjs.
Activity
Mharbulous commentedon Nov 26, 2026
Agent Brief
Category: bug: a render of a drafting filing on a database held at schema v42 fails with
no such table: arguments, where the test expects it to render.State: ready-for-agent: the cause is found, the fix is one guarded read, and a narrow red test states it.
Location: cloud: the new test runs in the sandbox with the SQLite workaround in
.claude/commands/implement-queue.mdstep 5; nothing needs Windows, data or a secret.Verification:
test, 2026-11-26) fails test 7 ofsource/lawyer/mcp/test/parties-drift.db.test.mjs("a v42 database whose v43 hop is refused stays usable...") atsubmissionFormsRender, withsqlite3.OperationalError: no such table: arguments. The stack runsrenderWrittenArguments(src/submission/forms/render-companions.ts, the callfetchOpposingArguments(ctx.dbPath, ctx.proceeding.id)) intofetchOpposingArguments(src/submission/forms/opposing-points.ts).fetchOpposingArgumentsreadsarguments(columnsside,anticipated,component,pinpoint) andargument_rebutswith no schema guard. Both exist only from schema v82 (migrations.sql:ALTER TABLE submissions RENAME TO argumentsin the v82 hop;argument_rebutscreated there).MIN_READABLE_SCHEMA_VERSIONis 42 (src/submission/forms/bootstrap.ts), so any held database from v42 to v81 fails this render.argumentsTable()insrc/submission/forms/query.tsuseshasTable(dbPath, "arguments")fromsrc/submission/schema-capabilities.tsand reads a held database'ssubmissionsrows as our own arguments, with no opposing side.held-v42-render.db.test.mjs(Daily data-mcp test failing: held-v42-render.db.test.mjs #312) fails with the sameno such table: argumentserror and likely shares this cause.view-pages.unit.test.mjs(Daily data-mcp test failing: view-pages.unit.test.mjs #311, a pinned Arguments-page hash) andforms-render-gap-inventory.db.test.mjs(Daily data-mcp test failing: forms-render-gap-inventory.db.test.mjs #313, open-items entries) fail on different assertions and are not covered here.main.Decisions
argumentstable,fetchOpposingArgumentsreturns an empty list, so the mockup prints no "Opposing arguments" section. Reason: it matchesargumentsTable(), which gives a held database no opposing side, and the section is mockup-only. Rejected: reading the legacyopposing_pointstable on a held database, which adds a second read path for a database the next open migrates anyway.Plan
fetchOpposingArguments(source/lawyer/mcp/src/submission/forms/opposing-points.ts), return[]before either query whenhasTable(dbPath, "arguments")(from../schema-capabilities.js) is false. Note the held-database behaviour in its doc comment.source/lawyer/mcp/test/opposing-arguments-held.db.test.mjsgiven under Red tests.npm run buildinsource/lawyer/mcp, thenpython scripts/build_plugin.pyat the repo root, and commit source, test and the rebuiltplugins/together. The change is a patch forlawyer.Scope
May change:
source/lawyer/mcp/src/submission/forms/opposing-points.ts, the new test file, and the builtplugins/folders thatscripts/build_plugin.pyrewrites from them. Out of bounds: schema files and migrations, the render layout of a current-schema database, and the failures of #311 and #313.Done when
cd source/lawyer/mcp && npm run build && node --test test/opposing-arguments-held.db.test.mjspasses (in the cloud, with the SQLite workaround; the fixture helper resetsPYTHONPATH, so pointCOCLERK_PYTHONat a wrapper that adds thesitecustomize.pyfolder).python scripts/build_plugin.py --checkreports every plugin matches its source.python scripts/check_plugin.pypasses.After landing
data-mcp-testsrun passesparties-drift.db.test.mjstest 7, and likelyheld-v42-render.db.test.mjs(Daily data-mcp test failing: held-v42-render.db.test.mjs #312).Red tests
Path:
source/lawyer/mcp/test/opposing-arguments-held.db.test.mjsCommand:
cd source/lawyer/mcp && node --test test/opposing-arguments-held.db.test.mjsFailing on
main:assert.deepEqual(fetchOpposingArguments(dbPath, 1), []);throwsOperationalError: no such table: arguments.The original
parties-drift.db.test.mjstest 7 is unchanged, so the repo's hook refuses to run it; the nightly run's failure, quoted above, counts as its red.Generated by Claude Code
Mharbulous commentedon Nov 26, 2026
Already fixed on
mainby 31728e8 (#312), which guardsfetchOpposingArgumentsagainst a database with noargumentstable, exactly as this brief's Plan step 1 asks, and released in Lawyer 0.34.3 (8e89717).This brief's red test, written into a worktree of
origin/mainat 8e89717 and built there:COCLERK_PYTHON=<sqlite 3.51 wrapper> node --test test/opposing-arguments-held.db.test.mjspasses (1 pass, 0 fail). The test file was not committed: its path is already used by #312's test, which covers the same read on a seeded v42 database.Left to CI: the next daily data-mcp run should pass test 7 of
parties-drift.db.test.mjs.Generated by Claude Code