Skip to content

fix(standalone): prefer current production over stale drafts - #9675

Merged
Krrish Mittal (takyyon) merged 7 commits into
mainfrom
rllyy97-draft-freshness-investigation
Nov 4, 2026
Merged

Krrish Mittal (takyyon) merged 7 commits into
mainfrom
rllyy97-draft-freshness-investigation

Conversation

@rllyy97

@rllyy97 Riley Evans (rllyy97) commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

Prefer current production artifacts over older/equally dated saved drafts in the Azure-connected Standalone V2 hosts. Preserve newer drafts; retain existing drafts with a diagnostic when timestamps cannot be compared.

Standalone runtime only: this is not a deployed Portal customer fix or an inactive-badge fix. This is the host-parity companion to the Portal investigation in #9669/#9674. The primary Portal Consumption initializer fix and its PR remain separate.

Standard selects workflow, notes, connections and parameters consistently using VFS metadata. Saves preserve raw app-setting references, knowledge-hub connections and genuine local edits, retain unrelated draft-only entries in app-wide shared files, and honor direct/Copilot parameter deletions. Missing-workflow initialization leaves existing shared files intact and remains single-flight through refetches. Discard resets local connection state and suspends queued autosaves until reset completes; a failed reset preserves the mounted editor and resumes pending autosave without requiring another edit. Monitoring initializes historical content without subsequent artifact refreshes replacing it, and reloads current sources before returning to editing. Both hosts save superseded server drafts before running; Consumption save failures abort the run. Read-only users cannot reconcile a superseded draft, so its Run button is disabled with guidance to switch to published mode; newer drafts and published runs remain available.

Impact of Change

  • Users: Azure-connected Standalone Standard and Consumption designers open/run current artifacts rather than superseded drafts. Genuinely newer drafts remain editable. Stale persisted draft content is reconciled on the next save, not overwritten during a read.
  • Developers: The content-only custom-code hook retains its data/refetch shape; a metadata-aware hook enables Standard freshness selection. Host tests use real React Query/Redux; actual run-button and command-bar tests cover save/run/reset ordering and failure recovery.
  • System: Changes affect Standalone artifact loading, draft persistence, monitoring and run flows. Connections/parameters remain app-wide, with production/current values winning matching names. No new dependencies or published-library runtime changes; shared-library changes are tests only. Risk is conservatively High because several artifact-persistence surfaces are involved.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in: Vitest/JSDOM: old/equal/newer and invalid timestamps, all four artifacts, save/reopen, raw app-setting references, immediate knowledge-hub persistence, shared draft-only entries, missing/empty shared drafts, single-flight initialization, discard state/failure recovery, direct/Copilot parameter renames, initial monitoring and refresh failures, forced-save-before-run ordering/failure, readonly draft/published behavior, and queued/in-flight autosave versus discard.

Latest validation, head 9684164a4:

  • From root: pnpm --dir apps\Standalone exec vitest run --config vite.config.ts src\designer\app\AzureLogicAppsDesigner\Utilities\__test__\draftArtifacts.spec.ts src\designer\app\AzureLogicAppsDesigner\Services\__test__\workflowCustomCode.spec.tsx src\designer\app\AzureLogicAppsDesigner\__test__\laDesignerV2.draftFreshness.spec.tsx src\designer\app\AzureLogicAppsDesigner\__test__\laDesignerConsumptionV2.draftFreshness.spec.tsx src\designer\app\AzureLogicAppsDesigner\__test__\DesignerCommandBarV2.draftSafety.spec.tsx --reporter=dot — passed, 47 tests.
  • From root: npx --no-install biome check --write apps\Standalone\src\designer\app\AzureLogicAppsDesigner\DesignerCommandBarV2.tsx apps\Standalone\src\designer\app\AzureLogicAppsDesigner\laDesignerV2.tsx apps\Standalone\src\designer\app\AzureLogicAppsDesigner\__test__\DesignerCommandBarV2.draftSafety.spec.tsx apps\Standalone\src\designer\app\AzureLogicAppsDesigner\__test__\laDesignerV2.draftFreshness.spec.tsx — passed. Commit hooks passed extraction, ESLint and Biome.
  • git diff --cached --check — passed before the review-fix commit.
  • pnpm exec tsc --noEmit -p apps\Standalone\tsconfig.json — failed on existing baseline errors, including missing BaseCognitiveServiceService.foundryProxyBaseUrl and undefined getHostConfig. Both also exist in origin/main; no new diagnostics were reported in changed implementation/test paths.

