fix(debug-logger): 8 deploy-time hot-fixes from first smoke test (Jude Dev)#42
Merged
Conversation
…de Dev smoke test
Discovered while running provision + deploy + a programmatic
Flow-Management-API child-flow create end-to-end against Jude Dev.
End-to-end smoke test now passes (two cr_agenttrace rows written
from a manual flow trigger with cr_DebugLoggerEnabled=true).
Script fixes:
1. provision-environment.ps1 — PAC CLI 2.x compat:
'pac admin list-environments' returns 'Not a valid command' with
exit code 0, so the prior 'exit non-zero -> fallback' heuristic
never triggered. Added Test-LooksLikeJson sniff that requires
output to start with '[' or '{' before parsing.
2. provision-environment.ps1 — skip UniqueIdentifier columns:
Dataverse Web API rejects custom UniqueIdentifier attribute
creation with 0x80040203 ('cannot be created through the SDK').
The platform auto-creates <tablename>id as the PK Guid, so
schema-documented UniqueIdentifier columns (cr_traceid) are
informational only.
3. deploy-solution.ps1 — MDA precheck path:
Was 'CanvasApps/AgentDebugConsole_*' (legacy MDA folder).
Modern 'pac solution clone' unpacks MDAs under
'src/AppModules/cr_AgentDebugConsole/'. Also switched from
'Get-ChildItem -Directory' (returns CHILD dirs of the path,
not the path itself) to 'Test-Path -PathType Container'.
4. deploy-solution.ps1 — dynamic cdsproj discovery:
Glob '*.cdsproj' instead of hard-coded 'Solution.cdsproj'.
PAC clone produces '<SolutionName>.cdsproj'.
Flow fixes:
5. flow-1-log-agent-trace.json — Get_DebugLoggerEnabled operationId:
'GetEnvironmentVariableValue' doesn't exist on the Dataverse
connector. Replaced with ListRecords + filter on
environmentvariabledefinitions + expand to
environmentvariabledefinition_environmentvariablevalue
(mirrors the tool flow which was already correct).
Compose_EnabledFlag updated to read from actions(...)?['outputs']
?['body']?['value']?[0]?['environmentvariabledefinition_environmentvariablevalue']?[0]?['value']
with fallback to defaultvalue then 'false'.
6. flow-1 AND tool-log-agent-trace .json — Compose_PayloadTruncated:
left() is a Power Apps Canvas function, NOT a Workflow Definition
Language function. WDL has no left(). Replaced with
substring(string(x), 0, min(900000, length(string(x)))).
7. flow-1 AND tool-log-agent-trace .json — drop item/cr_sourcename:
Workaround for the schema collision below; the trace label
already encodes source/step_name via concat().
Schema:
8. agenttrace-table.json — cr_sourcename collision documented:
Dataverse auto-generates a Virtual column named cr_sourcename
as the formatted-value reflection of the cr_source Picklist
column. This blocks creation of the documented Text(200) and
prevents flows from writing to it. Added a 'KNOWN COLLISION'
note in the column description. Follow-up PR will rename to
cr_originname.
Source restructure:
9. src/Solutions/ — replaced Frank's R2 scaffold (empty
Solution.cdsproj + other/{Solution.xml,Customizations.xml}
+ CanvasApps/.gitkeep) with the Microsoft-canonical layout
from 'pac solution clone --name CopilotAgentDebugLogger'
(src/Entities/, src/AppModules/, src/AppModuleSiteMaps/,
src/Other/, src/environmentvariabledefinitions/,
CopilotAgentDebugLogger.cdsproj + .gitignore). The new
cdsproj uses the old-style imports rather than the SDK
alias but builds cleanly with 'dotnet build'.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
judeper
added a commit
that referenced
this pull request
May 21, 2026
… AGENTS.md convention (#43) Two motivations: 1. The autonomous build's docs were written before any of the POC artifacts had been deployed to a tenant. The first deploy (PR #42) discovered 8 bugs and surfaced 6 documentation drifts that this PR fixes. Without these refreshes, future AI agents reading the docs would replicate the same fabricated APIs, missing colliding columns, and the wrong solution layout. 2. The repo previously had no AGENTS.md convention — only .github/copilot-instructions.md at root. Establishing per-solution AGENTS.md (terse, AI-context-optimized) gives contributors a dedicated companion to the human-facing README that documents critical constraints, known issues, schema- prompt-code contract, and 'where to look first when something breaks' diagnostics. Stale-info fixes (per-file): - copilot-agent-debug-logger/README.md * File Map updated to Microsoft-canonical layout (src/Solutions/ src/Entities/, AppModules/, AppModuleSiteMaps/, etc.) replacing the obsolete Frank R2 scaffold shape (Solution.cdsproj + other/ + CanvasApps/.gitkeep). Added a layout note explaining the restructure. * cr_payload truncation reference: left(string(...)) → substring() with min()/length() (WDL-native; left() is Power Apps Canvas). * cr_sourcename data-contract row marked '_documented but not stored_' with pointer to Known Issues. * 'No managed-solution ALM' line: Solution.cdsproj → CopilotAgentDebugLogger.cdsproj * NEW 'Known Issues (deploy-time discoveries)' section with 6 items: cr_sourcename collision, env-var yes/no storage, PVA tool flow Action-add requirement, Phase-0 nested clone layout, UniqueIdentifier rejection, PAC CLI 2.x list-environments drop. Each cites its backlog todo. - copilot-agent-debug-logger/docs/phase-0-mda-authoring.md * Step 3 expected result: legacy CanvasApps/AgentDebugConsole_* path → src/Solutions/src/AppModules/cr_AgentDebugConsole/. * Step 5 cr_sourcename form-field item: noted as unwritable with pointer to Known Issues. * Sample precheck PowerShell: Get-ChildItem -Directory → Test-Path -PathType Container (correctness fix from PR #42). - copilot-agent-debug-logger/docs/maker-guide.md * Data-contract cr_sourcename row updated. * Payload-truncation pattern (Quick Start + Pattern A Common Setup + Pattern A truncation reminder) updated to WDL substring(). * Pattern C/D smoke-test row expectations: cr_sourcename = ... → cr_tracelabel begins with COPILOT_TOPIC/CoT @ or COPILOT_TOPIC/ConversationHistory @. - copilot-agent-debug-logger/docs/deployment-guide.md * Step 2 expected-source-state snippet: Get-ChildItem -> Test-Path -PathType Container; legacy CanvasApps path -> new src/Solutions/src/AppModules path. * Step 4 build description: Solution.cdsproj -> CopilotAgentDebugLogger.cdsproj. * Pattern C/D row-value expectations rewritten to match cr_tracelabel encoding. * Validation-checklist MDA-artifacts path updated to canonical layout. - copilot-agent-debug-logger/scripts/deploy-solution.ps1 * .SYNOPSIS / .DESCRIPTION / .PARAMETER docstring updated to mention the *.cdsproj auto-discovery glob (the script logic was already correct per PR #42; this catches the help text up). - .github/copilot-instructions.md * POC Constraints A15 entry updated: left() -> substring(...). * D7 MDA constraint updated: CanvasApps -> src/AppModules layout. * NEW 'Known issues from first deploy (PR #42)' bullet expanding the POC Constraints section with the 6 deploy-time discoveries. * NEW 'Per-solution AGENTS.md convention' section between Planning Structure and POC Constraints — discoverability for AI agents. Newly created: - copilot-agent-debug-logger/AGENTS.md (153 lines) — establishes the convention. Sections: Mission, Stack, Commands, File map, Critical constraints (A1/A2-D3/A3-D4/A4/A9/A15/D1/D2-A5-A6/D5-B1/D6/D7/D8/D15), Schema-prompt-code contract, Known issues table with workarounds and follow-up backlog refs, Operational sequence, IWL reference precedents, Don't list, Where to look first when something breaks table, Cross-references. Template for the other 3 solutions per backlog todo agentsmd-other-solutions. Verification: - All 4 .topic.mcs.yml YAMLs still parse via python yaml.safe_load - Both flow JSONs parse via JSON.parse - Schema JSON parses + still has 13 columns - deploy-solution.ps1 + provision-environment.ps1 still parse via PS AST - Repo grep for stale refs: only intentional 'legacy X -> new Y; see PR #42' historical references remain - PII scan: clean (only example.com / placeholder GUIDs across touched files) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
End-to-end smoke test against Jude Dev discovered 8 bugs in the autonomous-build artifacts. All fixes applied and verified — final smoke run wrote 2 rows to
cr_agenttracesuccessfully (env var ON, full Pattern A flow path: REQUEST → env-var read → trace label → payload truncate → Dataverse insert).Hot-fixes
Script bugs
pac admin list-environmentsreturnsNot a valid commandwith exit code 0 in PAC 2.7, so Basher's prior\0 -ne 0fallback heuristic never triggered. Added aTest-LooksLikeJsonsniff (output must start with[or{) before parsing.0x80040203(cannot be created through the SDK). The platform auto-creates<tablename>idas the PK; documented columns likecr_traceidare informational only. Provision loop now skips them.CanvasApps/AgentDebugConsole_*(legacy MDA folder pattern). Modernpac solution cloneunpacks MDAs undersrc/AppModules/cr_AgentDebugConsole/. Also fixed:Get-ChildItem -Directoryreturns CHILD directories of the path (none — MDA folder only contains XML files), not the path itself. Replaced withTest-Path -PathType Container.*.cdsprojdiscovery. PAC clone produces<SolutionName>.cdsproj(e.g.CopilotAgentDebugLogger.cdsproj); was hard-coded toSolution.cdsproj. Glob now handles both shapes.Flow bugs (both verified via Flow Management API errors)
GetEnvironmentVariableValueis a fabricated operationId that doesn't exist on the Dataverse connector. Replaced withListRecords+\+\onenvironmentvariabledefinitions(mirrors the tool flow which was already correct). Compose_EnabledFlag updated accordingly.left().left()is a Power Apps Canvas function, NOT a Workflow Definition Language function. WDL has noleft(). Replaced withsubstring(string(x), 0, min(900000, length(string(x))))per the WDL grammar.item/cr_sourcename. Workaround for the schema collision in [child-flow] child-flow: author flow-1-log-agent-trace.json (manual trigger) #8; the trace label already encodessource/step_namevia theconcat()Compose.Schema
cr_sourcenameas the formatted-value reflection of thecr_sourcePicklist. This blocks creation of the documentedText(200)and prevents flows from writing to it. Added aKNOWN COLLISIONnote in the column description. Follow-up PR will rename tocr_originnameand re-add the write to both flows.Source restructure
Solution.cdsproj+other/{Solution.xml,Customizations.xml}+CanvasApps/.gitkeep) with the layout produced bypac solution clone --name CopilotAgentDebugLogger:src/Entities/,src/AppModules/,src/AppModuleSiteMaps/,src/Other/,src/environmentvariabledefinitions/,CopilotAgentDebugLogger.cdsproj+.gitignore. New cdsproj uses old-style<Import>rather than the SDK alias but builds cleanly withdotnet build. The MDA + Entity XML are now in source (from Jude's Phase-0 authoring →pac solution cloneextraction).Validation
dotnet build src/Solutions/CopilotAgentDebugLogger.cdsproj→ exit 0, producesbin/Debug/CopilotAgentDebugLogger.zippwsh provision-environment.ps1 -EnvironmentId <Jude Dev>→ exit 0 (idempotent — full creation in first run, all reused on second)pwsh deploy-solution.ps1 -EnvironmentId <Jude Dev> -SkipInjectFlowGuid→ exit 0<env-id>placeholders)Decisions in force
needs-human-reviewgate — Jude is operator-approving this PR inline; he ran the smoke test and verified each fixFollow-up backlog (separate PRs)
cr_sourcename→cr_originname(re-add to both flows + provision; removeKNOWN COLLISIONnote from schema)deploy-flows.ps1script that programmatically createsflow-1-log-agent-tracevia Flow Management API (validated to work; the ad-hoc scripts live in coordinator session-state and are not in this PR per Jude's ask)