Skip to content

Commit 293fa2e

Browse files
yzld2002claude
andcommitted
fix(spec-sync): surface-lock ignores additive public-constant value changes
griffe flags a changed value of a public constant (e.g. adding staging/dev to the ENVIRONMENTS map) as breaking, tripping the gate on every PR since #105. Additive config is not an API-signature break, so filter griffe's 'Attribute value was changed' breakages; any other breakage still fails the gate (verified: renaming a public method still trips it). Removes the need for the breaking-change-approved override on such PRs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 42cf69c commit 293fa2e

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

‎scripts/spec-sync/surface-lock.sh‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
# Fail if the RELEASED public API of landingai_ade changed in a breaking way.
33
# Baseline = last release tag: released surface is the promise to users; merged-but-
44
# unreleased surface stays mutable.
5-
set -euo pipefail
5+
#
6+
# Exemption: a change to the *value* of a public constant (e.g. adding an entry to the
7+
# ENVIRONMENTS / V2_ENVIRONMENTS maps) is additive configuration, not an API-signature
8+
# break, so griffe's "Attribute value was changed" breakages are treated as non-breaking.
9+
# A genuine intentional break can still be approved via the `breaking-change-approved`
10+
# PR label (see .github/workflows/pr-gates.yml).
11+
set -uo pipefail
612

713
baseline="$(git describe --tags --abbrev=0 --match 'v*' 2>/dev/null || true)"
814
if [ -z "$baseline" ]; then
@@ -11,4 +17,24 @@ if [ -z "$baseline" ]; then
1117
fi
1218

1319
echo "surface-lock: checking landingai_ade against $baseline"
14-
rye run griffe check landingai_ade --against "$baseline" --search src
20+
report="$(rye run griffe check landingai_ade --against "$baseline" --search src -f oneline 2>&1)"
21+
status=$?
22+
23+
if [ "$status" -eq 0 ]; then
24+
echo "surface-lock: no breaking changes."
25+
exit 0
26+
fi
27+
28+
# griffe found breakages (one per line). Drop attribute-value-only changes (additive
29+
# public constants); anything left is a real signature/API break.
30+
breaking="$(printf '%s\n' "$report" | grep -vi 'Attribute value was changed' | grep -vE '^[[:space:]]*$' || true)"
31+
32+
if [ -z "$breaking" ]; then
33+
echo "surface-lock: only public-constant value changes (additive); treating as non-breaking:"
34+
printf '%s\n' "$report" | sed 's/^/ (ignored) /'
35+
exit 0
36+
fi
37+
38+
echo "surface-lock: BREAKING changes to the released public API:"
39+
printf '%s\n' "$breaking"
40+
exit 1

0 commit comments

Comments
 (0)