oliver-zehentleitner / maity
clean-up: web team/agents: one manage component, one own-agent rule, one offered-roles rule
tsk-kgph82yystd8 Open
From the web clean-up audit, area 17 (tsk-hgnbapyw7hnh), read at 80647565 (findings sent to lotse, seq 125484). Line numbers are from 80647565, so re-check them on current main.
#20 Team / Agents: the agent controls are listed three times (duplication).
- Where:
- members.js:804-808 (the Manage row without members:admin)
- members.js:810-820 (the Manage row with members:admin)
- agents-page.js:653-675 (the here() card on the Agents page of a project)
- Each list takes its parts from M.memberParts but decides on its own which parts, in what order and under which condition. The preferences-toggle condition is written three times (members.js:807, :816, agents-page.js:660).
- The lists have drifted:
- The briefing (members.js:813) and isolation appear only on the Manage row, so an admin on Agents never sees the briefing.
- Credentials appear on the Agents card for every owner, but on no non-admin Manage row.
- Proposal: one P.manageBody(m, memberPath, {where: "team" or "agents"}) that owns the list and its conditions. Any difference that stays is stated on purpose.
- Effort M. Risk medium: smoke fixes which part shows where.
#21 Team / Agents: the picture and profile-delete control exists twice, and views.md says it is one (duplication/docs drift).
- Where: members.js:267-298 (picturePart, with its own ownProfile read), agents-page.js:270-271 (profileCard calls M.pictureEditor and M.profileDelete directly), and web/context/views.md:3114-3116, which says picture and removal are one code in M.memberParts.
- picturePart reads every profile (GET /agents) to find one id. The hub has GET /agents/{agent_id} (hub routes/agents.py:161).
- Proposal: keep one picture-and-delete part that reads GET /agents/{id} or takes the profile that Agents already holds. Fix views.md.
- Effort S-M. Risk low.
#22 Team / agents / join / placements: "is this my agent" is written about ten ways (design).
- Where: members.js:227, member-page.js:67 (ownAgentOf, a verbatim copy of members.js:227), org.js:174, agents-page.js:562, placements.js:106 and :299-300, join.js:273, :282 and :332, members.js:652.
- The copies disagree:
- Some check ctx.me.kind == human. org.js, agents-page.js:562, placements.js and join.js do not.
- Some exclude removed_at. members.js and member-page.js do not, so Team counts removed own agents.
- Some check kind == agent. placements.js:300 and members.js:652 do not.
- Proposal: add M.trust.ownAgent(ctx, m, {live}) and use it in every place.
- Effort S. Risk low. Watch the removed-member case on Team.
#23 Join / placements / invite / members: which trusts and roles a form offers is coded four times (design).
- Where: join.js:220 and :226, placements.js:112 and :115 (identical to join.js), invite.js:175 and :181, members.js:846-859 (which adds an owner exception and m.role == proxy).
- The owner_only/proxy rule of section 2.3 lives in each form. trust.js exports MEMBER_TRUSTS and MEMBER_ROLES but has no "offered" helper.
- Proposal: add M.trust.offeredTrusts(ctx, kind) and M.trust.offeredRoles(ctx, trust, current), keeping the current behaviour exactly, including the exception in members.js for the current value.
- Effort S-M. Risk low-medium.
- Open question: invite.js offers every TRUSTS value, owner included, while the join forms hardcode member, guest and admin. That may be right for humans, but nothing documents it. Confirm the intended set before unifying.