Skip to content

[Governance Domain] Effect-TS: workflow services + Layer 2 store + Layer 5 composables + Layer 7 tests #94

@Soushi888

Description

@Soushi888

Summary

Governance domain — the most complex implementation in the 7-layer plan. Includes the Workflow Services (Layer 1 extension unique to Nondominium's governance-as-operator architecture), the governance store, composables for dispatch and validation queue, and tests.

Layer 2 store base implemented by #97: governance.store.svelte.ts converted to R&O factory pattern (E.gen + yield* GovernanceServiceTag + withLoadingState, boolean isLoading + string|null errorMessage). Remaining Layer 2 work: full store state (pendingCommitments, myEconomicEvents, validationQueue, pendingRoleRequests). Workflow services, composables, and tests are fully remaining.

Scope

Layer 1 extension — Workflow Services

Multi-step governance sequences implemented as Context.Tag + Layer.effect using E.gen:

  • services/workflows/custody-transfer.workflow.ts
    Sequence: Commitment → GovernanceEvaluation → EconomicEvent → Claim → PPR×2
  • services/workflows/agent-promotion.workflow.ts
    Sequence: request_role_promotion → validate identity → validate first resource → approve_role_promotion → assign role
  • services/workflows/resource-validation.workflow.ts
    Sequence: create_resource_validation → collect ValidationReceipts → check_validation_status → emit result
  • services/workflows/economic-process.workflow.ts
    Sequence: validate role → initiate_economic_process → complete_economic_process → issue PPRs

Layer 2 — Store

Layer 5 — Composable

  • composables/domain/governance/useGovernanceWorkflow.svelte.ts — single entry point for all workflow dispatch; surfaces isExecuting, lastResult, workflow-specific error messages
  • composables/domain/governance/useValidationQueue.svelte.ts — reactive validation queue for AccountableAgents; submits ValidationReceipts

Layer 7 — Tests

  • Workflow service unit tests verifying each step sequence with mocked zome services
  • Store tests for validationQueue reactivity and role-gating
  • Composable tests for workflow dispatch and error surface

Acceptance Criteria

  • CustodyTransferWorkflow correctly sequences all 5 steps; WorkflowError.rejected surfaces governance rejection reasons to UI
  • validationQueue only populated for agents with coordination or governance capability level
  • DHT signals from other agents trigger validationQueue refresh
  • bun run check, bun run test, bun run build pass

Depends on

#92 (Person domain), #93 (Resource domain)

Part of

Epic #7

Metadata

Metadata

Assignees

No one assigned

    Labels

    frontendFrontend development - UI, SvelteKit, Effect-TS

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions