Skip to content

feat(dna): Group DNA per-group coordination DHT with Sweettest suite#107

Merged
Soushi888 merged 5 commits into
devfrom
feat/101-group-dna
May 27, 2026
Merged

feat(dna): Group DNA per-group coordination DHT with Sweettest suite#107
Soushi888 merged 5 commits into
devfrom
feat/101-group-dna

Conversation

@Soushi888
Copy link
Copy Markdown
Collaborator

@Soushi888 Soushi888 commented May 13, 2026

Intent

Implement the Group DNA as the per-group coordination layer of the Lobby → Group → NDO hierarchy. Each group gets its own DHT via a cloned cell from a Group DNA template. The GroupView and GroupSidebar UI components are currently full stubs — this DNA replaces those stubs with real data without changing any component interfaces.

Unblocked by PR #103 (Lobby DNA).

Changes

Integrity zome (zome_group_integrity)

  • GroupProfile — group name, description, created_at, initiator
  • GroupMembership — agent membership record (join date, role in group)
  • WorkLog — contribution record within the group context
  • SoftLink — planning-level link to a resource or NDO (dashed border in UI)

Coordinator zome (zome_group) — 16 externs

  • create_group, get_group, get_my_group, update_group
  • join_group, leave_group, get_group_members, is_member
  • log_work, get_work_logs, get_my_work_logs, delete_work_log
  • create_soft_link, get_soft_links, delete_soft_link
  • init

Lobby DNA refactorNdoAnnouncement replaced by GroupAnnouncement

  • announce_group replaces announce_ndo
  • get_my_group_announcements, get_group_announcement_by_dna_hash replace the NDO announcement functions
  • get_my_groups now returns real group data instead of a stub solo workspace

Shared crate

  • GroupError added to crates/shared/src/errors.rs

happ.yaml

  • group role added with deferred: true and clone_limit: 64 — infrastructure for cloned cells (cell creation flow is deferred to a follow-up PR)

Service layer

  • group.service.ts stub replaced with real callZome implementation — GroupServiceTag interface unchanged (ADR-GROUP-03)
  • cell.manager.ts extended with getGroupCellHandle to resolve a DnaHash to a group CellId

Tests

  • 13-test Sweettest suite in dnas/group/tests/: group creation, get_group (fetch by hash), get_my_group, membership (join/leave/is_member/duplicate-join guard), work logs (group + per-agent query + delete), soft links (create + get + delete), update_group, and validation rejection cases (empty name, zero hours)
  • Lobby Sweettest updated for GroupAnnouncement API

Decisions

Option Rejected because
New app install per group Conductor proliferation — cloned cell is lighter and avoids admin overhead
Store SoftLinks as EconomicEvents SoftLinks are planning-only (dashed border); generating PPRs would misrepresent intent
Keep GroupGovernanceRule entry type No externs, no tests — premature DHT commitment; removed before merge

How to test

bun run build:happ
CARGO_TARGET_DIR=target/native-tests cargo test --package group_sweettest --test group -- --test-threads 6

All 13 Sweettest assertions pass. Thread limit required: 13 tests × 2 conductors = 26 conductors; without --test-threads 6 the suite hits port exhaustion.

Documentation

  • documentation/zomes/group_zome.md (new file) — Group DNA API reference
  • documentation/zomes/lobby_zome.md — updated for GroupAnnouncement API
  • documentation/zomes/architecture_overview.md — updated for multi-DNA structure
  • documentation/API_REFERENCE.md, IMPLEMENTATION_STATUS.md, TEST_COMMANDS.md updated

Related

Related issues:

@Soushi888
Copy link
Copy Markdown
Collaborator Author

Review pass — issues found and fixed (commit 1892ce5)

All 13 Sweettest assertions now pass (-- --test-threads 6).

Issues resolved

1. No-op hash validation in integrity zome
validate_group_membership and validate_soft_link both checked get_raw_39().is_empty() on ActionHash fields. ActionHash is always exactly 39 bytes — this check is structurally impossible to fail. Removed both guards; replaced with comments explaining that existence validation is not possible from the integrity context.

2. AgentToWorkLogs link committed with no getter
log_work created AgentToWorkLogs links on every write, but there was no get_my_work_logs extern to query them. Every write was a DHT commitment with no corresponding read path. Added get_my_work_logs(_: ()) -> Vec<WorkLog>.

