feat(flow-schema): add flow version diff#34
Merged
Conversation
Add diffFlows(before, after): a structural, authoring-only diff between two flows for "what changed since the last publish?". Compares decoded Flow objects, so comment/key-order churn and the flow-level stamps publish rewrites (version, id, name, ui) never register — only added, removed, and edited nodes, and a moved entry. Each modified node carries field-level changes with dot-paths: top-level fields, per-exit (exits.no_answer), per-menu-option (options.1), and a synthetic entry pseudo-field when the start marker moves. Raw before/after values only; presentation (labels, colours) stays with consumers. TS-only, like mutate.ts — the engine never diffs, so no Rust twin. Co-Authored-By: Claude Opus 4.8 (1M context) <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.
What
Adds
diffFlows(before, after)to@wavekat/flow-schema— a structural, authoring-only diff between two flows answering "what changed since the last publish?". TS-only, likemutate.ts(the engine never diffs, so no Rust twin).Motivating consumer: the platform flow editor wants to highlight which nodes have unpublished changes and show, per node, what's different. Today the only signal is the server's byte-compare
draftDirtyboolean, which carries no per-node info and false-positives on formatting/stamp churn.Shape
Each
modifiednode carriesFieldChange[]with dot-paths — top-level fields (prompt,timeout_secs), per-exit (exits.no_answer), per-menu-option (options.1), and a syntheticentrywhen the start marker moves. Rawbefore/aftervalues only; labels/colours stay with consumers.Design
Flowobjects, so comment/key-order churn and the flow-level stamps publish rewrites (version,id,name,ui) never register.entrychange, so a UI highlights exactly what visually moved.Tests
test/diff.test.ts— 11 cases: added / removed / modified, exit rewire, menu option relabel, prompt change, entry move, structural-equality (comment + key reorder), stamp-ignore, added optional field. Full package suite: 99/99 green;typecheck+buildclean, soprepublishOnlypasses.Release
Ships as
@wavekat/flow-schema0.0.8via release-please on merge. The platform then bumps its dep and wires the presentation layer.🤖 Generated with Claude Code