From f200e2e8792c2ad7f4cb03317db1ad52ab3ab6a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Eizedev?= <6794362+eizedev@users.noreply.github.com> Date: Wed, 25 Nov 2026 21:27:22 +0100 Subject: [PATCH 1/3] docs: decision records for the pivot dark theme and the growth ratchet Refs #217 Co-Authored-By: Claude Opus 5.5 --- ...0009-pivot-dark-values-on-data-pk-theme.md | 36 ++++++++++++++++ .../0010-growth-guards-are-a-ratchet.md | 42 +++++++++++++++++++ docs/decisions/index.md | 2 + 3 files changed, 80 insertions(+) create mode 100644 docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md create mode 100644 docs/decisions/0010-growth-guards-are-a-ratchet.md diff --git a/docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md b/docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md new file mode 100644 index 0000000..1b25298 --- /dev/null +++ b/docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md @@ -0,0 +1,36 @@ +--- +title: The pivot module's dark values follow the report's theme +description: The pivot module's psu.css writes its dark values for pivotkit's data-pk-theme on the report, never for the page's data-theme, so an export from a dark app takes the light colours. +status: accepted +date: 2026-11-14 +--- + +# 0009 The pivot module's dark values follow the report's theme + +Sources: [#66](https://github.com/eizedev/powershell-universal-components/pull/66), [#104](https://github.com/eizedev/powershell-universal-components/pull/104) + +## Context and Problem Statement + +The pivot report follows PSU's light and dark mode: it reads `` and sets pivotkit's +`data-pk-theme` on its own root (#66). The Excel export reads the light theme, and the HTML report +both, by showing that theme on the report for a moment. A dark value written for the page's +`data-theme` stays in force while the report shows its light theme, so it reaches the file (#104). + +## Considered Options + +- Dark values on the page's `:root[data-theme="dark"]`. +- Dark values on pivotkit's `[data-pk-theme="dark"]` of the report. + +## Decision Outcome + +Chosen option: pivotkit's `[data-pk-theme="dark"]` (#104). `psu.css` writes its dark defaults for +that attribute and has no `data-theme` selector. An app's corporate dark values name both, +`:root[data-theme="dark"], .ud-pivot-report [data-pk-theme="dark"]`, as `docs/pivot/themes.md` shows, +so one stylesheet themes the ECharts module and the report. `tests/js/pivot.test.js` checks +`psu.css` and the documented stylesheet. + +### Consequences + +- Good: an export or HTML report from a dark app has the colours of the theme it shows; a report + pinned to one theme with `-Theme` keeps it. +- Bad: an app's stylesheet needs a selector for the report besides the page's. diff --git a/docs/decisions/0010-growth-guards-are-a-ratchet.md b/docs/decisions/0010-growth-guards-are-a-ratchet.md new file mode 100644 index 0000000..401a1b9 --- /dev/null +++ b/docs/decisions/0010-growth-guards-are-a-ratchet.md @@ -0,0 +1,42 @@ +--- +title: The growth guards are a ratchet +description: Code, tests and docs may not grow by appending; CI compares each offender over a limit with a committed baseline that may only shrink, and raising it needs a reason in the pull request. +status: accepted +date: 2026-11-22 +--- + +# 0010 The growth guards are a ratchet + +Source: [#166](https://github.com/eizedev/powershell-universal-components/pull/166) + +## Context and Problem Statement + +PowerShell files and functions, JavaScript functions and docs pages grew by appending. Some were +already over any sensible limit when the guards came (#166), so a plain limit would have failed CI +until all of them were rewritten. + +## Considered Options + +- Fixed limits that fail every file over them. +- A ratchet: limits, with the offenders of the day in a baseline that may only shrink. + +## Decision Outcome + +Chosen option: a ratchet (#166), as pivotkit's `scripts/growth.js` does. `build/growth.js` measures +four guards, each a CI step of its own: PowerShell lines per file and function, JavaScript lines and +complexity per function, duplicated JavaScript and docs lines per page and in total. +`build/growth-baseline.json` holds the offenders over a limit. + +- A new or grown offender fails. +- A smaller one fails until `node build/growth.js --update` lowers the baseline in the same pull + request, so the room it left cannot be filled again unseen. +- `--update --accept-growth` raises an entry; the pull request says why. + +The limits start where the outliers begin: PSScriptAnalyzer has no rule for length, and #166 found no +common number for PowerShell. + +### Consequences + +- Good: the guards could start on the day they came, and every offender can only get smaller. +- Bad: lines are a weak measure for docs, and the docs total is one number, so two pull requests that + each change it can pass alone and need an `--update` together. diff --git a/docs/decisions/index.md b/docs/decisions/index.md index 6604cf9..603a11e 100644 --- a/docs/decisions/index.md +++ b/docs/decisions/index.md @@ -30,3 +30,5 @@ link each other. [0001](0001-record-decisions.md) has the rules. | [0006](0006-one-function-per-file.md) | One function per file in a split module | accepted | 2026-11-22 | | [0007](0007-theme-tokens-are-a-contract.md) | The theme tokens are a contract | accepted | 2026-11-08 | | [0008](0008-modules-released-on-their-own.md) | Each module is released on its own | accepted | 2026-11-06 | +| [0009](0009-pivot-dark-values-on-data-pk-theme.md) | The pivot module's dark values follow the report's theme | accepted | 2026-11-14 | +| [0010](0010-growth-guards-are-a-ratchet.md) | The growth guards are a ratchet | accepted | 2026-11-22 | From debf10729870eff611a95b883640489105d2acf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Eizedev?= <6794362+eizedev@users.noreply.github.com> Date: Wed, 25 Nov 2026 21:29:49 +0100 Subject: [PATCH 2/3] docs: decision records 0009 and 0010 after review Refs #217 Co-Authored-By: Claude Opus 5.5 --- ...0009-pivot-dark-values-on-data-pk-theme.md | 10 +++++---- .../0010-growth-guards-are-a-ratchet.md | 22 ++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md b/docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md index 1b25298..be49989 100644 --- a/docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md +++ b/docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md @@ -12,9 +12,10 @@ Sources: [#66](https://github.com/eizedev/powershell-universal-components/pull/6 ## Context and Problem Statement The pivot report follows PSU's light and dark mode: it reads `` and sets pivotkit's -`data-pk-theme` on its own root (#66). The Excel export reads the light theme, and the HTML report -both, by showing that theme on the report for a moment. A dark value written for the page's -`data-theme` stays in force while the report shows its light theme, so it reaches the file (#104). +`data-pk-theme` on its own root (the header of `psu.css`). The Excel export reads the report's light +theme. The HTML report reads both themes: it shows each on the report for a moment. A dark value +written for the page's `data-theme` stays in force while the report shows its light theme, so it +reaches the file (#104). The rule comes from pivotkit's upgrade notes for its 0.5.0 (#104). ## Considered Options @@ -33,4 +34,5 @@ so one stylesheet themes the ECharts module and the report. `tests/js/pivot.test - Good: an export or HTML report from a dark app has the colours of the theme it shows; a report pinned to one theme with `-Theme` keeps it. -- Bad: an app's stylesheet needs a selector for the report besides the page's. +- Bad: an app's stylesheet needs a selector for the report besides the page's, as + `docs/pivot/themes.md` shows. diff --git a/docs/decisions/0010-growth-guards-are-a-ratchet.md b/docs/decisions/0010-growth-guards-are-a-ratchet.md index 401a1b9..7d932dc 100644 --- a/docs/decisions/0010-growth-guards-are-a-ratchet.md +++ b/docs/decisions/0010-growth-guards-are-a-ratchet.md @@ -11,21 +11,22 @@ Source: [#166](https://github.com/eizedev/powershell-universal-components/pull/1 ## Context and Problem Statement -PowerShell files and functions, JavaScript functions and docs pages grew by appending. Some were -already over any sensible limit when the guards came (#166), so a plain limit would have failed CI -until all of them were rewritten. +Code, tests and docs should not grow by appending (`build/growth.js`). When the guards came (#166), +several PowerShell functions, JavaScript functions and docs pages were already over the limits the +guards set. ## Considered Options -- Fixed limits that fail every file over them. +- Fixed limits that fail every file over them (not discussed in a source). - A ratchet: limits, with the offenders of the day in a baseline that may only shrink. ## Decision Outcome -Chosen option: a ratchet (#166), as pivotkit's `scripts/growth.js` does. `build/growth.js` measures -four guards, each a CI step of its own: PowerShell lines per file and function, JavaScript lines and -complexity per function, duplicated JavaScript and docs lines per page and in total. -`build/growth-baseline.json` holds the offenders over a limit. +Chosen option: a ratchet (#166), as pivotkit's `scripts/growth.js` does. `build/growth.js` has four +guards, each a CI step of its own. Three are ratchets: PowerShell lines per file and function, +JavaScript lines and complexity per function, and docs lines per page with their total, which may +drift by a margin. `build/growth-baseline.json` holds their offenders. The fourth, duplicated +JavaScript, has a fixed threshold in `.jscpd.json`. - A new or grown offender fails. - A smaller one fails until `node build/growth.js --update` lowers the baseline in the same pull @@ -33,10 +34,11 @@ complexity per function, duplicated JavaScript and docs lines per page and in to - `--update --accept-growth` raises an entry; the pull request says why. The limits start where the outliers begin: PSScriptAnalyzer has no rule for length, and #166 found no -common number for PowerShell. +common number for PowerShell. Why a ratchet rather than fixed limits: reason not recorded. ### Consequences -- Good: the guards could start on the day they came, and every offender can only get smaller. +- Good: the guards started without rewriting the offenders first, and each offender in the baseline + can only get smaller. - Bad: lines are a weak measure for docs, and the docs total is one number, so two pull requests that each change it can pass alone and need an `--update` together. From 7d2018d6e00b31d2d19e1566c21204911bd92433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Eizedev?= <6794362+eizedev@users.noreply.github.com> Date: Wed, 25 Nov 2026 21:53:58 +0100 Subject: [PATCH 3/3] build(growth): raise the docs total for two new decision records The two records add 84 lines; with main's pages the total is 5182 lines. Co-Authored-By: Claude Opus 5.5 --- build/growth-baseline.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/growth-baseline.json b/build/growth-baseline.json index 4de323c..46468a3 100644 --- a/build/growth-baseline.json +++ b/build/growth-baseline.json @@ -3,7 +3,7 @@ "pages": { "README.md": [108] }, - "totalLines": 5012 + "totalLines": 5182 }, "javascript": { "complexity": {