3. GroupUpdates link type without update_group function
GroupUpdates was defined in LinkTypes and documented in the link types table, but no coordinator function used it. Following the same rationale that removed GroupGovernanceRule (no externs, no tests, premature DHT commitment), the correct fix here is the opposite: add update_group rather than remove the link, since profile updates are a natural use case. Added update_group with NotAuthor guard, mirroring the update_person pattern.

4. Stale TypeScript types
GroupGovernanceRule and GroupGovernanceRuleInput remained in packages/shared-types/src/group.types.ts after the Rust entry type was removed. Removed both; added UpdateGroupInput to match the new update_group extern.

5. Missing test coverage
Added 5 new Sweettest cases:

  • duplicate_join_returns_already_member_error — the AlreadyMember guard existed but was untested
  • empty_group_name_rejected — name validation path
  • work_log_zero_hours_rejected — hours validation path
  • get_my_work_logs_returns_own_logs — new get_my_work_logs extern
  • update_group_changes_name — new update_group extern

6. Thread limit for all-tests run
13 tests × 2 conductors each = 26 concurrent Holochain conductors fails due to port exhaustion when run without a thread cap. Documented -- --test-threads 6 in TEST_COMMANDS.md and group_zome.md.

No regressions

All original 8 tests continue to pass. Build CI remains green.

