Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

Problem

The Look_for_Deleted_Environments action incorrectly marks all environments as deleted due to unreliable object comparison in Power Automate's contains() function.

Current buggy logic:

// Compares: contains([{EnvtName:"env1"}, {EnvtName:"env2"}], {EnvtName:"env1"})
"where": "@not(contains(body('Parse_Actual_-_Deleted_Envts'), item()))"
// Object equality fails → all environments marked deleted

Changes

Flow Logic (AdminSyncTemplatev4Driver)

1. Select action - Output strings instead of objects:

- "select": {"EnvtName": "@item()?['name']"}
+ "select": "@item()?['name']"

Result: ["env1", "env2"] instead of [{"EnvtName":"env1"}, ...]

2. Parse schema - Match string array type:

- "items": {"type": "object", "properties": {"EnvtName": {"type": "string"}}}
+ "items": {"type": "string"}

3. Query comparison - Compare environment name string to string array:

- "where": "@not(contains(body('Parse_Actual_-_Deleted_Envts'), item()))"
+ "where": "@not(contains(body('Parse_Actual_-_Deleted_Envts'), item()['EnvtName']))"

Impact

  • No breaking changes - Backward compatible
  • No configuration changes - Environment variables unchanged
  • Data correction - Next Driver run will reset admin_environmentdeleted flags correctly

Documentation

Added comprehensive guides covering user resolution, technical analysis, and release notes.

Original prompt

This section details on the original issue you should resolve

<issue_title>[CoE Starter Kit - BUG] INVENTORY FLOW HAS MARKED ALL ENVIRONMENTS AT DELETED</issue_title>
<issue_description>### Does this bug already exist in our backlog?

  • I have checked and confirm this is a new bug.

Describe the issue

URGENT- running the Admin Sync Template V4 (Driver) Flow has caused all my environments to be marked as deleted and I am now worried the CoE will delete all of my environments. Please help.

Expected Behavior

No response

What solution are you experiencing the issue with?

Core

What solution version are you using?

4.5

What app or flow are you having the issue with?

Admin - Sync Template V4 (Driver)

What method are you using to get inventory and telemetry?

None

Steps To Reproduce

No response

Anything else?

No response</issue_description>

<agent_instructions>Analyze why running Admin | Sync Template V4 (Driver) in CoE Core 4.50 causes all environments to be marked as ‘Deleted’. Identify the root cause and confirm whether this is only a sync‑flag issue or if it risks actual environment deletion. Provide immediate corrective steps to stop the incorrect ‘Deleted’ status and restore accurate environment records.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Custom agent used: CoE Custom Agent
Specialized agent for triaging and fixing issues in the CoE Starter Kit. Always consult the official CoE docs and the team’s SharePoint notes first, then mine prior GitHub issues and the CoE Common Responses playbook.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 23, 2026 06:42
…ate V4 Driver

Fix bug where all environments were incorrectly marked as deleted due to faulty object comparison in the Look_for_Deleted_Environments action. Changed to use string array comparison instead of object comparison for reliable matching.

Changes:
- Modified Select_Actual_-_Deleted_Envts to output string array instead of object array
- Updated Parse_Actual_-_Deleted_Envts schema to match string array format
- Fixed DeletedEnvts Query to compare environment name strings instead of objects

This resolves the issue where contains() function failed to match objects, causing all environments to be marked as deleted.

Co-authored-by: AmarSaiRam <220305901+AmarSaiRam@users.noreply.github.com>
Added three documentation files:
1. ISSUE_RESPONSE_ALL_ENVIRONMENTS_DELETED.md - GitHub issue response template
2. RELEASE_NOTES_ENVIRONMENT_DELETION_FIX.md - Release notes for the fix
3. ISSUE_RESPONSE_ENVIRONMENTS_MARKED_DELETED.md - User-facing guide
4. TECHNICAL_ANALYSIS_ENVIRONMENT_DELETION_BUG.md - Technical deep-dive

These documents provide complete guidance for users, support staff, and developers on understanding, applying, and preventing this bug.

Co-authored-by: AmarSaiRam <220305901+AmarSaiRam@users.noreply.github.com>
Added comprehensive summary documents:
- FIX_SUMMARY.md - Complete fix overview and deployment plan
- ISSUE_RESPONSE_FOR_REPORTER.md - Direct response for issue reporter

All documentation now complete with:
- User-facing guides
- Technical analysis
- Issue response templates
- Release notes
- Deployment guidance

Co-authored-by: AmarSaiRam <220305901+AmarSaiRam@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix bug that marks environments as deleted in inventory flow Fix environment deletion detection: replace object comparison with string comparison Jan 23, 2026
Copilot AI requested a review from AmarSaiRam January 23, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CoE Starter Kit - BUG] INVENTORY FLOW HAS MARKED ALL ENVIRONMENTS AT DELETED

2 participants