Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/growth-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"pages": {
"README.md": [108]
},
"totalLines": 5012
"totalLines": 5182
},
"javascript": {
"complexity": {
Expand Down
38 changes: 38 additions & 0 deletions docs/decisions/0009-pivot-dark-values-on-data-pk-theme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
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 `<html data-theme>` and sets pivotkit's
`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

- 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, as
`docs/pivot/themes.md` shows.
44 changes: 44 additions & 0 deletions docs/decisions/0010-growth-guards-are-a-ratchet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
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

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 (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` 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
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. Why a ratchet rather than fixed limits: reason not recorded.

### Consequences

- 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.
2 changes: 2 additions & 0 deletions docs/decisions/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Loading