Soushi888 added a commit that referenced this pull request May 26, 2026
- Coordinator API: 13 → 15 externs (add update_group, get_my_work_logs)
- Sweettest coverage: 7 → 13 test scenarios (reflects commit 1892ce5 additions)
- Milestone bullet: mark Group DNA backend complete (was 'post-MVP/not started')
- Milestone table row: ❌ Not started → ✅ Complete (PR #107)
- Post-MVP table: remove stale 'Group DNA (#101) not yet started' note
Comment thread dnas/group/zomes/coordinator/zome_group/src/group_profile.rs Outdated
Comment thread documentation/zomes/group_zome.md
Comment thread dnas/group/zomes/integrity/zome_group_integrity/src/lib.rs
Soushi888 added a commit that referenced this pull request May 27, 2026
- Fix compile error in zome_gouvernance/validation.rs: status field now
  uses ResourceValidationStatus::Pending (enum) instead of "pending".to_string()
  (pre-existing type mismatch introduced by commit 32975a5 on dev)
- Rewrite lobby_zome.md to reflect current GroupAnnouncement API; removes
  stale NdoAnnouncement, announce_ndo, get_my_ndo_announcements references
- Fix architecture_overview.md: update Lobby DNA entry types from
  NdoAnnouncement to GroupAnnouncement; update description
- Fix group_zome.md test command comment: 12 tests x 2 conductors (not 13)
Soushi888 added a commit that referenced this pull request May 27, 2026
- Coordinator API: 13 → 15 externs (add update_group, get_my_work_logs)
- Sweettest coverage: 7 → 13 test scenarios (reflects commit 1892ce5 additions)
- Milestone bullet: mark Group DNA backend complete (was 'post-MVP/not started')
- Milestone table row: ❌ Not started → ✅ Complete (PR #107)
- Post-MVP table: remove stale 'Group DNA (#101) not yet started' note
@Soushi888 Soushi888 force-pushed the feat/101-group-dna branch from b977ce2 to 5262c42 Compare May 27, 2026 03:39
Soushi888 added a commit that referenced this pull request May 27, 2026
- Fix compile error in zome_gouvernance/validation.rs: status field now
  uses ResourceValidationStatus::Pending (enum) instead of "pending".to_string()
  (pre-existing type mismatch introduced by commit 32975a5 on dev)
- Rewrite lobby_zome.md to reflect current GroupAnnouncement API; removes
  stale NdoAnnouncement, announce_ndo, get_my_ndo_announcements references
- Fix architecture_overview.md: update Lobby DNA entry types from
  NdoAnnouncement to GroupAnnouncement; update description
- Fix group_zome.md test command comment: 12 tests x 2 conductors (not 13)
Soushi888 added a commit that referenced this pull request May 27, 2026
Correct architecture per PR #107 (Group DNA):
- Lobby discovers Groups via GroupAnnouncement (not NDOs directly)
- Groups discover NDOs via SoftLink entries in each group's cloned-cell DHT
- Lobby NdoBrowser aggregates only the agent's own group NDOs — no global public registry
- No direct Lobby→NDO relationship

Placed in ui_architecture.md (Section 1 Overview) and ui_design.md (MVP intro).
Soushi888 added 5 commits May 26, 2026 23:50
Introduces the Group DNA as the per-group coordination layer of the
Lobby → Group → NDO hierarchy. Each group runs in its own cloned cell
(separate DHT, same DNA template) provisioned via clone_cell.

Entry types (integrity zome):
- GroupProfile — name, description; identity from action header
- GroupMembership — group_hash, optional role; member from action header
- WorkLog — group_hash, description, hours (> 0); author from action header
- SoftLink — group_hash, target_ndo_hash, description; planning-only (ADR-GROUP-04)

Coordinator externs (16):
- create_group, get_group, get_my_group, update_group (NotAuthor guard)
- join_group (AlreadyMember guard), leave_group, get_group_members, is_member
- log_work, get_work_logs, get_my_work_logs, delete_work_log (NotAuthor guard)
- create_soft_link, get_soft_links, delete_soft_link (NotAuthor guard), init

happ.yaml: group role added with deferred: true and clone_limit: 64
Shared crate: GroupError domain error enum added
The Lobby DHT is now the registry for group cells, not NDOs directly.
NDOs are discovered through group cells (Lobby → Groups → NDOs).

- NdoAnnouncement entry type and announce_ndo, get_all_ndo_announcements,
  get_ndo_announcement, update_ndo_announcement replaced by GroupAnnouncement
  and announce_group, get_all_group_announcements, get_group_announcement_by_dna_hash
- get_my_groups now returns real GroupDescriptorStub from DHT instead of
  stub solo workspace
- AnnounceGroupInput replaces AnnounceNdoInput and UpdateNdoAnnouncementInput
  in shared crate
Group DNA Sweettest (dnas/group/tests/):
- create_group_returns_profile, get_group_by_hash
- join_group_creates_membership, leave_group_removes_membership
- is_member_reflects_membership_state, duplicate_join_returns_already_member_error
- log_work_and_get_work_logs, get_my_work_logs_returns_own_logs
- create_soft_link_and_get_soft_links, get_my_group_returns_created_group
- update_group_changes_name
- empty_group_name_rejected, work_log_zero_hours_rejected

Thread limit: 13 tests × 2 conductors; --test-threads 6 required.

Lobby Sweettest updated for GroupAnnouncement API (announce_group,
get_my_group_announcements, get_group_announcement_by_dna_hash).
GroupService stub replaced with real callZome implementation. Interface
takes groupCellId: CellId (DnaHash + AgentPubKey) — CellId is the correct
addressing for cloned group cells (ADR-GROUP-03).

- group.types.ts: GroupProfile, GroupMembership, WorkLog, SoftLink types
  and input types; GroupGovernanceRule removed
- group.service.ts: getMembers, getWorkLogs, getSoftLinks implemented via
  callGroupZome helper; GroupServiceLive built as Effect-TS Layer
- cell.manager.ts: getGroupCellHandle added to resolve DnaHash to group CellId
- lobby.service.ts: GroupAnnouncement API wired; get_my_groups updated
- lobby.types.ts: NdoAnnouncement → GroupAnnouncement; shared-types updated
- group_zome.md: full API reference for Group DNA (entry types, link types,
  16 coordinator functions including delete_work_log and delete_soft_link,
  validation rules, error types, ADRs, test commands)
- architecture_overview.md: updated to multi-DNA hApp structure with
  Nondominium DNA / Lobby DNA / Group DNA sections
- lobby_zome.md: updated for GroupAnnouncement API
- API_REFERENCE.md, IMPLEMENTATION_STATUS.md, TEST_COMMANDS.md,
  DOCUMENTATION_INDEX.md updated for Group DNA
@Soushi888 Soushi888 force-pushed the feat/101-group-dna branch from 5262c42 to 9e71f18 Compare May 27, 2026 03:52
@Soushi888 Soushi888 marked this pull request as ready for review May 27, 2026 03:53
@Soushi888 Soushi888 merged commit 19dd154 into dev May 27, 2026
1 check passed
@Soushi888 Soushi888 deleted the feat/101-group-dna branch May 27, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(dna): Group DNA per-group coordination DHT with Sweettest suite

1 participant