Skip to content

Bring the module into line with ai-powershell-standards 2.0.0 (tracking) #77

Open

Description

@fadwen

Summary

ai-powershell-standards 2.0.0 was installed into this repository by pull requests #57 to #60. It replaced the earlier guidance with rules that carry IDs such as ERR-11 and STY-02, and several of them ask for things the module was not written to. This issue tracks the work of bringing the module into line. Each item below is one issue with its findings, a proposed change, and where needed a decision for the owner.

How the findings were produced

  • The standards' own check, Tools/Test-StandardsCompliance.ps1 at commit 79872d2 of ai-powershell-standards, run over this repository at commit d009d39 with PSScriptAnalyzer 1.25.0. It reports 2,919 findings: 2,512 of layout (STY-01, STY-02, STY-04, STY-07), 174 functions without help (DOC-01), 158 without [CmdletBinding()] (FUN-01), 56 throw statements in advanced functions (ERR-11), and a handful of others.
  • A parse of every .ps1 and .psm1 file for rules that check does not cover: help completeness, parameter types, pipeline parameters, -LiteralPath, encodings, version comparisons, and the test conventions.
  • A reading of the root module, the manifest, the build scripts, the workflows, the README and the help Markdown against the module, CI, README and PlatyPS rules.
  • The full Pester suite at commit d009d39 as a baseline, on one Windows 11 26H2 computer. PowerShell 7.6.10: 1,043 tests, 1,032 passed, 8 skipped, 3 failed, 95.11 percent coverage. Windows PowerShell 5.1: 996 passed, 44 skipped, the same 3 failed. The three failures are Repair-IntuneScript corrupts an ANSI script on a host with a UTF-8 system code page #75 and In-box module table does not list UOPProviders, present on Windows 11 26H2 #76 and do not occur in CI.

To repeat the first step from a checkout of ai-powershell-standards:

./Tools/Test-StandardsCompliance.ps1 -Path <path to IntuneScriptLab> -PassThru | Group-Object -Property RuleId

Issues

Requirements the module does not meet, in the order the changes stack most easily:

Decisions for the owner:

Defects found while the suites were run, which are not standards findings:

What already meets the rules

  • Version targets: the manifest and the root module both declare 5.1, the suites pass under Windows PowerShell 5.1 in CI, and the standards' check finds no command that exists only in Windows PowerShell.
  • Security basics: no Invoke-Expression, no secrets in source, credentials taken as [PSCredential] with the Credential() attribute, no prompt for a missing value in a function.
  • Release: an allowlist staging folder, an import of the staged copy in a new process, a check for empty URI keys, and -WhatIf that rehearses everything but the upload (MOD-10, MOD-13, MOD-14).
  • Help: Microsoft.PowerShell.PlatyPS 1.0.3, .EXTERNALHELP on every export, bare related links, an about_ topic, and a check on a case-sensitive file system.
  • Tests: the Pester 6.2.0 #Requires line and tags on every file, one assertion style, a shuffled run with a coverage gate in CI, and a Windows PowerShell 5.1 job.

Discovered and written up with Claude Code.

Activity

  1. fadwen commented on Nov 23, 2026

    @fadwen
    OwnerAuthor

    Progress on the first items, as a stack of four pull requests. Each is based on the one before it, so they merge in this order:

    1. fix(release): bring the build scripts in line with the 2.0 standards #79 fix(release): the build and release scripts and the manifest. Closes Build and release scripts depart from the 2.0 standards (VER-05, MOD-12, SEC-50, ERR-01) #61.
    2. test(logs): build the event table before the test that reads it #80 test(logs): the order-dependent test found while the suites were run for fix(release): bring the build scripts in line with the 2.0 standards #79. Closes A Get-IslAgentLogEvent test fails when the shuffle runs it first in its file #78.
    3. ci: run every suite through one shuffled runner and rehearse releases #81 ci: one shuffled test runner for every job, pinned tools, a release rehearsal on pull requests, a nightly run and the security rules. Refs CI gates: failed blocks pass, runs are unshuffled, tools are unpinned, no release rehearsal (TST-42, TST-46, CIC-02, CIC-10, CIC-11) #62.
    4. ci: check text files out with LF on every platform #82 ci: .gitattributes and what follows from an LF checkout. Closes CI gates: failed blocks pass, runs are unshuffled, tools are unpinned, no release rehearsal (TST-42, TST-46, CIC-02, CIC-10, CIC-11) #62.

    quality-gates.yml starts by itself only for pull requests into main, which is #79. For the other three it was started by hand on the branch, and every job passed on each.

    Not started: #63 to #73. #63 (strict mode in the root module) and #64 (throw in advanced functions) change what the module does at run time, and the harness paths that run elevated, as SYSTEM or as another account are skipped on the hosted runners, so those two need a run on a lab device before they are proposed.

    Discovered and written up with Claude Code.

  2. fadwen commented on Nov 23, 2026

    @fadwen
    OwnerAuthor

    The stack has two more pull requests. Each is based on the one before it, so the whole stack merges in this order: #79, #80, #81, #82, #84, #85.

    1. fix(module): run under strict mode and fail the import on a load error #84 fix(module): strict mode in the root module, a loader that fails the import when a file fails to load, and every read the suites then reported. Closes Root module does not set strict mode or fail the import on a load error (ERR-02, ERR-03, MOD-05) #63.
    2. test: decide the skip conditions of four tests during discovery #85 test: four tests that were skipped on every run, found while fix(module): run under strict mode and fail the import on a load error #84 was run on a lab device. Closes Four tests never run: their -Skip condition reads a variable that BeforeAll sets after discovery #83.

    What was run for #84 beyond the hosted checks, because strict mode turns a silent $null into an error at run time on paths the hosted runners skip:

    Not started: #64 to #73. #64 (throw in advanced functions) is next, and needs the same run on a lab device.

    Discovered and written up with Claude Code.

  3. fadwen commented on Nov 23, 2026

    @fadwen
    OwnerAuthor

    The stack after the reviews of #79, #81, #82, #84 and #85. It merges in this order: #79, #80, #81, #82, #84, #87, #85.

    Review findings, each fixed on the branch of its pull request and merged upward through the stack

    New since the last comment

    State: quality-gates.yml passed on every branch of the stack after these changes; for the six that are not based on main it was started by hand. Not started: #64 to #73.

    Discovered and written up with Claude Code.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions