Skip to content

fix(pivot): -ErrorVariable holds only the error, -Tips refuses unknown ids, chart settings table - #156

Merged
eizedev merged 3 commits into
mainfrom
fix/pivot-followups-153-154
Nov 22, 2026
Merged

eizedev merged 3 commits into
mainfrom
fix/pivot-followups-153-154

Conversation

@eizedev

@eizedev eizedev commented Nov 22, 2026

Copy link
Copy Markdown
Owner

TL;DR: -ErrorVariable now holds the error once, -Tips refuses ids pivotkit does not know, and the views page has a table of its own for the chart settings.

Fixes #154
Refs #153

The first point of #153 (--numbers and --flat-header for -Engine Node) is not in this pull request. Those flags come with pivotkit-cli 0.5.0, which is not on npm yet (npm has 0.4.0), and they are a new parameter. They belong with the pivotkit 0.9 update in #152.

What changes

-ErrorVariable (#153)

  • One failed Invoke-UDPivotReport left up to 11 records in -ErrorVariable: the .NET exception, each rethrow on the way, and the error. Get-UDPivotSource left 8, a missing command line 6.
  • Every exported command now marks the caller's list when it starts. A trap cuts the list back to the mark and throws the error again. The list then holds the error once, the same record catch gets, with its id, Data and TargetObject.
  • -ErrorVariable +name keeps what the caller had before.
  • With -ErrorAction SilentlyContinue or Ignore, a command used to go on after its own throw: Invoke-UDPivotReport without a command line still tried to run it, and a ConvertFrom-UDPivotView pipeline returned a result for a view it had refused. Now the error stops the command with every -ErrorAction, as it already did with Continue and Stop. This is a change for a script that relied on SilentlyContinue; the CHANGELOG and reports.md say so.
  • The error id stays bare (PivotServerUnreachable). $PSCmdlet.ThrowTerminatingError would have changed it to PivotServerUnreachable,Invoke-UDPivotReport and left a CmdletInvocationException in the list.
  • docs/pivot/reports.md says so in its errors section.

-Tips (#154)

  • -Tips takes On, Off or the ids of pivotkit-react's TIP_IDS. Anything else is refused with the list of ids. A notice id such as filterEmpty is refused too: notices always show.
  • pivotkit compares ids case-sensitively. -Tips Values was passed as typed and ignored. It now reaches pivotkit as values.
  • A test in tests/powershell/Build-Module.Tests.ps1 reads TIP_IDS and NOTICE_IDS from the installed pivotkit-react bundle (the package does not export them) and compares them with $Script:TipIds and the help of -Tips. It runs in CI's pivot build job, the one job that installs the module's packages. The reader handles pivotkit-react 0.8 (ids derived from TIPS) and 0.9 (literal lists); I ran it against both.
  • The CI step that runs that Describe has a new name and expects two passed tests.

Views page (#154)

  • docs/pivot/views.md: display and chart have a row each. The chart settings have their own table, one row per key, under "Chart settings" at the end of the -View section.
  • docs/pivot/index.md: the Tips row says that the help lists the ids and that an unknown id is refused.

For #152

  • docs/pivot/views.md and the CHANGELOG conflict. The 0.9 additions go into single cells of the new table: display gets 'both', type gets combo and treemap, referenceLines gets extremes.
  • The psm1 merges without a conflict, but $Script:TipIds then lacks stackedTotal, so -Tips stackedTotal is refused. With pivotkit-react 0.9 the new test fails until feat(pivot): rows from a pivotkit-server for the signed-in person, pivotkit 0.9 #152 adds it. That is what the test is for.
  • New-UDPivotReport -Uri writes its error with Write-Error, which the trap does not see. It can call Reset-UDPivotErrorVariable -Mark $errorMark before that, and the sentence "the last record is the error" in server-rows.md can go.

Tested

  • Pester: all of tests/powershell (301 passed, 7 skipped: real pivotkit, PSU instances). The new -ErrorVariable and -ErrorAction tests failed on the code before the fix.
  • PSScriptAnalyzer as CI runs it: no findings.
  • npm test.
  • The docs site built with Zensical; tests/browser/site.spec.mjs in Chromium.
  • Vale on the changed lines of views.md, reports.md and the CHANGELOG.
  • No PSU instance: nothing visible changes in the component.

Places checked: docs/pivot/views.md, docs/pivot/reports.md, docs/pivot/index.md, the help of -Tips, the module CHANGELOG, AGENTS.md (no change needed), docs/site/examples.ps1 (uses valid chart keys).

🤖 Generated with Claude Code

eizedev and others added 3 commits November 22, 2026 01:56
…n ids

- Every exported command marks the caller's -ErrorVariable when it starts
  and cuts it back in a trap before it throws again, so the variable holds
  the error once instead of each step it took through the module.
- -Tips takes only pivotkit-react's tip ids (case-insensitive, sent in
  pivotkit's spelling); a Build-Module test compares the list and the help
  with the installed pivotkit-react's TIP_IDS and NOTICE_IDS.
- docs/pivot/views.md lists the chart settings in a table of their own.

Fixes #154
Refs #153

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e end of its section

- Say in the CHANGELOG and reports.md that a module error stops the call
  also with -ErrorAction SilentlyContinue or Ignore (before, the function
  ran on after its own throw); test it, including a pipeline.
- Move the chart settings table to the end of the -View section, so the
  prose about copying and keeping views is not under its heading.
- index.md: the help of -Tips lists the ids; an unknown id is refused.

Refs #153
Refs #154

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ontinue

The test runs in a pwsh process of its own: inside Pester's try every
throw is terminating, so only a script without a try shows the old
behaviour (the function ran on after its throw). Ignore joins the
-ErrorVariable matrix.

Refs #153

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eizedev
eizedev merged commit 20b1710 into main Nov 22, 2026
11 checks passed
@eizedev
eizedev deleted the fix/pivot-followups-153-154 branch November 22, 2026 01:21
eizedev added a commit that referenced this pull request Nov 22, 2026
Brings in #156 (-ErrorVariable, -Tips validation, chart settings table).
- views.md: display takes 'both'; the chart table has combo, treemap and
  referenceLines.extremes.
- CHANGELOG: main's Fixed entries go into 0.9.0.
- $Script:TipIds has stackedTotal (pivotkit-react 0.9).
- New-UDPivotReport -Uri: -ErrorVariable holds the error once, and
  -ErrorAction Stop throws it with its own id, as the module's other
  commands do. After the merge, Stop gave PipelineStopped there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Pivot: split the views.md chart table, and check -Tips ids

1 participant