Skip to content

[Sprint] sprint-loop-39#35

Merged
scealiontach merged 4 commits into
mainfrom
sprint/2026-05-06-sprint-loop-39
May 6, 2026
Merged

[Sprint] sprint-loop-39#35
scealiontach merged 4 commits into
mainfrom
sprint/2026-05-06-sprint-loop-39

Conversation

@scealiontach
Copy link
Copy Markdown
Owner

Sprint plan — 2026-05-06 — sprint-loop-39

Sprint goal

This sprint hardens operational tooling in shell-scripts by fixing fragile working-directory handling in git-check and closing high-value test gaps around AWS ECR scan refresh logic and Docker image copy short-circuiting. Together, the work reduces subtle POSIX/OLDPWD failure modes in a multi-repo sweep script and locks in behavior for date normalization and “same image” fast paths that are currently unexercised in bats, improving confidence in CI and local automation without expanding scope beyond the three selected Linear items.

Selected issues

SUR-2470 — Anti-pattern: git-check uses bare cd / cd - in a loop with incomplete error recovery

  • Linear issue ID: SUR-2470
  • Title: Anti-pattern: git-check uses bare cd / cd - in a loop with incomplete error recovery
  • Description summary: bash/git-check uses cd into each discovered repo and cd - to return, which breaks when OLDPWD changes, directories disappear, or cd - fails—leaving the script in an undefined cwd for later iterations. The issue recommends restructuring the loop to run each repo’s work inside a subshell (or equivalent) so the outer working directory is always restored.
  • Rationale: This is a correctness and robustness fix for a command that may traverse many repositories; subshell isolation directly addresses the documented failure modes and aligns with the suggested fix in the issue.
  • Definition of Done
    • Per-repository work no longer relies on cd / cd - pairs that depend on OLDPWD for returning to the pre-iteration directory.
    • Failed per-repo work is handled without leaving the main shell in an inconsistent cwd for subsequent repos.
    • Behavior matches the intent of the issue’s subshell-based pattern (or an equivalent approach documented in the PR if adjusted).
    • pre-commit / shellcheck / shfmt remain clean for touched files.
    • Any new or adjusted behavior is covered by existing or added tests if the repo already tests git-check, or manual verification steps are documented only if no harness exists (prefer adding coverage where practical).
  • Dependencies / ordering: Independent of the two test-only issues; can land first or in parallel with bats work.

SUR-2477 — Test: aws::refresh_scan cache invalidation date comparison logic is untested

  • Linear issue ID: SUR-2477
  • Title: Test: aws::refresh_scan cache invalidation date comparison logic is untested
  • Description summary: aws::refresh_scan in bash/aws.sh compares ECR scan completion time to image push time using jq floor to normalize fractional timestamps; tests/aws.bats does not cover this function or aws::scan_image. Acceptance criteria require bats cases for COMPLETE short-circuit, push vs scan ordering, fractional seconds, with mocks for aws::scan_status, aws::cmd, and aws::scan_image.
  • Rationale: The date logic is non-obvious and platform-sensitive; tests prevent regressions in cache invalidation and document expected behavior for fractional ECR timestamps.
  • Definition of Done
    • Bats coverage exists for aws::refresh_scan for: already COMPLETE (no re-scan), push newer than scan (re-scan), scan newer than push (skip re-scan), and fractional-second normalization via jq floor.
    • Dependencies are mocked per the issue (aws::scan_status, aws::cmd, aws::scan_image as needed).
    • tests/aws.bats (or agreed split file) runs green under the repo’s bats invocation.
  • Dependencies / ordering: None; parallel with SUR-2478 and SUR-2470.

