[Sprint] sprint-loop-43#39
Merged
Merged
Conversation
…-2843)
Lines 97-111 of bash/log.sh wrapped log::level in an eight-variable
snapshot/restore region to preserve caller pre-sets of LOG_DISABLE_*.
Fold the same semantics into four conditional assignments guarded by
${VAR+x}: when a caller has pre-set a flag the explicit value wins,
otherwise the flag is derived from LOG_LEVEL.
log::level itself is unchanged so log::level_increase /
log::level_decrease keep recomputing the disable flags as before.
bash/find-squashable used one variable, first_squash, as both a bool
sentinel ("true"/"false") and a commit SHA. Beyond the readability
cost, the emit branch only fired when a non-matching commit followed,
so a same-files group that ran to the oldest commit in the iteration
range was silently dropped.
Split the state into group_open (bool) and group_first (SHA), cache
git::files_changed | cksum once per iteration, and flush a trailing
group after the loop so the tail case prints. Add a bats regression
that fails on the previous implementation.
…(SUR-2834) Two undocumented, behaviour-changing knobs caught users by surprise. docker::cmd silently echoes commands when SIMULATE is non-empty (release-images -d sets it); the @doc block now describes the contract and points at the release-images consumer. update-repo-tags writes GPG-signed annotated tags via git tag -s, which fails opaquely in CI without a signing key; the options::description now flags the requirement and a new -U flag opts out by writing an unsigned annotated tag instead.
Seven hardcoded blockchaintp/BTP-era identifiers across the toolkit
silently specialized behaviour to a historical deployment, surfacing
as zero-output runs or skipped repositories for anyone outside that
context. Promote each to an overridable env var or pattern argument
while keeping the historical literal as the default:
- bash/aws.sh: AWS_SCAN_SKIP_REPOS (default blockchaintp/busybox)
- bash/release-images: RELEASE_IMAGES_ORG (default blockchaintp)
- bash/docker.sh: docker::list_versions / list_official_versions
accept an explicit pattern arg, with the
historical BTP regex as the default and
DOCKER_VERSION_PATTERN / DOCKER_OFFICIAL_VERSION_PATTERN
env overrides
- bash/review-prs: REVIEW_PRS_ORGS / REVIEW_PRS_INTEREST_ORGS
- bash/git-check: GIT_CHECK_GH_ORGS / GIT_CHECK_BB_ORGS
- bash/pagerduty-alert: PAGERDUTY_FROM_DEFAULT
tests/sur-2832-btp-defaults.sh locks down both contracts: each new env
var's default matches the historical literal (preventing silent drift)
and the AWS_SCAN_SKIP_REPOS override actually skips the named repos.
9427da0 to
fd1aa84
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Sprint Plan — 2026-05-13 (loop 43)
Sprint Goal
Tighten the
bash/library and command scripts by closing four well-scoped issuesthat combine documentation gaps, code-clarity refactors, and one latent bug. The
sprint targets
log.sh,docker.sh,update-repo-tags,find-squashable, andseveral BTP-era hardcoded identifiers across the toolkit — leaving the libraries
easier to read, easier to consume from outside the original BTP context, and
better documented through their
@docblocks and--helpoutput.Selected Issues
1. SUR-2843 — Simplify: log.sh
__log_preset_*snapshot/restore dance can be flattenedbash/log.shlines 97–111 implement caller-presetpreservation via an eight-variable snapshot/restore dance around
log::level.The intent (from SUR-2347) is correct but the implementation is dense,
fragile, and tends to be either deleted or copy-pasted incorrectly. The
refactor folds caller-override semantics directly into
log::levelitself(e.g.
[ -z "${LOG_DISABLE_TRACE+x}" ] && LOG_DISABLE_TRACE=true).log.shis sourced by virtually every script and library inthe repo. Reducing eight-variable bookkeeping to four conditional assignments
cuts maintenance risk and removes a documented regression vector.
log::levelaccepts an override-respecting mode (or applies the${VAR+x}guard inline) instead of the snapshot/restore region.bash/log.shreduced to a single, scannable block.LOG_DISABLE_*arestill honored across
log::levelcalls.log::level_increasecontinues to re-evaluate flags as it does today.tests/log.batscovers the override-preservation path (add a case ifmissing) and
tests/sur-2347-*.sh(if present) still passes.bats tests/log.batsandmake testpass locally.2. SUR-2840 — Anti-pattern:
find-squashableoverloadsfirst_squashas both sentinel and commit SHAbash/find-squashable(lines 30–53) uses onevariable
first_squashas both a"true"/"false"sentinel and a literalcommit SHA. Two consequences: the code reads as confusingly boolean, and a
squash group that runs to the very last commit in the range is never
printed because the emit branch only fires when a non-matching commit
follows. Suggested fix introduces explicit
group_open/group_firstvariables and a post-loop flush.
improvement on a script developers run frequently when curating history.
bash/find-squashableuses separategroup_open(bool) andgroup_first(SHA) variables; no overloaded sentinel.git::files_changed | cksumcached across iterations (no double callper commit).
tests/sur-2840-find-squashable.shortests/find-squashable.batscase covers a same-files run that closes on the final commit and
asserts it is printed.
make testandpre-commit run --all-filespass.3. SUR-2834 — Docs:
docker::cmdSIMULATE mode andupdate-repo-tagsGPG signing requirement undocumented(1)
docker::cmdinbash/docker.shhonorsSIMULATEto turn everydocker invocation into an echoed no-op, but the
@docblock does notmention it. (2)
bash/update-repo-tagsline 131 usesgit tag -sforannotated tags, requiring a configured GPG key, but neither the help text
nor
options::descriptionmentions the prerequisite — CI runs fail withan opaque
gpg: signing failederror.silent simulation in production and opaque CI release failures are exactly
the bugs that drain hours when they surface.
docker::cmd@docblock describesSIMULATEand links torelease-images -das the documented consumer.update-repo-tagsoptions::descriptionnotes that annotated tags areGPG-signed and that a signing key (or an opt-out flag) is required.
-U/ no-sign opt-out flag toupdate-repo-tags(stretch goal — note in body if deferred).
bashadocoutput (make package) reflects the new@doctext for
docker::cmd.pre-commit run --all-filesandmake testpass.bash/docker.shwithSUR-2832, so do SUR-2834 before SUR-2832 and rebase if needed.
4. SUR-2832 — Docs: hardcoded BTP/blockchaintp identifiers undocumented and not configurable
across
bash/aws.sh,bash/release-images,bash/docker.sh,bash/review-prs,bash/git-check, andbash/pagerduty-alertsilentlyspecialize behavior to a historical deployment. The fix promotes each value
to an env var (or, where applicable, an explicit pattern argument) with the
historical default preserved, and documents the variable in the function's
@docblock and the script'soptions::description.silent zero-output or skipped-repo bugs. Promoting the constants to
documented, overridable env vars unlocks reuse without breaking existing
callers.
overridable env var (or pattern argument for
docker::list_versions/docker::list_official_versions) with the historical value as thedefault.
@docblock and in theconsumer command's
options::description.promoted env vars (e.g.
AWS_SCAN_SKIP_REPOS).dist/doc-*.tar.gzviamake packagereflects new docs.pre-commit run --all-filesandmake testpass.bash/docker.shalongside SUR-2834 (different functions, but same file). Sequence after
SUR-2834 to minimize rebase friction.
Risks + Mitigations
log.shis sourced everywhere; a regression silences logs project-wide.Mitigation: keep the refactor behavior-preserving, add a bats spec for the
override semantics first (TDD), and re-run
make test(bats + sur scripts)before opening the PR.
find-squashablepost-loop flush risks double-printing the final group.Mitigation: guard the flush with
$group_open; add an explicit test thatalso covers the historical no-flush path.
docker.shshared between SUR-2834 and SUR-2832. Mitigation: sequencethe two issues serially on the sprint branch, rebase between them, and run
shellcheck/shfmt before each commit.
update-repo-tagsGPG documentation could imply a hard prerequisite thatchanges operator expectations. Mitigation: phrase documentation as "annotated
tags are GPG-signed" rather than "GPG is required"; offer an opt-out flag.
drifts from the original literal during the refactor. Mitigation: assert each
hardcoded value matches the env-var default in the new bats spec.
bashadocregeneration could produce noisy diff churn indist/.Mitigation: only commit doc tarball regeneration if
make packageis partof the normal release flow for this repo; otherwise leave generated artifacts
to CI.
malformed branch. Mitigation: use
sprint/2026-05-13-sprint-loop-43exactly,matching the enforced regex.
Out of Scope
standard_defs.mk). Low priority and ~250 lines ofcross-cutting deletion; deserves its own sprint to avoid risking other CI
paths in this one.
log.shbeyond the snapshot/restore region.-u <keyid>flag toupdate-repo-tags(only-Uno-sign is inscope, and even that is a stretch goal).
bash/library structure or renaming commands.tests/batssubmodule pin or upgrading bats-core.Linear Evidence
Surinis(idce9ebfde-ff2b-4f54-90f1-c388591ca110).shell-scripts(ida43901a0-b02b-4009-aae1-a6e8903d127d).list_issueswithteam=Surinis,project=shell-scripts,state=Backlog,limit=100; followed byget_issuewithincludeRelations=true,list_issues parentId=<id>per candidate, andlist_commentsper candidate.Sub-issue Status
No parent was skipped due to active sub-issues. SUR-2841 was deferred for
sprint-scoping reasons (out of scope above), not by the sub-issue rule.
Linear State Transitions