feat(approvals): deferred functionality — delegation, notifications, lifecycle tie-ins #169

Open
opened 2026-03-01 15:40:32 +00:00 by forbes · 0 comments
Owner

Context

The approvals/ECO workflow system has a complete backend API (migrations 018-019, internal/api/approval_handlers.go, internal/workflow/workflow.go) but several planned features are not yet implemented. This issue tracks deferred functionality that should be built as the system matures.

Current State

Implemented:

  • Database schema (item_approvals, approval_signatures)
  • YAML-configurable workflows (engineering-change, quick-review)
  • Create approval with signers
  • Sign (approve/reject) with auto-state-advancement
  • SSE events (approval.created, approval.signed, approval.completed)
  • GET /api/workflows listing

Not implemented (this issue):

1. Approval Delegation / Proxy Signing

Allow a signer to delegate their approval to another user.

  • POST /api/items/{pn}/approvals/{id}/delegate — signer delegates to another user
  • Delegated user appears in signatures with delegated_by field
  • Original signer can still sign (delegation is additive, not exclusive)
  • Workflow evaluation treats delegated signatures the same as direct ones

2. Email / Notification Integration

Notify signers when they have pending approvals.

  • On approval.created: send notification to all listed signers
  • On approval.signed: notify remaining unsigned signers and the creator
  • On approval.completed: notify all participants
  • Notification channel configurable: SSE only (current), email, webhook
  • Config:
    approvals:
      notifications:
        email:
          enabled: false
          smtp_host: ""
        webhook:
          enabled: false
          url: ""
    

3. Lifecycle State Tie-Ins

Automatically transition item lifecycle state based on approval outcomes.

  • When an approval using the engineering-change workflow completes with approved:
    • Transition item lifecycle from reviewreleased (if item has .kc metadata with lifecycle)
    • Create a new revision tagged as "released"
  • When rejected: transition to rejected or back to draft
  • Configurable per workflow via YAML:
    workflow:
      name: engineering-change
      on_approved:
        lifecycle_transition: released
      on_rejected:
        lifecycle_transition: draft
    

4. Approval Templates

Pre-filled signer lists per workflow for common approval patterns.

  • POST /api/approval-templates — create template (name, workflow, default signers)
  • GET /api/approval-templates — list templates
  • Templates can be selected in the UI to auto-populate the signer list
  • Templates are per-organization, not per-item

5. Bulk Approval Operations

Approve/reject multiple items in one action.

  • POST /api/approvals/bulk-sign — sign multiple pending approvals at once
  • Useful for release managers who review batches

6. Web UI

No approval UI exists. Needed:

  • Approvals page listing all pending approvals (filterable by state, workflow, item)
  • Item detail panel showing approval status and signature progress
  • Sign/reject buttons with comment field
  • Approval creation form (select workflow, add signers)
  • Approval history view

Partially covered by #147 (metadata tab scaffolds an approvals page placeholder).

7. Session Override Workflow (from #167)

The session-override workflow (#167) adds approval-gated force-release for edit sessions. This requires:

  • Approval creation triggered by non-item actions (currently approvals are item-scoped)
  • Approval completion callback that triggers a side effect (session release)
  • This may require extending the approval model to support resource_type + resource_id rather than just item_id

Priority

Feature Priority Depends On
Web UI P1 #147
Lifecycle tie-ins P1 .kc metadata (Phase 1)
Notifications P2 SMTP config
Delegation P2 None
Templates P3 Web UI
Bulk operations P3 Web UI
Session override P2 #167

Acceptance Criteria

This is a tracking issue. Individual items should be broken into separate issues when prioritized for implementation.

## Context The approvals/ECO workflow system has a complete backend API (migrations 018-019, `internal/api/approval_handlers.go`, `internal/workflow/workflow.go`) but several planned features are not yet implemented. This issue tracks deferred functionality that should be built as the system matures. ## Current State **Implemented:** - Database schema (item_approvals, approval_signatures) - YAML-configurable workflows (engineering-change, quick-review) - Create approval with signers - Sign (approve/reject) with auto-state-advancement - SSE events (approval.created, approval.signed, approval.completed) - GET /api/workflows listing **Not implemented (this issue):** ## 1. Approval Delegation / Proxy Signing Allow a signer to delegate their approval to another user. - `POST /api/items/{pn}/approvals/{id}/delegate` — signer delegates to another user - Delegated user appears in signatures with `delegated_by` field - Original signer can still sign (delegation is additive, not exclusive) - Workflow evaluation treats delegated signatures the same as direct ones ## 2. Email / Notification Integration Notify signers when they have pending approvals. - On `approval.created`: send notification to all listed signers - On `approval.signed`: notify remaining unsigned signers and the creator - On `approval.completed`: notify all participants - Notification channel configurable: SSE only (current), email, webhook - Config: ```yaml approvals: notifications: email: enabled: false smtp_host: "" webhook: enabled: false url: "" ``` ## 3. Lifecycle State Tie-Ins Automatically transition item lifecycle state based on approval outcomes. - When an approval using the `engineering-change` workflow completes with `approved`: - Transition item lifecycle from `review` → `released` (if item has .kc metadata with lifecycle) - Create a new revision tagged as "released" - When rejected: transition to `rejected` or back to `draft` - Configurable per workflow via YAML: ```yaml workflow: name: engineering-change on_approved: lifecycle_transition: released on_rejected: lifecycle_transition: draft ``` ## 4. Approval Templates Pre-filled signer lists per workflow for common approval patterns. - `POST /api/approval-templates` — create template (name, workflow, default signers) - `GET /api/approval-templates` — list templates - Templates can be selected in the UI to auto-populate the signer list - Templates are per-organization, not per-item ## 5. Bulk Approval Operations Approve/reject multiple items in one action. - `POST /api/approvals/bulk-sign` — sign multiple pending approvals at once - Useful for release managers who review batches ## 6. Web UI No approval UI exists. Needed: - Approvals page listing all pending approvals (filterable by state, workflow, item) - Item detail panel showing approval status and signature progress - Sign/reject buttons with comment field - Approval creation form (select workflow, add signers) - Approval history view Partially covered by #147 (metadata tab scaffolds an approvals page placeholder). ## 7. Session Override Workflow (from #167) The `session-override` workflow (#167) adds approval-gated force-release for edit sessions. This requires: - Approval creation triggered by non-item actions (currently approvals are item-scoped) - Approval completion callback that triggers a side effect (session release) - This may require extending the approval model to support `resource_type` + `resource_id` rather than just `item_id` ## Priority | Feature | Priority | Depends On | |---------|----------|------------| | Web UI | P1 | #147 | | Lifecycle tie-ins | P1 | .kc metadata (Phase 1) | | Notifications | P2 | SMTP config | | Delegation | P2 | None | | Templates | P3 | Web UI | | Bulk operations | P3 | Web UI | | Session override | P2 | #167 | ## Acceptance Criteria This is a tracking issue. Individual items should be broken into separate issues when prioritized for implementation.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kindred/silo#169