Earlier integration validation (unchanged shared-library tests):

  • From libs/designer-v2: pnpm exec vitest run src\lib\ui\FloatingRunButton\__tests__\floatingRunButton.spec.tsx --coverage.enabled=false --reporter=dot — passed, 36 tests, using the same package setup/restoreMocks configuration as CI. Mock defaults are re-established in beforeEach; no CI settings or coverage gates changed.
  • From root: pnpm exec vitest run --config apps\Standalone\src\designer\app\AzureLogicAppsDesigner\__test__\vitest.config.ts — passed, 197 tests before review-fix updates, including neighboring Standard management integration tests.
  • Previous head 3f946d696: Test Runner (Node20/22/24), PR Coverage, Playwright designer/chat shards, VS Code E2E summary, CodeQL and latest description validations — passed. Its completed substantive AI review found failed reset canceling pending autosave; addressed with the implementation and two regressions in 9684164a4. Fresh latest-head CI and substantive AI re-review are pending.

Live Azure/E2E testing and a full local production build were not run. The PR coverage report says no source files changed within its configured coverage scope: Standalone sources are outside that gate and shared-library changes are test-only. No thresholds/exclusions are changed. Latest-head CI and substantive AI re-review are monitored separately from description validation.

Contributors

Riley Evans (@rllyy97), with Copilot assistance.

Screenshots/Videos

N/A — artifact selection/persistence and disabled-state behavior changes, not visual/style changes.

Riley Evans (rllyy97) and others added 2 commits October 28, 2026 12:45
Select workflow and companion artifacts consistently across Standard and Consumption, preserve local connection edits, and refresh both sources before leaving monitoring.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 28, 2026 17:53
@rllyy97 Riley Evans (rllyy97) added the risk:medium Medium risk change with potential impact label Oct 28, 2026
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

✅ PR Title

  • Current: fix(standalone): prefer current production over stale drafts
  • Issue: The title is specific, uses a clear conventional-commit format, and accurately describes the primary behavior change.
  • Recommendation: No change required.

✅ Commit Type

  • Properly selected (fix).
  • Only one commit type is selected, and the implementation addresses stale-draft behavior and related failure cases.

✅ Risk Level

  • The PR correctly selects High risk, and the risk:high label matches the body.
  • The advised risk level from the diff is high because the change spans Standalone Standard and Consumption artifact loading, draft persistence, connection and parameter reconciliation, monitoring transitions, discard/autosave ordering, and run behavior. The submitter's estimate is accurate.

✅ What & Why

  • Current: The section clearly explains that current production artifacts should take precedence over stale drafts while newer drafts and uncomparable timestamps are preserved. It also documents the affected persistence, monitoring, run, discard, and read-only behaviors.
  • Issue: No required information is missing. The section is lengthy, but the additional detail is appropriate for a high-risk persistence change.
  • Recommendation: No change required. If shortening in the future, retain the precedence rules, timestamp fallback behavior, and save/reset failure semantics.

✅ Impact of Change

  • The Users, Developers, and System impacts are all present and aligned with the code changes.
  • Recommendation:
    • Users: No change required; the impact on Standalone Standard and Consumption designers, read-only users, stale drafts, and newer drafts is clearly stated.
    • Developers: No change required; the affected hooks, host tests, and command-bar behavior are identified.
    • System: No change required; the persistence surfaces, dependency impact, and high-risk rationale are documented.

✅ Test Plan

  • Unit tests are marked and backed by substantial test additions and updates in the diff, including artifact freshness, custom-code metadata, Standard and Consumption designer behavior, command-bar discard/autosave behavior, and run-button behavior.
  • The reported TypeScript failure is explicitly identified as a pre-existing baseline issue with no new diagnostics in changed paths, so it does not fail the test-plan requirement.

⚠️ Contributors

  • The contributor section credits @rllyy97 and notes Copilot assistance.
  • Consider also crediting any PMs, designers, reviewers, or other contributors who provided requirements or feedback. This is optional and does not block approval.

✅ Screenshots/Videos

  • Correctly marked N/A; the changes concern artifact selection, persistence, run safety, and disabled-state behavior rather than visual or styling changes.

Summary Table

Section Status Recommendation
Title ✅ No change required
Commit Type ✅ Keep only fix selected
Risk Level ✅ Keep High risk and risk:high label
What & Why ✅ No change required
Impact of Change ✅ No change required
Test Plan ✅ Unit-test coverage is present in the diff
Contributors ⚠️ Optionally credit PMs, designers, and reviewers
Screenshots/Videos ✅ N/A is appropriate

The PR title and body pass review. The advised risk is High, matching the submitter's estimate and label.


Powered by: Logic App (fallback) | Last updated: Thu, 29 Oct 2026 17:41:14 GMT

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Check

