Skip to content

Promote develop to main - #104

Merged
mikemadeja merged 7 commits into
mainfrom
develop
Sep 23, 2026
Merged

mikemadeja merged 7 commits into
mainfrom
develop

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

Promotes the following merged PRs from develop to main:

Test plan

  • Both source PRs passed PSScriptAnalyzer and were verified against a real Pi-hole v6 server before merging into develop

🤖 Generated with Claude Code

mikemadeja and others added 7 commits September 22, 2026 16:29
…ut branch

The non-RawOutput path built $ObjectFinal from $Object, but $Object was
hardcoded to $null and never assigned, so every default (non-RawOutput) call
silently returned an empty array regardless of whether gravity actually
updated - there was no way to tell success from failure without RawOutput.

The gravity endpoint streams back the pihole -g console log as plain text,
not JSON, so there's no structured field to build a rich object from. The
formatted output now returns {Status = "Completed"} to match the same
pattern already used by Invoke-PiHoleFlushNetwork/Restart-PiHoleDnsService.

Also:
- Fixed a bug where -WhatIf (ShouldProcess declining) would still try to
  read $Response, which was never set in that case.
- Removed the stray break in the catch block (inconsistent with every other
  function and would end the pipeline early on error).
- Added SYNOPSIS/DESCRIPTION/PARAMETER/EXAMPLE help matching module
  convention, which also drops the README's WIP flag for this function.
- Added an integration test covering the formatted output, verified against
  the real Pi-hole server (full gravity rebuild, ~80s runtime).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Matches the other two tests in this file, which already print the result
they assert on for easier debugging when a run fails.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix: make Update-PiHoleActionsGravity production ready
…DnsBlocking

Both functions had a raw Pi-hole API docs URL sitting in .SYNOPSIS instead of
an actual synopsis, which is why the README's command reference table showed
"No description yet" for them. Replaced with real SYNOPSIS text and added a
.DESCRIPTION block for each, matching the convention used elsewhere in the
module, and regenerated the README.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…gration tests

Add-PiHoleList and Remove-PiHoleList were both marked Work In Progress and,
per the live Pi-hole OpenAPI spec, functionally broken:

- Add-PiHoleList sent `type` in the JSON body, but POST /api/lists requires
  it as a query parameter (?type=block|allow). Every call 400'd.
- Add-PiHoleList's DateUpdated calculation was hoisted outside its own
  foreach loop, evaluating against an undefined $Item on every call.
- Remove-PiHoleList's formatted output tried to build objects from
  $Response.lists, but a successful delete is HTTP 204 No Content - there's
  no body to parse, so it always silently returned an empty array. Replaced
  with a simple {Address, Type, Status} object, matching the pattern used by
  Invoke-PiHoleFlushNetwork/Restart-PiHoleDnsService/Update-PiHoleActionsGravity
  for actions with no meaningful response body.
- Remove-PiHoleList had a dead pre-check (looked up the list, then did
  nothing with the result) and didn't mark Address/Type as mandatory.

Also fixed a shared bug in Request-PiHoleAuth (the internal auth helper
every function calls): its catch block had a stray `break`, and
[CmdletBinding()] was misplaced inside param() instead of above it. The
break meant any auth failure - even with -ErrorAction SilentlyContinue -
would silently abort the entire calling script/pipeline, not just the
function. This directly blocked writing correct "bad password" tests for
Add-PiHoleList (which calls Get-PiHoleList and Get-PiHoleGroup internally
to check for an existing list before adding), so the identical stray
`break` was also removed from those two functions. Both are direct,
unavoidable dependencies of Add-PiHoleList's own logic.

Verified against a real Pi-hole v6 server: full add/remove round trip,
duplicate-add rejection, RawOutput on both, and bad-password errors on
both, using https://blocklistproject.github.io/Lists/alt-version/ransomware-nl.txt
as the test list. Added dedicated integration test files for both functions.

README regenerated to drop the WIP flag now that both are functional.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…t-tests

fix: make Add-PiHoleList/Remove-PiHoleList production ready, add integration tests
docs: add descriptions for Get-PiHoleDnsBlockingStatus and Set-PiHoleDnsBlocking
@mikemadeja
mikemadeja merged commit 76b66f8 into main Sep 23, 2026
4 of 5 checks passed
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