Skip to content

feat(vscode): regenerate local.settings.json, host.json, and workflow-designtime for source-controlled Logic App projects#9377

Open
lambrianmsft wants to merge 8 commits into
Azure:mainfrom
lambrianmsft:lambrianmsft/localsettings_regeneration
Open

feat(vscode): regenerate local.settings.json, host.json, and workflow-designtime for source-controlled Logic App projects#9377
lambrianmsft wants to merge 8 commits into
Azure:mainfrom
lambrianmsft:lambrianmsft/localsettings_regeneration

Conversation

@lambrianmsft

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

TL;DR: When a Logic App project has source control enabled, the git-ignored artifacts — the project-root local.settings.json and the workflow-designtime/ folder (and, when missing, the root host.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, and connections.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 root local.settings.json key order with the creation path, and validates the workflow-designtime contents (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

  • Users: Source-controlled Logic App projects that were missing local.settings.json / workflow-designtime (and root host.json) now self-heal on activation/design-time start, so the project is valid and the designer works without manual regeneration.
  • Developers: New exported helpers in validateProjectArtifacts.ts (regenerateLocalSettings, regenerateRootHostFile, regenerateDesignTimeDirectory, validateDesignTimeDirectory, validateAndRegenerateProjectArtifacts) wired into startDesignTimeApi / promptStartDesignTimeOption. Regeneration reuses the same content baselines as the workspace creation path.
  • System: Regeneration only writes when a file is missing or invalid; valid artifacts are left untouched (no redundant writes). No changes to workflow serialization, the designer runtime, or public package APIs.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in:

Unit tests (apps/vs-code-designer, Vitest):

  • validateProjectArtifacts.test.ts — 27 tests. Characterizes the exact content of root and design-time local.settings.json and host.json for both codeless and codeful logic apps (locking pre-change behavior against regression), plus covers validateDesignTimeDirectory invalid-settings cases and the validateAndRegenerateProjectArtifacts orchestrator (all-missing regenerates all three artifacts; all-valid writes nothing; only-root-host-missing regenerates just root host.json).
  • startDesignTimeApi.test.ts — 18 tests, including the promptStartDesignTimeOption activation wiring (regenerates per detected folder; logs and skips when no logic app folders / no workspace folders).
  • Combined: 45 tests passing; Biome clean.

Manual testing: Verified on a source-controlled project with local.settings.json, workflow-designtime/, and root host.json removed — 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__/.

github-actions Bot and others added 8 commits June 22, 2026 17:42
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>
Copilot AI review requested due to automatic review settings July 8, 2026 23:24
@lambrianmsft lambrianmsft added the risk:medium Medium risk change with potential impact label Jul 8, 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.

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.ts helpers to validate/regenerate root host.json, root local.settings.json (including referenced @appsetting(...) keys), and workflow-designtime/ contents.
  • Wired artifact validation/regeneration into startDesignTimeApi and 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.

Comment on lines 201 to 204
// Add codeful-specific settings
if (isCodeful) {
Object.assign(baseSettings.Values, {
WORKFLOW_CODEFUL_ENABLED: 'true',
});
values[workflowCodefulEnabled] = 'true';
}

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.

+1, the extension bundle id can be removed from other path

Comment on lines +251 to +263
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;
}
}
Comment on lines +326 to +329
// When the project path already points inside the design-time directory, use it directly.
if (projectPath.includes(designTimeDirectoryName)) {
return Uri.file(projectPath);
}
Comment on lines 201 to 204
// Add codeful-specific settings
if (isCodeful) {
Object.assign(baseSettings.Values, {
WORKFLOW_CODEFUL_ENABLED: 'true',
});
values[workflowCodefulEnabled] = 'true';
}

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.

+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.

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.

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:

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.

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.'

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium Medium risk change with potential impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants