560724d116
- Fixed: SynthesizerBase subclasses' release/free now dispatch correctly (gated synths were hard-freed instead of released). - New: quickstart project template + LyrebirdQuickstartDemo. - Docs: every example typechecked or provably illustrative (426->542); ~20 wrong-API examples fixed; root docs brought under the compile guard. - Fixed: NRT/Score demo Package.swift build from terminal again. See RELEASES.md for details.
76 lines
3.6 KiB
Bash
Executable File
76 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# check-doc-impact.sh
|
|
#
|
|
# Reports which docs a diff's public-API changes may have invalidated.
|
|
#
|
|
# Doc rot is overwhelmingly *caused* by a public-API change, and a review that reads only
|
|
# the diff structurally cannot find it — the stale references live in files the diff never
|
|
# touches. Every incident in this series has that shape:
|
|
# - `engine.add` gained `throws`; 11 examples elsewhere kept calling it without `try`.
|
|
# - `LyrebirdFloat` was deleted; 75 references elsewhere outlived it.
|
|
# - `maxEventsPerBlock` was added; it reached zero .docc files in the cycle it shipped.
|
|
#
|
|
# Unlike the other guards this one **reports and never fails**. It cannot tell
|
|
# "intentionally unaffected" from "forgotten", and a check that cannot judge must not
|
|
# block. It hands `/lyrebird_review` a list to adjudicate.
|
|
#
|
|
# It deliberately SUPPRESSES references inside fences that check-doc-snippets.sh already
|
|
# typechecks — re-reporting those would bury the references nobody is checking.
|
|
#
|
|
# Usage:
|
|
# bash scripts/check-doc-impact.sh # default: origin/main...HEAD
|
|
# (three-dot: merge-base relative, matching /lyrebird_review's branch.diff)
|
|
# bash scripts/check-doc-impact.sh <git-range> # e.g. main..HEAD, abc123~1..abc123
|
|
#
|
|
# Exit 0 always (advisory). Fast — no build required.
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
if [[ $# -gt 1 ]]; then
|
|
echo "usage: $0 [<git-range>|--self-test]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
# --self-test regresses the DETECTION logic against this repo's own history: the real
|
|
# commits that caused the real incidents. The first version of this tool silently reported
|
|
# "no doc impact" for `public init` changes — i.e. for the very incident it cites — and
|
|
# nothing caught that but a review. These assertions would have.
|
|
if [[ "${1:-}" == "--self-test" ]]; then
|
|
fail=0
|
|
check() { # <range> <expected-substring> <what>
|
|
# No pipe into `grep -q`. Under `set -o pipefail`, grep exits on its first match,
|
|
# the writer upstream dies of SIGPIPE, and the pipeline reports failure — so a
|
|
# PASSING assertion looks like a failure. It bit twice here (once with python3
|
|
# upstream, once with printf), and only for the largest report, because a small
|
|
# writer finishes before grep exits. Match in-shell instead.
|
|
local out
|
|
out="$(python3 "$ROOT/scripts/doc_impact.py" "$ROOT" "$1" 2>&1 || true)"
|
|
if [[ "$out" == *"$2"* ]]; then
|
|
echo " ok $3"
|
|
else
|
|
echo " FAIL $3 — expected to see '$2'" >&2
|
|
fail=1
|
|
fi
|
|
}
|
|
echo "[self-test] detection, against the commits that caused the real incidents:"
|
|
# f4b5be6 converted engine.add to throwing; 11 doc examples then kept calling it
|
|
# without `try` for months.
|
|
check "f4b5be6~1..f4b5be6" "SynthesisEngine.add" "throwing-ness change on a public func"
|
|
# da9edab added maxEventsPerBlock to SynthesisEngine.init — a multi-line `public init`,
|
|
# the shape the first version of this tool was completely blind to.
|
|
check "da9edab~1..da9edab" "SynthesisEngine.init" "public init parameter added (multi-line)"
|
|
check "da9edab~1..da9edab" "maxEventsPerBlock" "new public property reported"
|
|
# A docs-only diff must stay quiet — a tool that cries wolf gets ignored.
|
|
check "9aa2513~1..9aa2513" "no public declarations" "docs-only diff reports nothing"
|
|
if [[ "$fail" -ne 0 ]]; then
|
|
echo "[self-test] FAILED" >&2
|
|
exit 1
|
|
fi
|
|
echo "[self-test] OK"
|
|
exit 0
|
|
fi
|
|
|
|
RANGE="${1:-origin/main...HEAD}"
|
|
|
|
python3 "$ROOT/scripts/doc_impact.py" "$ROOT" "$RANGE"
|