-
Notifications
You must be signed in to change notification settings - Fork 0
ci: pin the data-ingestors schema ref + add a coverage floor (#1009 P0.3) #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LukasWodka
wants to merge
3
commits into
develop
Choose a base branch
from
feat/1009-ci-drift-tripwires
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+115
−8
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Pinned tracebloc/data-ingestors commit the CLI's embedded schema (and, when | ||
| # the goldens drift job lands, the validator goldens) are synced from. CI | ||
| # checks against THIS ref, not a floating branch — so an unrelated upstream | ||
| # commit can't red every open CLI PR (backend#1009). | ||
| # | ||
| # To adopt upstream changes: bump this SHA, then run `scripts/sync-schema.sh` | ||
| # (and `scripts/sync-validator-goldens.sh` once its CI job exists) and commit | ||
| # the regenerated files together in one deliberate PR. | ||
| # | ||
| # Format: the first non-comment, non-blank line is the ref (a full commit SHA | ||
| # preferred; a branch name works but reintroduces floating drift). | ||
| 0de1f148f9f19c8838d275ab9e5295ae224385c2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/usr/bin/env bash | ||
| # Fail if a load-bearing package's statement coverage drops below its floor. | ||
| # | ||
| # internal/cli (the money path — submit → classify → JSON → reclaim) and | ||
| # internal/submit (the jobs-manager orchestration) were historically the | ||
| # thinnest-tested, highest-stakes code in the CLI (backend#1009). A bare | ||
| # `go test -cover` prints the number and asserts nothing, so coverage could | ||
| # silently rot. This gate makes a regression loud. | ||
| # | ||
| # The floors are a RATCHET: set just under the current numbers, and bumped UP | ||
| # as coverage improves — never silently down. Lowering a floor must be a | ||
| # deliberate, reviewed edit here (with a reason), not a side effect of deleting | ||
| # tests. Current (develop): internal/cli ~70%, internal/submit ~75%. | ||
| # | ||
| # Usage: scripts/coverage-floor.sh (run from the repo root) | ||
| # | ||
| # Portable to bash 3.2 (macOS default): no associative arrays. | ||
| set -euo pipefail | ||
|
|
||
| # "package:floor" entries. Keep floors integers; coverage is compared as a | ||
| # float against them. | ||
| FLOORS=" | ||
| internal/cli:68 | ||
| internal/submit:72 | ||
| " | ||
|
|
||
| status=0 | ||
| for entry in $FLOORS; do | ||
| pkg="${entry%%:*}" | ||
| min="${entry##*:}" | ||
| # A malformed entry (no ":floor", or a non-integer floor) must fail loudly, | ||
| # not slip through. Without this, a dropped colon leaves min="$entry" (the | ||
| # whole token); the awk comparison below then errors on that as bare source | ||
| # and exits non-zero — which `if awk` reads as "not below floor", prints a | ||
| # bogus "ok", and turns the ratchet into a silent no-op for that package. | ||
| if [ "$pkg" = "$entry" ] || ! printf '%s' "$min" | grep -qE '^[0-9]+$'; then | ||
| echo "::error::malformed FLOORS entry '$entry' (want 'package:INT') — fix scripts/coverage-floor.sh" >&2 | ||
| status=1 | ||
| continue | ||
| fi | ||
| line="$(go test -cover "./$pkg/" 2>/dev/null | grep -E 'coverage: [0-9]' || true)" | ||
| pct="$(printf '%s\n' "$line" | sed -nE 's/.*coverage: ([0-9]+(\.[0-9]+)?)% of statements.*/\1/p' | head -1)" | ||
| if [ -z "$pct" ]; then | ||
| echo "::error::could not read coverage for ./$pkg/ (did any test run?)" >&2 | ||
| status=1 | ||
| continue | ||
| fi | ||
| # awk exits 0 when pct < min (i.e. below the floor → failure). | ||
| if awk "BEGIN{exit !($pct < $min)}"; then | ||
| echo "::error::./$pkg/ coverage ${pct}% is below the floor ${min}% — add tests, or (with a reason) lower the floor in scripts/coverage-floor.sh" >&2 | ||
| status=1 | ||
| else | ||
| echo "ok: ./$pkg/ ${pct}% >= ${min}%" | ||
| fi | ||
| done | ||
|
|
||
| exit "$status" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.