@codyswann/lisa 4.4.15 → 4.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +2 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +18 -14
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +2 -1
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-improve-tests/SKILL.md +4 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-nightly-lower-code-complexity/SKILL.md +10 -2
- package/plugins/lisa/hooks/threshold-ratchet-compare.mjs +7 -0
- package/plugins/lisa/hooks/threshold-ratchet-families.mjs +53 -0
- package/plugins/lisa/rules/eager/falsifiable-checks.md +16 -1
- package/plugins/lisa/rules/reference/falsifiable-checks.md +74 -1
- package/plugins/lisa/skills/lisa-improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa/skills/lisa-improve-tests/SKILL.md +4 -1
- package/plugins/lisa/skills/lisa-nightly-lower-code-complexity/SKILL.md +10 -2
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-agy/skills/lisa-improve-tests/SKILL.md +4 -1
- package/plugins/lisa-agy/skills/lisa-nightly-lower-code-complexity/SKILL.md +10 -2
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/hooks/threshold-ratchet-compare.mjs +7 -0
- package/plugins/lisa-copilot/hooks/threshold-ratchet-families.mjs +53 -0
- package/plugins/lisa-copilot/rules/eager/falsifiable-checks.md +16 -1
- package/plugins/lisa-copilot/rules/reference/falsifiable-checks.md +74 -1
- package/plugins/lisa-copilot/skills/lisa-improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-copilot/skills/lisa-improve-tests/SKILL.md +4 -1
- package/plugins/lisa-copilot/skills/lisa-nightly-lower-code-complexity/SKILL.md +10 -2
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/hooks/threshold-ratchet-compare.mjs +7 -0
- package/plugins/lisa-cursor/hooks/threshold-ratchet-families.mjs +53 -0
- package/plugins/lisa-cursor/rules/falsifiable-checks-reference.mdc +74 -1
- package/plugins/lisa-cursor/rules/falsifiable-checks.mdc +16 -1
- package/plugins/lisa-cursor/skills/lisa-improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-cursor/skills/lisa-improve-tests/SKILL.md +4 -1
- package/plugins/lisa-cursor/skills/lisa-nightly-lower-code-complexity/SKILL.md +10 -2
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/skills/improve-code-complexity/SKILL.md +4 -1
- package/plugins/lisa-rails/.codex-plugin/skills/improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-rails/.codex-plugin/skills/ops-verify-telemetry/SKILL.md +30 -1
- package/plugins/lisa-rails/skills/improve-code-complexity/SKILL.md +4 -1
- package/plugins/lisa-rails/skills/improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-rails/skills/ops-verify-telemetry/SKILL.md +30 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-agy/skills/improve-code-complexity/SKILL.md +4 -1
- package/plugins/lisa-rails-agy/skills/improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-rails-agy/skills/ops-verify-telemetry/SKILL.md +30 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/skills/improve-code-complexity/SKILL.md +4 -1
- package/plugins/lisa-rails-copilot/skills/improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-rails-copilot/skills/ops-verify-telemetry/SKILL.md +30 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/skills/improve-code-complexity/SKILL.md +4 -1
- package/plugins/lisa-rails-cursor/skills/improve-test-coverage/SKILL.md +4 -1
- package/plugins/lisa-rails-cursor/skills/ops-verify-telemetry/SKILL.md +30 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/base/hooks/threshold-ratchet-compare.mjs +7 -0
- package/plugins/src/base/hooks/threshold-ratchet-families.mjs +53 -0
- package/plugins/src/base/rules/eager/falsifiable-checks.md +16 -1
- package/plugins/src/base/rules/reference/falsifiable-checks.md +74 -1
- package/plugins/src/base/skills/lisa-improve-test-coverage/SKILL.md +4 -1
- package/plugins/src/base/skills/lisa-improve-tests/SKILL.md +4 -1
- package/plugins/src/base/skills/lisa-nightly-lower-code-complexity/SKILL.md +10 -2
- package/plugins/src/rails/skills/improve-code-complexity/SKILL.md +4 -1
- package/plugins/src/rails/skills/improve-test-coverage/SKILL.md +4 -1
- package/plugins/src/rails/skills/ops-verify-telemetry/SKILL.md +30 -1
- package/rails/copy-overwrite/scripts/threshold-ratchet-compare.mjs +7 -0
- package/rails/copy-overwrite/scripts/threshold-ratchet-families.mjs +53 -0
- package/scripts/check-pipeline-status-reads.mjs +684 -0
- package/typescript/copy-overwrite/scripts/threshold-ratchet-compare.mjs +7 -0
- package/typescript/copy-overwrite/scripts/threshold-ratchet-families.mjs +53 -0
|
@@ -10,7 +10,7 @@ It is the more dangerous failure of the two, because the first leaves you uncert
|
|
|
10
10
|
|
|
11
11
|
The empirical origin: a single defect-sweep run produced four false-passing checks and zero false fixes. Every fix was correct; every one of the four *instruments* was broken. Reviewers then found three real defects the checks had cleared. The error concentrated entirely in verification, which is why the countermeasure belongs at the check level rather than the code level.
|
|
12
12
|
|
|
13
|
-
## The
|
|
13
|
+
## The five failure modes, in detail
|
|
14
14
|
|
|
15
15
|
### 1. Self-matching guard
|
|
16
16
|
|
|
@@ -51,6 +51,79 @@ Observed: an uncalled-method detector returned 0 hits across 4,656 files, run on
|
|
|
51
51
|
|
|
52
52
|
Countermeasure: every detector reporting a zero must first be shown to find known instances on a ref where they exist (`origin/<base>`, the pre-fix commit, or a synthetic fixture).
|
|
53
53
|
|
|
54
|
+
### 5. Pager-shadowed status
|
|
55
|
+
|
|
56
|
+
The check is correct, it ran, and it failed. The *reading* of it is what reported green.
|
|
57
|
+
|
|
58
|
+
A shell pipeline's exit status is the status of its **last** stage. So this reports on `tail`, not on the gate:
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
$ node scripts/plugin-parity-drift.mjs 2>&1 | tail -4; echo "exit=$?"
|
|
62
|
+
| ... | safety-net@cc-marketplace | 1.0.6 | 2.0.4 | stale |
|
|
63
|
+
1 of 5 synced skills drifted
|
|
64
|
+
exit=0 <-- tail's exit code
|
|
65
|
+
|
|
66
|
+
$ node scripts/plugin-parity-drift.mjs > drift.log 2>&1; echo "REAL exit code: $?"
|
|
67
|
+
REAL exit code: 1
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This one is worth stating separately from the other four because of *where* it occurs. The other four are defects in a check. This is a defect in **how a correct check gets read**, and the reading happens at exactly the moment someone is deciding whether they are blocked. It is also self-similar in an unhelpful way: it defeats verification while looking like verification.
|
|
71
|
+
|
|
72
|
+
The pipe is there to keep the output short — which means the failure line is the line most likely to fall outside the window. In the transcript above the tool happened to print its verdict inside `tail -4`, so a careful reader could catch it. That is luck about one chatty tool. A quiet gate that fails with no output produces `exit=0` and an empty, plausible-looking tail, and gets recorded as green.
|
|
73
|
+
|
|
74
|
+
#### The one spelling to use
|
|
75
|
+
|
|
76
|
+
Capture the status first; shorten afterwards.
|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
status=0
|
|
80
|
+
gate >gate.log 2>&1 || status=$?
|
|
81
|
+
tail -n 20 gate.log
|
|
82
|
+
[ "$status" -eq 0 ] || echo "FAILED ($status) — full output in gate.log"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The status capture must be the very next thing after the command: `$?` holds only the most recent status, and even `echo` overwrites it.
|
|
86
|
+
|
|
87
|
+
##### `|| status=$?`, never `; status=$?`
|
|
88
|
+
|
|
89
|
+
The `;` spelling is the same class of defect one level down — a status read that cannot report a failure — reached by a different route. Under `set -e`, errexit terminates the shell on the failing command, so the assignment never runs and neither does the branch that would print `FAILED`. The bug is invisible while the gate passes and appears only in the case the code exists to handle. Measured:
|
|
90
|
+
|
|
91
|
+
```text
|
|
92
|
+
sh -e -c 'status=0; false >/dev/null 2>&1; status=$?; echo "reported=$status"' -> prints nothing, exit 1
|
|
93
|
+
sh -e -c 'status=0; false >/dev/null 2>&1 || status=$?; echo "reported=$status"' -> prints reported=1, exit 0
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The left-hand side of `||` is exempt from errexit, which is why the `||` form behaves identically with and without `set -e`. `status=0` is required for the same reason the branch is: on success nothing assigns it, and an unset `status` under `set -u` aborts at the comparison.
|
|
97
|
+
|
|
98
|
+
##### Return the status when the block's own status is read
|
|
99
|
+
|
|
100
|
+
Inside a hook, a CI step, or anything invoked with `&&`, add `exit "$status"` (`return "$status"` in a function). Without it the last command executed is the `echo`, so the block exits 0 immediately after printing `FAILED` — pager-shadowing displaced by one level, with the trailing `echo` in the role of `tail`.
|
|
101
|
+
|
|
102
|
+
#### Why this one and not the other two
|
|
103
|
+
|
|
104
|
+
| Spelling | Works in | Does not work in | Keeps full output |
|
|
105
|
+
|---|---|---|---|
|
|
106
|
+
| redirect, then read `$?` | every POSIX shell, `sh` included | — | yes |
|
|
107
|
+
| `set -o pipefail` | bash, zsh, ksh, POSIX Issue 8 shells | **not POSIX `sh`** — dash has no such option, and GitHub Actions' default `run:` shell is `bash -e {0}`, with `-e` but no pipefail | no |
|
|
108
|
+
| `${PIPESTATUS[0]}` | bash | zsh spells it `$pipestatus[1]` and indexes from 1; absent from `sh`. Overwritten by the next command, so it must be read immediately | no |
|
|
109
|
+
|
|
110
|
+
The redirect form wins on both columns that matter here. It is the only one that survives `sh` — this repository runs hooks under `sh` — and it is the only one that still has the untruncated output at the moment the status tells you to go look at it. `pipefail` is the right thing to add to a *script* you control; it is not a substitute for this when you are reading a gate at a prompt.
|
|
111
|
+
|
|
112
|
+
#### It is not hypothetical, and not only about `tail`
|
|
113
|
+
|
|
114
|
+
`security-floors.yml` ran `node scripts/check-security-floors.mjs --strict | tee -a "$GITHUB_STEP_SUMMARY"` with no `pipefail`. Every failure `--strict` exists to raise — a dependency floor below a live advisory, a rate-limited inconclusive run, an unresolved `$name` — was discarded, and the job reported green. Measured:
|
|
115
|
+
|
|
116
|
+
```text
|
|
117
|
+
bash -e -c 'node -e "process.exit(1)" | tee /dev/null' -> 0
|
|
118
|
+
bash -e -o pipefail -c 'node -e "process.exit(1)" | tee /dev/null' -> 1
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`tee` is the same mechanism as `head`/`tail`: a last stage that reports on its own writing rather than on the command upstream.
|
|
122
|
+
|
|
123
|
+
#### The executable half
|
|
124
|
+
|
|
125
|
+
`scripts/check-pipeline-status-reads.mjs` sweeps shipped shell scripts and workflow `run:` blocks for the pattern. It reports **how many pipelines it inspected** and exits 2 — not 0 — when that count is zero, because an empty inspection and a clean tree otherwise print the same tick.
|
|
126
|
+
|
|
54
127
|
## What a negative result is scoped to
|
|
55
128
|
|
|
56
129
|
A clean result is a statement about what the check can perceive, not about the code. State the boundary:
|
|
@@ -16,8 +16,11 @@ If no argument provided, prompt the user for a target.
|
|
|
16
16
|
1. **Find coverage config** (jest.config.js, vitest.config.ts, .nycrc, etc.)
|
|
17
17
|
2. **Run coverage report** to get current state:
|
|
18
18
|
```bash
|
|
19
|
-
|
|
19
|
+
status=0
|
|
20
|
+
bun run test:cov >coverage.log 2>&1 || status=$?
|
|
21
|
+
head -n 100 coverage.log; echo "exit=$status"
|
|
20
22
|
```
|
|
23
|
+
The status is captured before the pipe, because a pipeline reports its LAST stage's exit code — `head` always succeeds, so a failing run reads as `exit=0` (`falsifiable-checks`, pager-shadowed status). `|| status=$?` rather than `; status=$?`: under `set -e` the `;` form exits before the assignment, so the failure is never reported at all.
|
|
21
24
|
3. **Identify the 20 files with lowest coverage**, noting:
|
|
22
25
|
- File path
|
|
23
26
|
- Current coverage % (lines, branches, functions)
|
|
@@ -14,8 +14,11 @@ If no argument provided, scan the full test suite.
|
|
|
14
14
|
|
|
15
15
|
1. **Run test suite** to establish baseline:
|
|
16
16
|
```bash
|
|
17
|
-
|
|
17
|
+
status=0
|
|
18
|
+
bun run test >test.log 2>&1 || status=$?
|
|
19
|
+
tail -n 20 test.log; echo "exit=$status"
|
|
18
20
|
```
|
|
21
|
+
The status is captured before the pipe, because a pipeline reports its LAST stage's exit code — `tail` always succeeds, so a failing run reads as `exit=0` (`falsifiable-checks`, pager-shadowed status). `|| status=$?` rather than `; status=$?`: under `set -e` the `;` form exits before the assignment, so the failure is never reported at all.
|
|
19
22
|
2. **Scan test files** for quality issues:
|
|
20
23
|
- Weak assertions (`toBeTruthy`, `toBeDefined` instead of specific values)
|
|
21
24
|
- Missing edge cases (no boundary values, no error paths)
|
|
@@ -20,9 +20,17 @@ The caller provides pre-computed context:
|
|
|
20
20
|
4. Fix violations one file at a time. Read only the specific function that violates — do not pre-read all files upfront. Fix it, then move to the next.
|
|
21
21
|
5. For cognitive complexity violations: use early returns, extract helper functions, replace conditionals with lookup tables
|
|
22
22
|
6. For max-lines-per-function violations: split large functions, extract helper functions, separate concerns
|
|
23
|
-
7. After each file edit, run the project's formatter (e.g., `
|
|
23
|
+
7. After each file edit, run the project's formatter **with the provided package manager** (e.g., `npm run format`, `yarn format`, or `bun run format`) to ensure line counts reflect the final formatted state before moving on. Do not reach for a bare `npx prettier`: when the binary is absent `npx` silently installs and executes whatever the registry currently publishes under that name, which is an unpinned dependency introduced by a formatting step. If the project has no format script, run the lockfile-pinned binary directly (`./node_modules/.bin/prettier --write <file>`)
|
|
24
24
|
8. Re-run the lint script with the provided package manager to verify all violations are resolved (both the target metric AND max-lines)
|
|
25
|
-
9. Run the
|
|
25
|
+
9. Run the project's typecheck script with the provided package manager to catch type errors early — same reasoning as step 7, so `npm run typecheck` / `yarn typecheck` / `bun run typecheck`, falling back to `./node_modules/.bin/tsc --noEmit` rather than `npx tsc`:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
status=0
|
|
29
|
+
bun run typecheck >tsc.log 2>&1 || status=$?
|
|
30
|
+
head -n 30 tsc.log; echo "exit=$status"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Capture the status before the pipe — a pipeline reports its LAST stage's exit code, and `head` always succeeds, so `tsc --noEmit | head -30` reads as clean however many errors it printed (`falsifiable-checks`, pager-shadowed status). `|| status=$?` rather than `; status=$?`: under `set -e` the `;` form exits before the assignment, so the failure is never reported at all. If there are type errors, fix them now — do NOT wait until the commit step. Pre-commit hooks run type checking, and discovering errors at commit time wastes turns.
|
|
26
34
|
10. Run the project's test script with the provided package manager (e.g., `npm run test`, `yarn test`, or `bun run test`) to verify no tests are broken by the refactoring
|
|
27
35
|
11. Commit all changes (refactored code + updated eslint.thresholds.json) with conventional commit messages
|
|
28
36
|
12. Create a PR with `gh pr create` with a title like "refactor: reduce code complexity: [metrics being reduced]" summarizing the changes
|
|
@@ -17,8 +17,11 @@ Reduces the CyclomaticComplexity threshold by 2 and fixes all violations.
|
|
|
17
17
|
bundle exec rubocop --only Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity --format json 2>&1
|
|
18
18
|
```
|
|
19
19
|
```bash
|
|
20
|
-
|
|
20
|
+
status=0
|
|
21
|
+
bundle exec flog --all --group app/ >flog.log 2>&1 || status=$?
|
|
22
|
+
head -n 50 flog.log; echo "exit=$status"
|
|
21
23
|
```
|
|
24
|
+
The status is captured before the pipe, because a pipeline reports its LAST stage's exit code — `head` always succeeds, so a failing run reads as `exit=0` (`falsifiable-checks`, pager-shadowed status). `|| status=$?` rather than `; status=$?`: under `set -e` the `;` form exits before the assignment, so the failure is never reported at all.
|
|
22
25
|
4. **Note for each violation**:
|
|
23
26
|
- File path and line number
|
|
24
27
|
- Method name
|
|
@@ -16,8 +16,11 @@ If no argument provided, prompt the user for a target.
|
|
|
16
16
|
1. **Find coverage config** (`.simplecov` or `spec/spec_helper.rb`)
|
|
17
17
|
2. **Run test suite with coverage** to get current state:
|
|
18
18
|
```bash
|
|
19
|
-
|
|
19
|
+
status=0
|
|
20
|
+
bundle exec rspec >rspec.log 2>&1 || status=$?
|
|
21
|
+
tail -n 50 rspec.log; echo "exit=$status"
|
|
20
22
|
```
|
|
23
|
+
The status is captured before the pipe, because a pipeline reports its LAST stage's exit code — `tail` always succeeds, so a failing run reads as `exit=0` (`falsifiable-checks`, pager-shadowed status). `|| status=$?` rather than `; status=$?`: under `set -e` the `;` form exits before the assignment, so the failure is never reported at all.
|
|
21
24
|
3. **Check SimpleCov output** in `coverage/index.html` or console output
|
|
22
25
|
4. **Identify the 20 files with lowest coverage**, noting:
|
|
23
26
|
- File path
|
|
@@ -58,7 +58,36 @@ grep -i "otel\|opentelemetry\|trace_id" log/development.log | tail -10
|
|
|
58
58
|
### Check Collector Sidecar (if using Docker Compose)
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
|
|
61
|
+
# Capture the status BEFORE the pipe. A pipeline reports its LAST stage's exit
|
|
62
|
+
# code, so `docker compose logs ... | tail -20 || echo "No otel-collector"`
|
|
63
|
+
# never prints the fallback: `tail` succeeds even when there is no such
|
|
64
|
+
# service, and the absent sidecar reads as a silent pass.
|
|
65
|
+
#
|
|
66
|
+
# `|| status=$?`, not `; status=$?`: under `set -e` the `;` form exits before
|
|
67
|
+
# the assignment, so the branch that reports the failure never runs.
|
|
68
|
+
#
|
|
69
|
+
# Ask whether the service EXISTS separately from whether its logs could be
|
|
70
|
+
# read. `docker compose logs` also exits non-zero for a stopped daemon, a
|
|
71
|
+
# permission failure, and an unparseable compose file; answering all of those
|
|
72
|
+
# with "No otel-collector service" turns a broken telemetry stack into a
|
|
73
|
+
# reassuring sentence — the same silent-measurement failure one level up.
|
|
74
|
+
services_status=0
|
|
75
|
+
services=$(docker compose config --services 2>&1) || services_status=$?
|
|
76
|
+
if [ "$services_status" -ne 0 ]; then
|
|
77
|
+
echo "FAILED ($services_status) — docker compose config could not be read:"
|
|
78
|
+
printf '%s\n' "$services"
|
|
79
|
+
elif ! printf '%s\n' "$services" | grep -qx otel-collector; then
|
|
80
|
+
echo "No otel-collector service in Docker Compose"
|
|
81
|
+
else
|
|
82
|
+
logs_status=0
|
|
83
|
+
docker compose logs otel-collector >otel.log 2>&1 || logs_status=$?
|
|
84
|
+
if [ "$logs_status" -eq 0 ]; then
|
|
85
|
+
tail -n 20 otel.log
|
|
86
|
+
else
|
|
87
|
+
echo "FAILED ($logs_status) — otel-collector is configured but its logs could not be read:"
|
|
88
|
+
cat otel.log
|
|
89
|
+
fi
|
|
90
|
+
fi
|
|
62
91
|
```
|
|
63
92
|
|
|
64
93
|
## Remote Verification (AWS X-Ray)
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import {
|
|
13
13
|
extractAllowEntries,
|
|
14
14
|
extractK6Constraints,
|
|
15
|
+
extractLighthouseAssertions,
|
|
15
16
|
extractNumericLeaves,
|
|
16
17
|
extractRubocopThresholds,
|
|
17
18
|
extractStrykerConstraints,
|
|
@@ -299,6 +300,12 @@ export function compareFile(relPath, baselineText, currentText) {
|
|
|
299
300
|
return compareStryker(relPath, base, current);
|
|
300
301
|
case "k6":
|
|
301
302
|
return compareK6(relPath, base, current);
|
|
303
|
+
case "lighthouse":
|
|
304
|
+
return compareConstraints(
|
|
305
|
+
relPath,
|
|
306
|
+
extractLighthouseAssertions(base),
|
|
307
|
+
extractLighthouseAssertions(current)
|
|
308
|
+
);
|
|
302
309
|
case KIND_ALLOW_LIST:
|
|
303
310
|
return compareAllowList(relPath, base, current);
|
|
304
311
|
default:
|
|
@@ -80,8 +80,61 @@ export const FAMILIES = [
|
|
|
80
80
|
match: /(^|\/)\.lisa\.config\.json$/,
|
|
81
81
|
kind: "allow-list",
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
id: "lighthouse",
|
|
85
|
+
match: /(^|\/)lighthouserc-config\.json$/,
|
|
86
|
+
kind: "lighthouse",
|
|
87
|
+
},
|
|
83
88
|
];
|
|
84
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Which way each Lighthouse assertion key ratchets.
|
|
92
|
+
*
|
|
93
|
+
* Lighthouse mixes floors and ceilings in one file, so assigning one direction
|
|
94
|
+
* to the whole family would silently approve half of the possible weakenings.
|
|
95
|
+
* Unknown keys stay unwatched until their direction is explicit here.
|
|
96
|
+
* @type {Readonly<Record<string, "min"|"max">>}
|
|
97
|
+
*/
|
|
98
|
+
export const LIGHTHOUSE_ASSERTION_DIRECTIONS = {
|
|
99
|
+
minScore: "min",
|
|
100
|
+
maxNumericValue: "max",
|
|
101
|
+
maxLength: "max",
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Extract numeric Lighthouse assertions with a direction chosen per key.
|
|
106
|
+
*
|
|
107
|
+
* A malformed array is deliberately ignored instead of being walked as an
|
|
108
|
+
* object whose numeric indices look like audit names.
|
|
109
|
+
* @param {unknown} conf Parsed lighthouserc-config.json
|
|
110
|
+
* @returns {Map<string, { value: number, direction: "min"|"max" }>} Dotted
|
|
111
|
+
* `assertion.key` path to numeric constraint
|
|
112
|
+
*/
|
|
113
|
+
export function extractLighthouseAssertions(conf) {
|
|
114
|
+
const out = new Map();
|
|
115
|
+
const assertions =
|
|
116
|
+
conf && typeof conf === "object" && !Array.isArray(conf)
|
|
117
|
+
? /** @type {Record<string, unknown>} */ (conf).assertions
|
|
118
|
+
: undefined;
|
|
119
|
+
if (
|
|
120
|
+
!assertions ||
|
|
121
|
+
typeof assertions !== "object" ||
|
|
122
|
+
Array.isArray(assertions)
|
|
123
|
+
) {
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
for (const [audit, spec] of Object.entries(assertions)) {
|
|
127
|
+
if (!spec || typeof spec !== "object" || Array.isArray(spec)) continue;
|
|
128
|
+
for (const [key, value] of Object.entries(spec)) {
|
|
129
|
+
const direction = LIGHTHOUSE_ASSERTION_DIRECTIONS[key];
|
|
130
|
+
if (direction && typeof value === "number" && Number.isFinite(value)) {
|
|
131
|
+
out.set(`${audit}.${key}`, { value, direction });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
|
|
85
138
|
/**
|
|
86
139
|
* Find the family a repo-relative path belongs to.
|
|
87
140
|
* @param {string} relPath Repo-relative path (forward slashes)
|