feat(mcp): implement P4 governed export and promotion of runtime workflow proposals - #1110
Merged
Merged
Conversation
…flow proposals Adds a non-mutating export of a completed runtime workflow proposal into a human-reviewable candidate workflow artifact, and a pure assembly step into a registrable WorkflowDefinition once a reviewer assigns identity — promotion still goes through the existing, unchanged WorkflowRegistry::register / traverse-cli workflow register path. - traverse-mcp::tools::workflow_promotion: export_workflow_candidate (only from a Succeeded trace; carries per-node risk metadata and proposal/snapshot digest provenance; best-effort reduces mappings whose source/target JSON-Pointer paths share a leaf segment into WorkflowNode's from_workflow_input/to_workflow_state shared-state model, flagging anything else as unconfirmed_mappings rather than guessing; never reads initial_input or approval material, recording both as excluded_fields for audit); finalize_candidate_into_definition (reviewer-supplied identity only, never inferred from the proposal). - Honestly surfaces two real gaps in the existing WorkflowDefinition v0.1 format rather than working around them: it supports only a single direct outgoing edge per node (a branching proposal's candidate correctly fails registration, proven by a dedicated test), and its input/output model shares named top-level state keys with no rename step (a renamed field is flagged unconfirmed, not silently miswired). - workflow_promotion_tests.rs proves the full spec 112 DoD chain against the real traverse_registry::WorkflowRegistry: export a completed proposal's trace, finalize it with a reviewer identity, register it, and confirm discovery via find_exact and discover. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #1094 per spec
112-governed-workflow-promotionFR-001 throughFR-004: the non-mutating export and human-reviewed promotion path from a
completed P1 runtime workflow proposal to a reusable, versioned workflow.
No new registration mechanism is introduced — promotion still goes through
the existing, unchanged
traverse_registry::WorkflowRegistry::register/traverse-cli workflow registerpath.traverse-mcp::tools::workflow_promotion:export_workflow_candidatebuilds a plain, serializable
WorkflowCandidateArtifactfrom a proposalwhose trace reached
Succeeded(FR-001) — never touches a registry orapp manifest. It carries proposal/snapshot digest provenance, each
node's resolved
RiskMetadatafor reviewer visibility (FR-002a), andbest-effort reduces mappings whose source/target JSON-Pointer paths
share a leaf segment into
WorkflowNode'sfrom_workflow_input/to_workflow_stateshared-state model — anything else (a rename, or anested path with a different leaf name) is listed in
unconfirmed_mappingsfor the reviewer to resolve rather than guessedat. It never reads
initial_inputor approval-token material, recordingboth in a fixed
excluded_fieldsaudit list.finalize_candidate_into_definitionassembles a registrableWorkflowDefinitionfrom the candidate plus aPromotedWorkflowIdentitya human reviewer supplies (
id,name,version,owner,lifecycle,summary,tags) — never inferred from the source proposal (FR-003).Performs no registration itself.
WorkflowDefinitionv0.1 format aresurfaced honestly rather than worked around: it supports only a single
direct outgoing edge per node (a branching proposal's candidate
correctly fails registration — proven by
a_branching_proposals_candidate_is_honestly_unregistrable), and itsinput/output model has no rename step (proven by
export_flags_a_renamed_mapping_as_unconfirmed).workflow's
Lifecycleis the same, only lifecycle mechanismWorkflowRegistryalready has for hand-authored workflows.workflow_promotion_tests.rs'sexport_then_promote_then_discover_end_to_endproves the full spec 112Definition-of-Done chain against the real
traverse_registry::WorkflowRegistry(not a mock): export → finalizewith a reviewer identity → register → confirm discovery via
find_exactanddiscover.docs/governed-workflow-promotion.mddocuments the design, bothsurfaced format gaps, and why no active secret-scanning is needed (the
candidate is built exclusively from fields already proven secret-free by
construction —
ProposalTraceand everything butinitial_input).Closes #1094
Governing Spec
112-governed-workflow-promotion070-runtime-event-sink-boundaryProject Item
Project 1 item for #1094:
PVTI_lADOEbiBt84Bbyp1zg3fR9I(In Progress).Validation
cargo test --workspace— all suites pass, including 5 new tests forexport/finalize/promotion covering success, rejection of a
non-succeeded trace, mapping-rename detection, risk preservation, and
the branching-format-gap rejection.
cargo clippy --workspace --all-targets— clean.cargo fmt --check— clean.bash scripts/ci/coverage_gate.sh— passes:traverse-mcpat 99.13%(> 98% threshold);
traverse-contracts/traverse-runtimeunaffectedand still at 100.00% (this PR touches neither crate).
bash scripts/ci/spec_alignment_check.sh— clean against this PR body.Non-goals
Matches spec 112's own "Out of scope": direct runtime publication,
automatic promotion, or bypassing human review. Nothing in this PR calls
WorkflowRegistry::registeritself, opens a PR against the registry, orgrants a proposal any ongoing execution authority.