No source files changed in this PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The changes can drop existing knowledge-hub connections and overwrite app-wide draft files, deleting unrelated edits needed by other workflows.

2 open issues
What changed in this PR

This PR updates the Azure-connected Standalone V2 designers to prefer production artifacts over older or equally dated drafts while preserving newer drafts. It complements the Portal investigations in #9669 and #9674 without changing Portal or inactive-badge behavior.

Changes:

  • Adds timestamp-based artifact selection for Standard and Consumption.
  • Updates Standard companion persistence, connection merging, and monitoring-to-edit refresh behavior.
  • Adds regression tests and documents draft selection behavior.
File Description
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​Utilities/​draftArtifacts.ts Adds freshness comparison and connection merging helpers.
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​Utilities/​__test__/​draftArtifacts.spec.ts Tests timestamp comparisons and connection merging.
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​Services/​WorkflowAndArtifacts.tsx Exposes VFS metadata while preserving the content-only hook.
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​Services/​__test__/​workflowCustomCode.spec.tsx Tests metadata, shared queries, and hook compatibility.
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​Models/​Workflow.ts Adds optional workflow modification time.
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​laDesignerV2.tsx Updates Standard artifact selection, saving, and monitoring refresh.
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​laDesignerConsumptionV2.tsx Selects Consumption artifacts using modification times.
apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​__test__/​laDesignerV2.draftFreshness.spec.tsx Tests Standard selection, persistence, and refresh outcomes.
apps/​Standalone/​README.md Documents Azure-connected draft behavior.

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved critical defects can execute stale drafts, delete other workflows’ draft-only connections, and overwrite subsequent saves during initialization.

5 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Rebase local connections after discard

apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​laDesignerV2.tsx:328

Discard writes production connections but leaves locally mutated connectionsData intact, so the refetch merge preserves an unsaved connection edit and a later save can persist it again. Rebase the local connection state and comparison baseline during explicit reset while retaining unrelated shared draft entries. Add a regression assertion on the post-refetch editor state, not only the deployment payload.

1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A failed Consumption draft save can still run the stale server-side draft, while Standard V2 has regressions that leave initially monitored workflows blank and restore parameters deleted or renamed by Copilot.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Initialize monitoring from selected run without overwriting history

apps/​Standalone/​src/​designer/​app/​AzureLogicAppsDesigner/​laDesignerV2.tsx:781

Opening Standard V2 with monitoring already enabled (for example, through loadLastWorkflow) now leaves the canvas and command bar blank. This guard blocks initialization, while the run-definition effect also leaves an undefined workflow unchanged. Initialize the workflow from the selected run on first load, while preventing later artifact refreshes from overwriting its historical definition, and add an initially-monitoring regression test.

5 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rllyy97
Riley Evans (rllyy97) requested a balanced review from Copilot October 28, 2026 22:21
@rllyy97 Riley Evans (rllyy97) added risk:high High risk change requiring careful review and removed risk:medium Medium risk change with potential impact labels Oct 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because read-only draft runs can execute stale server content, while queued autosaves can overwrite resets with discarded edits.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@rllyy97
Riley Evans (rllyy97) requested a balanced review from Copilot October 29, 2026 15:25
@rllyy97

Copy link
Copy Markdown
Contributor Author

Addressed both human-assessment concerns in the latest completed AI review summary in 3f946d6. Read-only users cannot run a superseded saved draft (which cannot be reconciled without a write); both hosts explain how to switch to the published version, while newer drafts remain runnable. Draft autosave is suspended while asynchronous discard resets the workflow, including queued callbacks; discard remains disabled through an in-flight save. Real command-bar tests hold the reset/save promises across timer advances and verify write ordering, and both host suites cover read-only old/newer drafts and published-mode recovery. All 45 targeted host/helper/command-bar tests pass. A fresh latest-head AI review and CI are pending; this remains a Standalone-only companion, not the Portal customer fix.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Clearing needsSaved cancels queued autosave even when reset fails and leaves dirty edits mounted, preventing those edits from autosaving until another edit occurs.

1 open issue

Review effort: Balanced

Propagate Standard reset failures to the command bar and restore pending saves for retained edits without enabling writes during reset.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Human assessment is needed because save/discard races can restore and execute discarded workflows, while stale editor saves can delete shared connections and parameters added by another editor.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@takyyon
Krrish Mittal (takyyon) merged commit 897e813 into main Nov 4, 2026
51 checks passed
@takyyon
Krrish Mittal (takyyon) deleted the rllyy97-draft-freshness-investigation branch November 4, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:high High risk change requiring careful review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants