Skip to content

Report why the configuration file could not be used - #14

Merged
Sekers merged 2 commits into
developfrom
fix/config-read-errors
Sep 22, 2026
Merged

Sekers merged 2 commits into
developfrom
fix/config-read-errors

Conversation

@Sekers

@Sekers Sekers commented Sep 22, 2026

Copy link
Copy Markdown
Owner
  • Get-ScriptMessageConfig, which Connect-ScriptMessage and Send-ScriptMessage also use, now reports a missing file, an unreadable file, and invalid JSON separately, each with the reason. Every failure used to read "Can't find the JSON configuration file" and pointed at Set-ScriptMessageConfigFilePath, which only stores the path.
  • On Windows PowerShell 5.1, the invalid-JSON message keeps only the reason, because ConvertFrom-Json there ends many messages with the entire input, which is the configuration file and its secrets (Research_Notes/PowerShell-Language-Behavior.md section 11).
  • Corrects the wording about quoted boolean settings in AGENTS.md, the research notes (section 10), and two comments. The code already behaved this way.
  • Rewords the Minor: changelog entry about true/false settings, fixes the installed-module scratch script's Import-Module, and deletes the unused Tests/MgGraphDynamicParams.ps1.

Changelog: the Minor: entry under Fixed about why a configuration file could not be used.

- Four places said quoted text in a boolean setting reads as off, but the
  text "true" in any letter case compares equal to $true, so it reads as on:
  the rule in AGENTS.md, the From source paragraph in
  Research_Notes/PowerShell-Language-Behavior.md section 10, the
  IncludeBCCInGroupChat comment in Send-ScriptMessage, and the comment above
  the quoted-"false" tests. The code already behaved this way; only the
  wording changes.
- Changelog: the Minor entry about validating configuration file settings
  overstated it. Nothing is validated, and only IncludeBCCInGroupChat and
  MgDisconnectWhenDone read differently from 1.1.1; the
  MgDelegatedPermission_* settings already used -eq $true. Reword it as
  reading every true/false setting the same way.
- Fix the installed-module scratch script, which imported Script-Message
  instead of ScriptMessage.
- Delete Tests/MgGraphDynamicParams.ps1, an unused DynamicParam snippet that
  nothing in the module or tests references.
Get-ScriptMessageConfig reported every failure as "Can't find the JSON
configuration file" and told the caller to create one with
Set-ScriptMessageConfigFilePath, which only stores the path. A missing
file, a file that cannot be read, and a file that is not valid JSON now
get separate messages that include the reason.

Windows PowerShell 5.1's ConvertFrom-Json ends many of its messages with
the entire input, which here is the configuration file and its secrets,
so the parse error keeps only the reason in front of it. Measured in
Research_Notes/PowerShell-Language-Behavior.md section 11.
@Sekers
Sekers merged commit 67e6a35 into develop Sep 22, 2026
4 checks passed
@Sekers
Sekers deleted the fix/config-read-errors branch September 22, 2026 04:17
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.

1 participant