framework-shell suites die silently when tools/_lib/credentials.sh is absent from a partial checkout #1312

Open
opened 2026-08-18 22:17:03 +00:00 by rev-code-01 · 0 comments
Member

Found during review of #1311 (pre-existing at base 245e0c42, deliberately not fixed there to avoid widening that PR).

Defect

When packages/mosaic/framework/tools/git/ is run without its sibling tools/_lib/ (partial extraction, sparse checkout, or a copied directory), test-gitea-token-identity.sh exits nonzero with zero output:

  • get_gitea_token checks [[ -f "$cred_loader" ]] (../_lib/credentials.sh), skips the loader, finds no GITEA_TOKEN, no ~/.git-credentials, and does a silent return 1.
  • Back in the suite, out=$(call_get_gitea_token ...) at case 1 inherits that rc, and set -e kills the suite before any assertion prints.

Measured (2026-08-18, scratch repro):

tools/git only:      rc=1, 0 bytes of output
tools/git + tools/_lib: rc=0, passed

Base 245e0c42 with tools/git only reproduces identically with its own suite, so this is not introduced by #1311.

Why it matters

A silent nonzero exit with no FAIL line reads as "suite broken" rather than "environment incomplete", and costs a debugging round-trip to discover. A guard that checks for ../_lib/credentials.sh at suite start and prints a diagnostic would turn it into a one-line fix. Related failure mode seen the same day: ls "$spool"/*.jsonl | head -1 under set -o pipefail + missed glob also kills a suite silently (rc=2, zero output) — glob loops or explicit -e guards avoid it; #1311's case 14 documents this in a comment.

Proposed fix (either/both)

  1. In test-gitea-token-identity.sh (and any suite sourcing detect-platform.sh): fail loudly at startup if "$SCRIPT_DIR/../_lib/credentials.sh" is missing.
  2. Optionally, in get_gitea_token itself: when $cred_loader is missing but this is a recognized host, note it on stderr before the silent return 1.

Filed by rev-code-01 (reviewer, #1311).

**Found during review of #1311** (pre-existing at base `245e0c42`, deliberately not fixed there to avoid widening that PR). ## Defect When `packages/mosaic/framework/tools/git/` is run without its sibling `tools/_lib/` (partial extraction, sparse checkout, or a copied directory), `test-gitea-token-identity.sh` exits nonzero with **zero output**: - `get_gitea_token` checks `[[ -f "$cred_loader" ]]` (../_lib/credentials.sh), skips the loader, finds no `GITEA_TOKEN`, no `~/.git-credentials`, and does a silent `return 1`. - Back in the suite, `out=$(call_get_gitea_token ...)` at case 1 inherits that rc, and `set -e` kills the suite before any assertion prints. Measured (2026-08-18, scratch repro): ``` tools/git only: rc=1, 0 bytes of output tools/git + tools/_lib: rc=0, passed ``` Base `245e0c42` with `tools/git` only reproduces identically with its own suite, so this is not introduced by #1311. ## Why it matters A silent nonzero exit with no FAIL line reads as "suite broken" rather than "environment incomplete", and costs a debugging round-trip to discover. A guard that checks for `../_lib/credentials.sh` at suite start and prints a diagnostic would turn it into a one-line fix. Related failure mode seen the same day: `ls "$spool"/*.jsonl | head -1` under `set -o pipefail` + missed glob also kills a suite silently (rc=2, zero output) — glob loops or explicit `-e` guards avoid it; #1311's case 14 documents this in a comment. ## Proposed fix (either/both) 1. In `test-gitea-token-identity.sh` (and any suite sourcing detect-platform.sh): fail loudly at startup if `"$SCRIPT_DIR/../_lib/credentials.sh"` is missing. 2. Optionally, in `get_gitea_token` itself: when `$cred_loader` is missing but this is a recognized host, note it on stderr before the silent `return 1`. **Filed by rev-code-01** (reviewer, #1311).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#1312