Going after the meters turned up a worse instance of a family this repo keeps finding. `jouleclaw-omni/src/runtime/energy.rs` documents itself as measuring "actual GPU, CPU, ANE and DRAM energy consumption in joules using Apple's IOReport framework". It does not call IOReport. The macOS path multiplies `getrusage` CPU seconds by a fixed 15 W; the other path multiplies wall-clock by 45 W; each then splits the result 60/20/20 across subsystems by constant fractions. It has **zero tests**, and `runtime/mod.rs` does not declare it — so it has never been compiled, by anything, ever. That is the strongest member of the family. A feature-gated test with no `--features` reports zero tests; a platform-gated meter on a single-platform runner compiles out; a conformance suite in `main()` gets built and never run. An orphan source file does not even type-check. It is invisible to cargo check, cargo test, clippy and every conformance suite simultaneously, and it cannot fail because nothing asks it anything. The hazard is the next reader, not the dead code. A real meter with a per-rail liveness gate already lives in the same workspace (`jouleclaw-energy`); someone who trusts this file's header and wires it in instead gets CPU-seconds times a guess, apportioned by invented fractions — energy derived from a performance proxy, which is the thing the whole metering ladder exists to grade against. So: `scripts/check-orphan-sources.py`, wired into the hygiene workflow. The per-subsystem split is worth naming separately — four fields reading as four independent observations when all four are fractions of one number is precision standing in for measurement, and it invites conclusions nothing here supports. **Measured, not estimated.** 1659 library sources checked; 25 orphans, all in `jouleclaw-omni`, 19,964 lines never compiled. Every other crate is clean. My first pass said 77 — it counted `src/bin/*.rs`, which cargo auto-discovers, so the exclusions are part of the check rather than a convenience. The baseline was then generated by the detector instead of retyped, because hand-copying it pinned 15 of 25 and the check caught the other ten. Falsified in both directions before being trusted, and the CI step repeats the self-test on every run: a planted orphan must fail the check, and removing it must pass. Exit codes verified without a pipe — `$?` after `| head` is head's status, which is how a gate silently stops gating. The baseline pins today's 25 so this does not go red on a pre-existing condition, and names what the file falsely claims. Removing an entry is the point; adding one is a regression to argue for in a commit message. `energy.rs` itself gets a corrected header and nothing else. I had added a declared `EnergyBasis` to it and reverted that: the field made the orphan stop compiling, and a broken orphan is worse than an honest one. Whether those 25 files are wired up or deleted is not mine to decide — 20k lines is someone's work, and the guard stops the problem growing either way. Co-Authored-By: Claude Opus 5 <[email protected]>
185 lines
7.5 KiB
YAML
185 lines
7.5 KiB
YAML
name: no-vanity-metrics
|
|
|
|
# Blocks reintroduction of codebase-state numbers (crate counts, test
|
|
# counts, LOC, "N+ adapters", etc.) into READMEs and other Markdown
|
|
# surfaces. Those numbers drift on every code change and create
|
|
# permanent sync debt with the websites; the open-standards posture is
|
|
# "describe the shape, not the size." See CONTRIBUTING.md for the
|
|
# rationale and the opt-out marker.
|
|
#
|
|
# Two more jobs hold WAI's public text (wai/) to its writing rules
|
|
# (wai/CONTRIBUTING.md, *Public text*): no comparative or promotional phrasing
|
|
# (a public phrase list), and no company, vendor, customer or product names
|
|
# (patterns kept private, in the WAI_NAME_DENYLIST secret; prints locations
|
|
# only). Both checks fail closed: a grep error or a pattern that does not compile
|
|
# fails the job, and scripts/test-public-text-checks.sh proves it on every run.
|
|
# The secret is given to one step, on a push to main only: a pull request runs
|
|
# code from its own branch, and a step of it that held the list could print it to
|
|
# a public log. Without the secret, a push to main fails; a pull request shows a
|
|
# failed (continue-on-error) step saying the name check did not run.
|
|
|
|
# One run per branch at a time. A push supersedes the run before it.
|
|
#
|
|
# There is one `macos` runner and it is the dev Mac, so every macOS job in this
|
|
# repo queues on it. With no concurrency group, a session pushing four versions
|
|
# of a branch queued four complete sets of runs and every one of them had to
|
|
# drain: on 2026-10-05 a PR's 21 contexts settled none in 70 minutes behind a
|
|
# backlog of 25 runs, and the queue grew faster than it cleared. Only the newest
|
|
# commit's verdict is wanted, so the older runs are cancelled.
|
|
#
|
|
# Verified on this forge (Forgejo 16.0.5) in `ci-test` before being added here:
|
|
# the key parses, and a newer push moves an older run to `cancelled` even while
|
|
# it is still queued, which is the case that matters.
|
|
#
|
|
# `cancel-in-progress: true` also applies to `main`. That is deliberate and
|
|
# safe here: main advances by merge commits whose tree contains the commits
|
|
# before them, so the newer run covers the older one's changes.
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- '**/*.md'
|
|
# The public-text checks below scan WAI's code comments and data too.
|
|
- 'wai/**/*.rs'
|
|
- 'wai/**/*.toml'
|
|
- 'wai/**/*.py'
|
|
- 'wai/**/*.sh'
|
|
- 'wai/**/*.js'
|
|
- 'wai/**/*.mjs'
|
|
- 'wai/**/*.json'
|
|
- 'wai/**/*.html'
|
|
- 'wai/**/*.css'
|
|
- 'wai/**/*.ttl'
|
|
- 'wai/**/*.h'
|
|
- 'wai/**/*.c'
|
|
- 'wai/**/*.txt'
|
|
- 'wai/**/.gitignore'
|
|
- '.github/workflows/no-vanity-metrics.yml'
|
|
- 'scripts/check-no-vanity-metrics.sh'
|
|
- 'scripts/check-comparative-prose.sh'
|
|
- 'scripts/check-public-names.sh'
|
|
- 'scripts/test-public-text-checks.sh'
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- '**/*.md'
|
|
# The public-text checks below scan WAI's code comments and data too.
|
|
- 'wai/**/*.rs'
|
|
- 'wai/**/*.toml'
|
|
- 'wai/**/*.py'
|
|
- 'wai/**/*.sh'
|
|
- 'wai/**/*.js'
|
|
- 'wai/**/*.mjs'
|
|
- 'wai/**/*.json'
|
|
- 'wai/**/*.html'
|
|
- 'wai/**/*.css'
|
|
- 'wai/**/*.ttl'
|
|
- 'wai/**/*.h'
|
|
- 'wai/**/*.c'
|
|
- 'wai/**/*.txt'
|
|
- 'wai/**/.gitignore'
|
|
- '.github/workflows/no-vanity-metrics.yml'
|
|
- 'scripts/check-no-vanity-metrics.sh'
|
|
- 'scripts/check-comparative-prose.sh'
|
|
- 'scripts/check-public-names.sh'
|
|
- 'scripts/test-public-text-checks.sh'
|
|
|
|
jobs:
|
|
scan:
|
|
name: Scan committed Markdown for vanity metrics
|
|
runs-on: linux
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run scanner
|
|
run: bash scripts/check-no-vanity-metrics.sh
|
|
|
|
wai-comparative-prose:
|
|
name: WAI public text names no comparison
|
|
runs-on: linux
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: The two public-text checks fail closed (self-test)
|
|
run: bash scripts/test-public-text-checks.sh
|
|
- name: Run the comparative-prose check
|
|
run: bash scripts/check-comparative-prose.sh
|
|
|
|
wai-public-names:
|
|
name: WAI public text names no company or product
|
|
runs-on: linux
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
# The list reaches this step only, and only on a push to main, whose code
|
|
# has been merged. Without the list the check cannot run, and that fails.
|
|
- name: Run the public-name check
|
|
if: github.event_name != 'pull_request'
|
|
env:
|
|
# Newline-separated patterns, never committed: a public list would
|
|
# publish the names it keeps out.
|
|
WAI_NAME_DENYLIST: ${{ secrets.WAI_NAME_DENYLIST }}
|
|
run: |
|
|
if [ -z "$WAI_NAME_DENYLIST" ]; then
|
|
echo "::error::WAI_NAME_DENYLIST is not set: the public-name check cannot run"
|
|
exit 1
|
|
fi
|
|
bash scripts/check-public-names.sh
|
|
# A pull request never receives the list. The step fails visibly without
|
|
# failing the job; the push to main runs the check.
|
|
- name: The public-name check did not run on this pull request
|
|
if: github.event_name == 'pull_request'
|
|
continue-on-error: true
|
|
run: |
|
|
echo "::warning::the public-name check does not run on a pull request (its pattern list is never given to pull-request code); it runs on the push to main"
|
|
exit 1
|
|
|
|
# (touched to test that this very change supersedes its own queued runs)
|
|
# ── No library source file is unreachable from its crate root ─────────────
|
|
#
|
|
# An orphan `.rs` — one no `mod`, `#[path]` or `include!` ever names — is not
|
|
# merely untested. It is never compiled, so it is invisible to every check in
|
|
# this repository at once: cargo check, cargo test, clippy, the conformance
|
|
# suites. It cannot fail, because nothing asks it anything.
|
|
#
|
|
# This repo keeps finding that family: a feature-gated test run without
|
|
# `--features`, a platform-gated meter pinned to one runner, a conformance
|
|
# suite in `main()` that `cargo test` compiles and never runs. An orphan file
|
|
# is the strongest member — it does not even type-check.
|
|
#
|
|
# The hazard is the next reader, not the dead code. One such file documents
|
|
# itself as measuring energy via IOReport and in fact multiplies CPU seconds
|
|
# by a fixed watt figure; a reader who trusts that header gets a fabricated
|
|
# number. The script's baseline pins today's 25 so this does not go red on a
|
|
# pre-existing condition, and so the count can only ratchet down.
|
|
orphan-sources:
|
|
name: No new orphan source files
|
|
runs-on: linux
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
# Both directions, before trusting the result: a planted orphan must fail
|
|
# the check, and removing it must pass. A guard verified in only the
|
|
# passing direction is a guard that has never been seen to work.
|
|
- name: The check fails closed (self-test)
|
|
run: |
|
|
set -euo pipefail
|
|
probe=jcp/jcp-rs/crates/jcp-efficiency/src/_ci_orphan_probe.rs
|
|
printf 'pub fn never_compiled() -> u64 { 0 }\n' > "$probe"
|
|
if python3 scripts/check-orphan-sources.py >/dev/null 2>&1; then
|
|
rm -f "$probe"
|
|
echo "::error::the orphan check passed with a planted orphan present"
|
|
exit 1
|
|
fi
|
|
rm -f "$probe"
|
|
python3 scripts/check-orphan-sources.py
|
|
|
|
- name: Run the orphan-source check
|
|
run: python3 scripts/check-orphan-sources.py
|
|
|