Skip to content

simplify(api): consolidate Work and Workflow operation decoding and result projection #4186

Closed

Description

@ScriptedAlchemy

Problem

Work and Workflow describe the same closed operations repeatedly: mounted names/routes, daemon request variants, CLI request decoding, CLI result matching, HTTP decode/invoke arms, and HTTP result selectors. Workflow alone has 16 operations repeated across these layers; Work has a larger equivalent mapping. Adding an operation requires several synchronized mechanical edits.

The CLI also converts each typed ApplicationOutcome<T> into JSON and immediately deserializes the entire envelope back into ApplicationOutcome<Value>. Only its payload needs type erasure; receipts, authority, execution and other envelope fields already have the required types.

Evidence at reviewed commit 30c23baa1967d4bb04aee3f20deb7a19f302ba61:

Change

Extend an existing closed operation-row declaration, or place concrete shared decoding/projection helpers at the current dependency boundary, so each request DTO/invocation variant/result projector is declared once. Migrate both CLI and daemon HTTP adapters, then delete their duplicated tables and selectors. Keep dependency direction explicit; this is a bounded consolidation, not a new extensible registry framework.

Add a fallible counterpart to ApplicationOutcome::map_payload if necessary and serialize only the payload to Value. Remove whole-envelope serialization/deserialization from erase_workflow_outcome and erase_work_outcome.

Acceptance criteria

  • Every currently mounted Work/Workflow operation remains reachable through its real CLI and HTTP/MCP callers.
  • Unknown request fields and mismatched operation/result variants still fail closed.
  • Request and binding IDs, result schema revisions, resolved scope, receipts, touched-file metadata, and durable settlement/delivery acknowledgments remain exact.
  • Focused behavioral coverage proves representative typed read and mutation journeys plus malformed/mismatched outcomes; use Bazel and avoid tests that merely count rows or scan source text.
  • Complete the caller cutover and delete obsolete mapping code in the same delivery slice.

Verification and coordination

This is based on source and production-caller inspection; no build or test was run. No duplicate open issue or PR was found. Merged #4158 owns Work writer-job migration. Coordinate adapter signature changes with the separate typed MCP settlement simplification while keeping storage execution and public wire shapes unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions