Add unit and routing tests for Halo API commands and improve coverage#78
Conversation
… Get-HaloSupplier, and Get-HaloItem cmdlets fix(ci): update minimum coverage threshold for Unit suite to 25% Co-authored-by: Copilot <copilot@github.com>
…ibutionList, Get-HaloTab, Get-HaloKBArticle, Get-HaloSoftwareLicence, and Get-HaloOpportunity cmdlets
Co-authored-by: Copilot <copilot@github.com>
…and execution and error handling
Co-authored-by: Copilot <copilot@github.com>
…gration and error handling
Co-authored-by: Copilot <copilot@github.com>
…-HaloWorkday, Get-HaloOutcome, and Get-HaloFAQList
Co-authored-by: Copilot <copilot@github.com>
feat(tests): add routing tests for Get-HaloWorkflow, Get-HaloService, Get-HaloBillingTemplate, Get-HaloCustomButton, and Get-HaloViewList Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
docs: update documentation to reflect new coverage threshold for Unit suite test: add routing tests for new Halo API commands Co-authored-by: Copilot <copilot@github.com>
… add Codecov component validation Co-authored-by: Copilot <copilot@github.com>
…aloQuote, New-HaloRecurringInvoice, New-HaloReport, and New-HaloService commands
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…Contract, New-HaloCRMNote, New-HaloCustomButton, and New-HaloDashboard commands
…InvoiceBatch, New-HaloItem, New-HaloItemBatch, and New-HaloKBArticle commands
Co-authored-by: Copilot <copilot@github.com>
…ies in batch processing
There was a problem hiding this comment.
Pull request overview
Improves CI/unit test coverage enforcement and Codecov reporting granularity, while refactoring batch processing and fixing a ticket pagination behavior.
Changes:
- Added Codecov component mapping + generator script, and CI validation to prevent
.codecov.ymldrift. - Refactored batch processing by extracting per-item execution into
Invoke-HaloBatchItem. - Fixed
Get-HaloTicketmanual pagination behavior and improved authentication retry error reporting; updated docs/metadata and raised CI unit coverage minimum to 70%.
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
temp_results.txt |
Adds local test output transcript (should not be committed). |
cspell.json |
Adds shared cspell dictionary config and ignore paths. |
README.md |
Updates badges/links and documents the new 70% unit coverage threshold. |
Public/New/New-HaloOpportunityBatch.ps1 |
Fixes pluralization and uses the correct parameter variable for batch input. |
Public/Get/Get-HaloTicket.ps1 |
Disables auto-pagination when -PageNo/-PageSize are explicitly provided. |
Public/Connect-HaloAPI.ps1 |
Tightens auth/authinfo retry messaging and retry tracking variables. |
Private/Invoke-HaloBatchProcessor.ps1 |
Extracts per-item connection + invocation into Invoke-HaloBatchItem. |
HaloAPI.psd1 |
Bumps module version to 1.23.1. |
HaloAPI.code-workspace |
Workspace cleanup + updated spellings + terminal auto-approve patterns (one still references 20%). |
Docs/HaloAPI/index.mdx |
Updates Codecov badge/link and documents 70% unit coverage threshold. |
DevOps/Quality/codecov-components-map.json |
Introduces the JSON source-of-truth for Codecov components. |
DevOps/Quality/Generate-CodecovComponents.ps1 |
Adds generator/validator script for .codecov.yml based on the JSON map. |
CHANGELOG.md |
Adds 1.23.1 entry for ticket pagination behavior change. |
.gitignore |
Ignores additional local test/output artifacts (but not temp_results.txt). |
.github/workflows/ci.yml |
Validates Codecov config drift and raises unit coverage minimum from 20% to 70%. |
.codecov.yml |
Adds generated Codecov component configuration. |
| [31;1mSet-PSReadLineOption: [0mC:\Users\MichaelO'Toole\OneDrive - MJCO\Documents\PowerShell\Microsoft.PowerShell_profile.ps1:491:1[0m | ||
| [31;1m[0m[36;1mLine |[0m | ||
| [31;1m[0m[36;1m[36;1m 491 | [0m [36;1mSet-PSReadLineOption -PredictionSource History[0m | ||
| [31;1m[0m[36;1m[36;1m[0m[36;1m[0m[36;1m | [31;1m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m | ||
| [31;1m[0m[36;1m[36;1m[0m[36;1m[0m[36;1m[31;1m[31;1m[36;1m | [31;1mThe predictive suggestion feature cannot be enabled because the console[0m | ||
| [31;1m[0m[36;1m[36;1m[0m[36;1m[0m[36;1m[31;1m[31;1m[36;1m[31;1m[36;1m | [31;1moutput doesn't support virtual terminal processing or it's redirected.[0m |
There was a problem hiding this comment.
This looks like local test output / console transcript (includes ANSI escape sequences and a user-specific local path). It shouldn’t be checked into the repo; please delete this file from the PR history and add an ignore rule so it can’t be reintroduced accidentally.
| "/^pwsh -File \\.\\\\DevOps\\\\Quality\\\\test\\.ps1 -Suite Unit -Verbosity Detailed -CodeCoverage -MinimumCoveragePercent 20$/": { | ||
| "approve": true, | ||
| "matchCommandLine": true, | ||
| }, |
There was a problem hiding this comment.
The terminal auto-approve rule is still keyed to running unit tests with -MinimumCoveragePercent 20, but CI/docs in this PR raise the unit minimum to 70. Update this regex to match the new minimum (or remove it) so local runs align with CI expectations.
| } while ((-not $AuthInfoResponse) -and ($AuthRetries -lt 10)) | ||
| if ($AuthInfoRetries -gt 1) { | ||
| New-HaloError -ModuleMessage ('Retried auth info request {0} times, request unsuccessful.' -f $Retries) | ||
| } while ((-not $AuthInfoResponse) -and ($AuthInfoRetries -lt 10)) |
There was a problem hiding this comment.
These retry loops are hard-coded to 10 attempts. Since Connect-HaloAPI exposes a -MaxRetries parameter (and stores it in connection info), consider using $MaxRetries here as well to avoid surprising behavior when callers override it and to remove the magic number.
| } while ((-not $AuthInfoResponse) -and ($AuthInfoRetries -lt 10)) | |
| } while ((-not $AuthInfoResponse) -and ($AuthInfoRetries -lt $MaxRetries)) |
| } while ((-not $Authenticated) -and ($AuthRetries -lt 10)) | ||
| if ((-not $Authenticated) -and ($AuthRetries -gt 1)) { | ||
| New-HaloError -ModuleMessage ('Retried auth request {0} times, request unsuccessful.' -f $AuthRetries) | ||
| } |
There was a problem hiding this comment.
Same as above: this auth retry loop is fixed at 10 attempts. Use $MaxRetries (or a shared constant derived from it) so the cmdlet’s retry configuration applies consistently during authentication too.
This pull request introduces improvements to code coverage management, batch processing, and bug fixes, along with some documentation and metadata updates. The most significant changes are the addition of a Codecov component mapping system, a refactor of batch processing logic, and a fix for ticket pagination. The minimum code coverage threshold in CI has also been raised, and some minor corrections and enhancements have been made across the codebase and documentation.
Codecov component management and CI integration:
DevOps/Quality/codecov-components-map.jsonfile as the source of truth for code coverage components, and a scriptGenerate-CodecovComponents.ps1to generate the.codecov.ymlconfiguration from this map, with validation support in CI. This enables more granular code coverage reporting by component. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-9424249d4bfd469deb49bb84ef0ffa4b9a8421f124188bfef14ccc75e634540dR1-R65),[[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-1e49dad08a5d32ef333239526ae9c67ee30e11a086650277f4c8f24ea1a3b189R1-R98),[[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-634d76b7f070f597b9ac88e9bff4e91440c20a608f21d428b09b1bb8aa7682d4R1-R48),[[4]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR91-R96)).codecov.ymlmatches the generated configuration and increases the minimum required unit test coverage from 20% to 70%. Documentation and workspace settings were updated to reflect this new threshold. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fL144-R150),[[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b3f264e673efcdd0d957c3b273df2879b4d958b90e13782b9a143e0c5b3137fdL29-R29),[[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a00e0c7830209edf9d1949f0b675351c1897d645759b7dc8483304c0b9bcf8e0R227-R241))Batch processing improvements:
Invoke-HaloBatchProcessor.ps1by extracting the connection and command invocation logic into a new helper functionInvoke-HaloBatchItem, improving readability and maintainability. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a5a90ce17a3899e8d49b77c41aed3504650a19ffbf8b335a9de3707b2eb75b2aR2-R56),[[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a5a90ce17a3899e8d49b77c41aed3504650a19ffbf8b335a9de3707b2eb75b2aL55-L90))Bug fixes and behavioral changes:
Get-HaloTicketso that specifying-PageNoor-PageSizedisables auto-pagination, aligning behavior with user expectations. ([Public/Get/Get-HaloTicket.ps1R297-R301](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-1305d65f0eefa7692e4bfa4b4db6a22b83e4fc4d49fafa08dd3e08e953681346R297-R301))New-HaloOpportunityBatchfor consistency and correctness. ([Public/New/New-HaloOpportunityBatch.ps1L23-R26](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-fe373ef37ce4eff42ae8595252a98b6bcecb849cbb7e67360e386238972499faL23-R26))Connect-HaloAPIfor authentication requests, ensuring error messages reference the correct retry count and only trigger when appropriate. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21R135),[[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21L152-R155),[[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21R219),[[4]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-3ece530c03f1924159401ba6fb6295fe9715b10d7156a2f86c0f16c8defd9b21R260-L263))Documentation and metadata:
1.23.1in the manifest and changelog to reflect the latest changes. ([[1]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L4-R8),[[2]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-b3f264e673efcdd0d957c3b273df2879b4d958b90e13782b9a143e0c5b3137fdL13-R13),[[3]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-2777d45ffa71199d526b654e6524e71b85f753979f5366026eb4ee426ccc3434L15-R15),[[4]](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR5-R8))[HaloAPI.code-workspaceL5-R5](https://github.com/homotechsual/HaloAPI/pull/78/files#diff-a00e0c7830209edf9d1949f0b675351c1897d645759b7dc8483304c0b9bcf8e0L5-R5))These changes collectively improve code quality, maintainability, and reliability, especially around test coverage and batch operations.