SUR-2478 — Test: docker::cp_if_different same-image short-circuit path is not covered by tests

  • Linear issue ID: SUR-2478
  • Title: Test: docker::cp_if_different same-image short-circuit path is not covered by tests
  • Description summary: docker::cp_if_different and docker::repo_tags_has in bash/docker.sh have no tests; the “same image” path should skip pull/tag/push when the digest already exists at the destination tag. Acceptance criteria call for bats (e.g. new tests/docker.bats) covering same-image vs different-image flows and docker::repo_tags_has with mocked docker inspect output.
  • Rationale: The short-circuit is the main optimization; without tests, changes to tag matching or copy flow can silently break push avoidance or image promotion.
  • Definition of Done
    • Bats tests exist for same-image (no push path) and different-image (pull/tag/push invoked) with appropriate mocking.
    • docker::repo_tags_has behavior is covered with mocked docker inspect output as described in the issue.
    • New or updated spec is wired into make test / existing bats layout per repository conventions.
  • Dependencies / ordering: None; parallel with SUR-2477 and SUR-2470.

Risks and mitigations

  • Subshell or loop refactor changes git-check behavior (e.g., error propagation, logging). Mitigation: preserve external CLI contract and log messages; run existing sprint/regression scripts if any cover git-check; review diff for exit vs continue semantics.
  • Bats mocking drift (function names or call patterns change). Mitigation: follow patterns in tests/aws.bats and other library specs; load helpers consistently.
  • Docker/AWS tests flaking if real commands leak through mocks. Mitigation: assert mocks were invoked; avoid requiring a live Docker daemon or AWS CLI where the issue specifies mocks.
  • Fractional timestamp fixtures may be platform-specific if tests accidentally call date -d. Mitigation: keep comparisons inside mocked JSON paths and library logic as the issue describes.
  • Small Backlog pool (only three issues matched filters). Mitigation: scope stays tight; if velocity is high, pull next cycle from Linear after new items land—out of scope for this sprint document.

Out of scope

  • Issues outside project shell-scripts or team Surinis, or in Linear states other than Backlog at selection time.
  • Issues labeled manual (none encountered in this pass).
  • Work on Linear relatedTo graph (not used as blockers per instructions).
  • Broader refactors of bash/aws.sh or bash/docker.sh beyond what SUR-2477/SUR-2478 require for testability.
  • Any open-PR file overlap checks beyond the provided empty list (no overlap possible this run).

Linear Evidence

  • Linear team verified: Surinis (ce9ebfde-ff2b-4f54-90f1-c388591ca110)
  • Linear project used: shell-scripts (a43901a0-b02b-4009-aae1-a6e8903d127d, team linkage confirmed on project record)
  • Query / filter used: list_issues with project=shell-scripts, team=Surinis, state=Backlog, limit=250, orderBy=updatedAt; per-candidate get_issue(..., includeRelations=true) for blockedBy; list_issues(parentId=<id>) for sub-issue checks; list_comments(issueId=<id>) for full comment threads
  • Approx. count of Backlog issues reviewed: 3
  • Approx. count of manual-labelled Backlog issues skipped: 0
  • Issues skipped due to unmerged blockers: 0 — []
  • Issues skipped due to open-PR file overlap: 0 — [] (provided open PR file list was empty)

Sub-issue Status

No issue in the reviewed Backlog set had Linear sub-issues; parent/sub-issue gating did not apply.

Parent Issue Sub-issue Sub-issue Status Eligible?
N/A (no parents with children in candidate set)

Linear State Transitions

Issue ID Previous State New State
SUR-2477 Backlog Todo
SUR-2478 Backlog Todo
SUR-2470 Backlog Todo

Run each repository scan in a subshell and pass bucket+record back to
the parent so cd failures and iteration order never leave the outer
shell in another repo. Add bats coverage that cwd is restored.
Add bats cases for COMPLETE short-circuit, stale scan re-trigger,
non-COMPLETE path, and fractional imageScanCompletedAt via mocked
_describe_findings, date, and scan_image.
…SUR-2478)

Exercise same-image vs different-image flows with mocked inspect output
and counters for tag/push side effects.
@scealiontach scealiontach marked this pull request as ready for review May 6, 2026 20:17
The subprocess-based $PWD assertion always passed regardless of implementation
since child processes cannot modify parent PWD. Drop it; the existing
multi-repo branch-column test provides the relevant indirect coverage.
@scealiontach scealiontach merged commit 3c7c240 into main May 6, 2026
3 checks passed
@scealiontach scealiontach deleted the sprint/2026-05-06-sprint-loop-39 branch May 6, 2026 20:41
@scealiontach scealiontach mentioned this pull request May 6, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant