The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
Hub: three reports hide an item from everyone — Implementation Plan
For agentic workers: this plan is carried out by the task's Engineer, task by task, test first, as the project's instructions (Engineer role) say. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: A harness or comment that three readers reported is hidden from every reader, including rows of
community_hidden written before the fix (no restoredAt field at all).
Architecture: fileReport creates the hide row with restoredAt: null written out, and the two readers
(hiddenFrom, isHiddenFrom) filter on "not restored" as null or absent, the machineAlive pattern of
lib/prisma.ts, so old rows need no migration. The route unit tests' fake table stops supplying restoredAt: null,
so it shows Mongo's behavior; a new integration test runs the same flow on a real Mongo replica set.
Tech Stack: TypeScript, Prisma (MongoDB), Vitest, mongodb-memory-server (planDatabase).
Spec: Task #2299 brief (Super Tab conversation f90ee44a6662554cfaa30431), requested by [email protected].
Global Constraints
- PR body first line: "Requested by [email protected] through Harness."
- Before Ready: a test that fails without the fix for every risk named, red/green evidence in a PR comment, and the
full Super Tab integration suite (
npm run test:super-tabsin backend/). - Never run a test that signs the Mac out of the real CLI. Stop only processes you started, by id. Temp files only in mktemp -d folders.
- Owns: backend/src/lib/communityReports.ts, backend/src/routes/community.test.ts, backend/integration. One line in backend/vitest.super-tabs.config.ts adds the new test file to the suite.
Review Focus
- A restored row (
restoredAta date) must stay visible: the "absent" branch must not match it (isSet: falseonly). - A reporter still stops seeing what they reported at once, before the third report.
- After a restore, three new reports hide it again (the upsert's update path), and older reports don't count.
hiddenFromscoped to one harness (harnessId) lists a hidden comment on that harness and not one on another.- A hide row without
restoredAtin a later report:fileReporttreats it as hidden (returns early, no second Slack post) — it already does, since Prisma reads the absent field as null.
Task 1: Hidden from everyone, on real Mongo
Files:
- Create:
backend/integration/communityReports.test.ts - Modify:
backend/vitest.super-tabs.config.ts(add the file toinclude) - Modify:
backend/src/lib/communityReports.ts:16-32(readers),:66(create) - Modify:
backend/src/routes/community.test.ts:21(fakeisSet: falsematches only an absent field),:85(dropdefaults: { restoredAt: null }fromcommunityHidden)
Interfaces:
Consumes:
planDatabase(prefix)fromintegration/plans.test-support.ts;fileReport,hiddenFrom,isHiddenFromfromsrc/lib/communityReports.ts(signatures unchanged).Produces: nothing new for other code; a module-private
notRestoredwhere-input ({ OR: [{ restoredAt: null }, { restoredAt: { isSet: false } }] }).Step 1: Write the failing integration test —
src/lib/prisma.jsmocked to theplanDatabaseclient (theharnessSharesList.test.tspattern). Cases:three reports hide a harness from readers who did not report it: r1, r2, r3 report harnessh1;isHiddenFrom(env, 'harness', 'h1')and(…, 'h1', 'stranger')aretrue;hiddenFrom(env, 'harness')and(…, 'stranger')containh1.three reports hide a comment from readers who did not report it: the same for commentc1onh1, andhiddenFrom(env, 'comment', undefined, 'h1')containsc1.a hide row stored without restoredAt hides it too: raw insert intocommunity_hiddenwith norestoredAt; anonymous and stranger see it hidden in both readers.the hide row three reports write stores restoredAt as an explicit null(raw$type: 'null'count is 1): pins change (1), which the readers' fix alone would otherwise hide.two reports hide it only from those who reported it: anonymous and r3 not hidden; r1 hidden.a restored item is shown until three new reports: restored row (date) is visible; three later reports hide it.
Step 2: Run it, watch it fail —
npx vitest run --config vitest.super-tabs.config.ts integration/communityReports.test.ts. Expected: the three "hide" cases FAIL (expected false to be true), the others pass.Step 3: Make the route unit fake honest — fake
isSet: falsematches onlyundefined; drop therestoredAtdefault. Runnpx vitest run src/routes/community.test.ts: expect the report-hiding cases to FAIL as on Mongo.Step 4: Commit the failing tests.
Step 5: Fix
communityReports.ts—notRestoredin both readers;create: { ...key, harnessId, restoredAt: null }.Step 6: Run both test files, then
npm testandnpm run test:super-tabs. Expected: all PASS.Step 7: Commit the fix; post red/green evidence as a PR comment.