Skip to content

feat: workflow merge compatibility#1075

Merged
josephjclark merged 7 commits intorelease/nextfrom
980-sandbox-add-versioning-and-version-history-checking
Oct 24, 2025
Merged

feat: workflow merge compatibility#1075
josephjclark merged 7 commits intorelease/nextfrom
980-sandbox-add-versioning-and-version-history-checking

Conversation

@doc-han
Copy link
Copy Markdown
Collaborator

@doc-han doc-han commented Oct 20, 2025

Short Description

Informs whether a workflow can be merged into a target workflow without losing any information/changes on target

Fixes #980

Implementation Details

Adds a method to the workflow class called canMergeInto(target). Hence you pass the workflow you want to merge into as argument to the function which exist on another workflow(your source)

A more detailed breakdown of the changes, including motivations (if not provided in the issue).

QA Notes

List any considerations/cases/advice for testing/QA here.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

Release branch checklist

Delete this section if this is not a release PR.

If this IS a release branch:

  • Run pnpm changeset version from root to bump versions
  • Run pnpm install
  • Commit the new version numbers
  • Run pnpm changeset tag to generate tags
  • Push tags git push --tags

Tags may need updating if commits come in after the tags are first generated.

@doc-han doc-han linked an issue Oct 20, 2025 that may be closed by this pull request
@github-project-automation github-project-automation bot moved this to New Issues in Core Oct 20, 2025
@doc-han doc-han requested a review from josephjclark October 20, 2025 10:17
@doc-han doc-han force-pushed the 980-sandbox-add-versioning-and-version-history-checking branch from b10c2c1 to d33ce05 Compare October 20, 2025 12:40
// return true if the current workflow can be merged into the target workflow without losing any changes
canMergeInto(target: Workflow) {
if (!target.history.length) return true;
const targetHead = target.history[target.history.length - 1];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question: is the head the last history, or whatever the current actual version is?

@josephjclark
Copy link
Copy Markdown
Collaborator

TODO: add serialization of histories

t.true(sourceWf.canMergeInto(targetWf)); // allowed
});

test('canMergeInto: empty target history', (t) => {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's interesting

The target actually NEVER has an empty history - the head is just the current version (not the last history).

In this use-case, changes in the target (main) will be lost if they happen to not have been added to the source (staging). And because of this risk, canMergeInto should throw

This makes me think that using the current latest, not the history head, is actually what we wan

this.workflow = clone(workflow);

// history needs to be on workflow object.
this.workflow.history = workflow.history?.length ? workflow.history : [];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.workflow.history = workflow.history ?? []

@josephjclark josephjclark changed the base branch from main to release/next October 22, 2025 16:05
@josephjclark josephjclark merged commit ee6086f into release/next Oct 24, 2025
6 checks passed
@josephjclark josephjclark deleted the 980-sandbox-add-versioning-and-version-history-checking branch October 24, 2025 14:29
@github-project-automation github-project-automation bot moved this from New Issues to Done in Core Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

sandbox: add versioning and version history checking

3 participants