feat(vscode): regenerate local.settings.json, host.json, and workflow-designtime for source-controlled Logic App projects#9377
Conversation
Auto-generated by Graphify after source code changes. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…t for logic app types Add golden/characterization coverage that pins the exact content of the project-root and workflow-designtime local.settings.json schemas (getLocalSettingsSchema) across the codeless/codeful axis, plus the codeful creation path in CreateLogicAppWorkspace. Expected values are reconstructed from the shared key/value constants so structural regressions are caught while staying in sync with the codebase. These tests exercise pre-existing behavior (source unchanged from main) and lock it in before the regeneration feature. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…for source-controlled projects
When source control is enabled, the project-root local.settings.json and the
workflow-designtime folder are gitignored, so a fresh clone lacks them and the
design-time host cannot start. Add validateProjectArtifacts to detect and
regenerate these artifacts:
- Scan connections.json, parameters.json and workflows for @appsetting('X')
references and ensure the root local.settings.json has the baseline schema
plus placeholder entries for every referenced key (never overwriting values).
- Validate the workflow-designtime folder (host.json + local.settings.json) and
regenerate it when missing or invalid.
Wired into startDesignTimeApi so artifacts are validated/regenerated before the
host launches. Covered by validateProjectArtifacts.test.ts (incl. golden content
by logic app type, reconstructed from shared constants) and updated
startDesignTimeApi tests.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…h creation path getLocalSettingsSchema built the root (non-design-time) Values in a different key order than CreateLogicAppWorkspace.createLocalConfigurationFiles, so a regenerated local.settings.json was key-for-key reordered versus a freshly created project (e.g. APP_KIND/FUNCTIONS_WORKER_RUNTIME first instead of AzureWebJobsStorage first). Reorder the root branch to mirror the creation path (AzureWebJobsStorage, FUNCTIONS_INPROC_NET8_ENABLED, FUNCTIONS_WORKER_RUNTIME, APP_KIND, ProjectDirectoryPath, [WORKFLOW_CODEFUL_ENABLED]); design-time order is unchanged. Add key-order regression tests (toEqual ignores property order). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…esign-time dir Add a regression test for the codeful branch where workflow-designtime already exists but its host.json and local.settings.json are invalid (wrong bundle id / missing required keys). Verifies both artifacts are rewritten to the codeful baseline (host.json + local.settings.json incl. WORKFLOW_CODEFUL_ENABLED), closing the gap where only the missing-directory codeful path was covered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d projects The regeneration feature restored the root local.settings.json and the workflow-designtime folder, but never regenerated the project-level host.json. When source control strips this git-ignored file from a fresh clone the function host cannot start. Add regenerateRootHostFile (mirroring the workspace creation path host.json content) and wire it into validateAndRegenerateProjectArtifacts and promptStartDesignTimeOption. Rename isDesignTimeHostFileValid to isHostFileValid since it now validates both the root and design-time host.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds output-channel logging at every decision point in the host.json / local.settings.json regeneration flow: which files are checked and whether they exist, whether each file was regenerated or preserved, and how many logic app folders were detected. Crucially logs when zero logic app folders are detected, which happens when host.json is missing (a folder is only recognized as a logic app when host.json exists), explaining why regeneration appears to do nothing in that case. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…r, design-time settings validation, and promptStartDesignTimeOption regeneration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds “self-healing” for source-controlled Logic App projects in the VS Code designer by validating and regenerating git-ignored/missing artifacts needed to start the design-time API (project-root local.settings.json, project-root host.json when invalid/missing, and the workflow-designtime/ baseline).
Changes:
- Added
validateProjectArtifacts.tshelpers to validate/regenerate roothost.json, rootlocal.settings.json(including referenced@appsetting(...)keys), andworkflow-designtime/contents. - Wired artifact validation/regeneration into
startDesignTimeApiand activation (promptStartDesignTimeOption) with additional diagnostic logging. - Added/updated unit tests to lock down expected artifact content and regeneration behavior.
Reviewed changes
Copilot reviewed 13 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| libs/vscode-extension/src/graphify-out/GRAPH_REPORT.md | Regenerated Graphify report output. |
| libs/data-mapper-v2/src/graphify-out/GRAPH_REPORT.md | Regenerated Graphify report output. |
| libs/chatbot/src/graphify-out/graph.json | Regenerated Graphify graph JSON output. |
| libs/chatbot/src/graphify-out/GRAPH_REPORT.md | Regenerated Graphify report output. |
| libs/a2a-core/src/graphify-out/GRAPH_REPORT.md | Regenerated Graphify report output. |
| apps/vs-code-designer/src/app/utils/codeless/validateProjectArtifacts.ts | New artifact validation/regeneration implementation. |
| apps/vs-code-designer/src/app/utils/codeless/startDesignTimeApi.ts | Uses the new orchestrator for design-time startup + activation-time regeneration. |
| apps/vs-code-designer/src/app/utils/codeless/test/validateProjectArtifacts.test.ts | New unit tests covering regeneration + golden content assertions. |
| apps/vs-code-designer/src/app/utils/codeless/test/startDesignTimeApi.test.ts | Updated tests for startup + added activation wiring tests. |
| apps/vs-code-designer/src/app/utils/appSettings/localSettings.ts | Adjusted schema generation (including key ordering and codeful flag). |
| apps/vs-code-designer/src/app/utils/appSettings/test/localSettings.test.ts | Added golden tests + key-order characterization coverage. |
| apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/test/CreateLogicAppWorkspace.test.ts | Expanded coverage for codeful local.settings.json creation expectations. |
| // Add codeful-specific settings | ||
| if (isCodeful) { | ||
| Object.assign(baseSettings.Values, { | ||
| WORKFLOW_CODEFUL_ENABLED: 'true', | ||
| }); | ||
| values[workflowCodefulEnabled] = 'true'; | ||
| } |
There was a problem hiding this comment.
+1, the extension bundle id can be removed from other path
| async function isHostFileValid(hostFilePath: string): Promise<boolean> { | ||
| const content = await readFileTextSafe(hostFilePath); | ||
| if (!content) { | ||
| return false; | ||
| } | ||
|
|
||
| try { | ||
| const parsed = parseJson(content) as { version?: string; extensionBundle?: { id?: string } }; | ||
| return !!parsed?.version && parsed?.extensionBundle?.id === extensionBundleId; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } |
| // When the project path already points inside the design-time directory, use it directly. | ||
| if (projectPath.includes(designTimeDirectoryName)) { | ||
| return Uri.file(projectPath); | ||
| } |
| // Add codeful-specific settings | ||
| if (isCodeful) { | ||
| Object.assign(baseSettings.Values, { | ||
| WORKFLOW_CODEFUL_ENABLED: 'true', | ||
| }); | ||
| values[workflowCodefulEnabled] = 'true'; | ||
| } |
There was a problem hiding this comment.
+1, the extension bundle id can be removed from other path
| baseSettings.Values![azureWebJobsStorageKey] = localEmulatorConnectionString; | ||
| baseSettings.Values![functionsInprocNet8Enabled] = functionsInprocNet8EnabledTrue; | ||
| // Root order mirrors the creation path (CreateLogicAppWorkspace.createLocalConfigurationFiles) so a | ||
| // regenerated local.settings.json is key-for-key identical to a freshly created project. |
There was a problem hiding this comment.
comment says this mirrors creation path, can't we just reuse the same code to generate local settings at both places? this way they can't fall out of sync again
| }, | ||
| }, | ||
| }; | ||
| // Validate and, when needed, regenerate the project artifacts required for a valid project: |
There was a problem hiding this comment.
nit: comment not needed, this should be outlined in the function docstring. same thing for other comments in the pr
| ext.outputChannel.appendLog( | ||
| localize( | ||
| 'noLogicAppFoldersForRegen', | ||
| 'No logic app project folders were detected in the open workspace, so host.json and local.settings.json were not regenerated. A folder is only recognized as a logic app when its host.json exists; if host.json is missing, restore it (it is normally committed to source control) and reload the window.' |
There was a problem hiding this comment.
not sure I understand this log, it states that host.json is required to recognize a project as a logic app but the 'if' branch above will regenerate host.json even if it's missing for a logic app project. These seem to contradict
Commit Type
Risk Level
What & Why
TL;DR: When a Logic App project has source control enabled, the git-ignored artifacts — the project-root
local.settings.jsonand theworkflow-designtime/folder (and, when missing, the roothost.json) — are absent on a fresh clone, leaving the project in an invalid state that can't start the design-time API.This PR detects those missing/invalid artifacts and regenerates them from the existing project inputs (the logic app,
parameters.json, andconnections.json) so the project becomes valid again without manual setup. Regeneration is idempotent: valid existing files are preserved and only missing/invalid ones are rewritten. It covers both codeless and codeful logic app types, aligns the regenerated rootlocal.settings.jsonkey order with the creation path, and validates theworkflow-designtimecontents (regenerating when required keys are missing or empty). Diagnostic logging was added at each decision point to make regeneration behavior observable in the output channel.Impact of Change
local.settings.json/workflow-designtime(and roothost.json) now self-heal on activation/design-time start, so the project is valid and the designer works without manual regeneration.validateProjectArtifacts.ts(regenerateLocalSettings,regenerateRootHostFile,regenerateDesignTimeDirectory,validateDesignTimeDirectory,validateAndRegenerateProjectArtifacts) wired intostartDesignTimeApi/promptStartDesignTimeOption. Regeneration reuses the same content baselines as the workspace creation path.Test Plan
Unit tests (
apps/vs-code-designer, Vitest):validateProjectArtifacts.test.ts— 27 tests. Characterizes the exact content of root and design-timelocal.settings.jsonandhost.jsonfor both codeless and codeful logic apps (locking pre-change behavior against regression), plus coversvalidateDesignTimeDirectoryinvalid-settings cases and thevalidateAndRegenerateProjectArtifactsorchestrator (all-missing regenerates all three artifacts; all-valid writes nothing; only-root-host-missing regenerates just roothost.json).startDesignTimeApi.test.ts— 18 tests, including thepromptStartDesignTimeOptionactivation wiring (regenerates per detected folder; logs and skips when no logic app folders / no workspace folders).Manual testing: Verified on a source-controlled project with
local.settings.json,workflow-designtime/, and roothost.jsonremoved — all regenerated with correct content and stable key order on design-time start. Also verified connection-key regeneration produces valid keys.Contributors
Screenshots/Videos
Not applicable — no visual/UI changes. This is an activation-path artifact-regeneration change with unit coverage in
apps/vs-code-designer/src/app/utils/codeless/__test__/.