Skip to content

fix(ci): reject bare version strings in Firebase release notes - #292

Closed
libravault-pipeline-bot[bot] wants to merge 1 commit into
devfrom
fix/firebase-release-notes-version-link
Closed

libravault-pipeline-bot[bot] wants to merge 1 commit into
devfrom
fix/firebase-release-notes-version-link

Conversation

@libravault-pipeline-bot

Copy link
Copy Markdown
Contributor

Summary

Firebase App Distribution's tester invite page auto-linkifies dot-separated, domain-shaped tokens (e.g. 0.4.6.1-alpha) without validating a real TLD or requiring a scheme. Our own release_notes text can trigger this, rendering as a dead "Server Not Found" link — confirmed live on the 0.4.6.1-alpha / build 12 invite page (run 32177679056).

This PR adds the "in our control" half of the fix described in the issue: a validation step in android-firebase-distribution.yml that fails the workflow_dispatch run early — before any build/signing work — if release_notes contains a bare dotted version-like token.

Not fixed here (and not fixable from this repo): Firebase's own auto-generated page heading ("Release notes for 0.4.6.1-alpha (12)") has the identical broken-link styling, but it's templated by Firebase itself from the APK's versionName/versionCode, not from anything this repo submits. Per the issue, that needs Firebase Console access / Google support and is out of scope for an automated PR.

Approach

  • .github/scripts/check_release_notes_version_link.sh — new script exposing a testable contains_bare_version_token() function (mirrors the existing resolve_linked_issue.sh pattern: guarded if [ "${BASH_SOURCE[0]}" = "${0}" ] block for direct/CLI use, sourceable for tests). Matches tokens with at least two dots (three numeric segments, e.g. 1.2.3) so it doesn't flag ordinary prose like "section 2.3" or "iOS 17.4" (one dot), with an optional -alpha/-rc1-style suffix. Deliberately not anchored to a word boundary before the digits — the reported case (v0.4.6.1-alpha) still linkifies starting at the first digit, with the leading v left outside the link, so a leading letter must not exempt the token.
  • .github/scripts/test_check_release_notes_version_link.sh — standalone regression test (no gh/network calls), same convention as test_resolve_linked_issue.sh. Not wired into any CI job — matching its sibling, there's no shell-test harness in this repo yet. Ran locally, all 7 cases pass; also verified it goes red when the regex is broken (temporarily replaced it with a non-matching pattern, confirmed 3 failures, restored).
  • android-firebase-distribution.yml — new first step after checkout, passing release_notes via env var (same pattern the later Distribute step already uses) rather than interpolating it into the shell script directly.
  • docs/android-firebase-distribution-process.md — added a "Gotchas" entry documenting the guard and the unfixable-upstream half, so a future maintainer doesn't have to rediscover this from the workflow diff alone.

Risk

This touches .github/workflows/android-firebase-distribution.yml, which matches sensitive_paths in .github/agent-policy.yml (CI/CD and release plumbing) — classify_pr_risk.py will force risk:high on this PR regardless of size, so it will land on status:needs-human-merge rather than auto-merging. Flagging explicitly per AGENTS.md so the principal review agent doesn't have to rediscover why from the diff alone.

The change is additive and narrowly scoped: one new validation step that only runs before any build/signing/distribution work, and only affects the manually-triggered workflow_dispatch path (no effect on any other workflow or on app code). Default release_notes value ("Beta build via GitHub Actions") does not trip the check.

Closes #290

Firebase App Distribution's tester invite page auto-linkifies
dot-separated, domain-shaped tokens (e.g. "0.4.6.1-alpha") without
validating a real TLD or requiring a scheme, so a version mention in
our own release-notes text renders as a dead "Server Not Found" link.
Confirmed live on the 0.4.6.1-alpha / build 12 invite page (run
32177679056).

Add a validation step that fails android-firebase-distribution.yml
early, before any build/signing work, if release_notes contains a
bare dotted version-like token. The matching logic lives in
.github/scripts/check_release_notes_version_link.sh (mirroring the
resolve_linked_issue.sh pattern already used in this repo) so it has
its own standalone regression test, run directly since there's no
shell-test harness wired into CI yet.

Firebase's own auto-generated page heading has the same broken-link
styling but is templated by Firebase itself from the APK's
versionName/versionCode, not from anything this repo submits, so it
is not fixable here — documented as a known limitation in
docs/android-firebase-distribution-process.md.

Closes #290
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

✅ iOS Simulator Build & Unit Tests - success
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

@github-actions github-actions Bot added the risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge label Aug 19, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-qa PR open, awaiting qa-agent verification label Aug 19, 2026
@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

QA verification — PR #292 vs issue #290

Scope check: Neither PR #292 nor issue #290 carries status:blocked. Proceeding.

Acceptance criteria (issue #290's own "Fix" section is the checklist)

  • ✅ In-repo fixable half — add a CI validation step that fails android-firebase-distribution.yml early if release_notes contains a bare dotted version-like token. Implemented in .github/scripts/check_release_notes_version_link.sh, wired as the first step after checkout in the workflow.
  • ✅ Upstream, not-fixable half — correctly left out of scope (Firebase's own auto-generated heading is templated from versionName/versionCode, not from anything this repo submits). Documented as a known limitation in docs/android-firebase-distribution-process.md's new Gotchas entry rather than silently ignored.

What I ran and verified myself

  1. bash .github/scripts/test_check_release_notes_version_link.sh — all 7 cases PASS (real-world v0.4.6.1-alpha case, bare 1.2.3, no-version prose, section 2.3, iOS 17.4, guidance text, mid-word build10.20.30final).
  2. Direct CLI invocation of check_release_notes_version_link.sh (the actual code path the workflow calls, not just the sourced function): piped the exact RELEASE_NOTES string from the incident run (32177679056) → exits 1 with the offending token 0.4.6.1-alpha printed to stderr. Piped the workflow's default "Beta build via GitHub Actions" and an empty string → both exit 0. Confirms the fix actually catches the reported bug's input and doesn't false-positive on the common case.
  3. Independently reproduced the "prove a new test can fail" requirement (AGENTS.md): broke the regex to a non-matching pattern and reran the test file's checks — exactly 3 of 7 fail (the real-world case, the bare-semver case, and the mid-word case), matching what the PR description claims. This is a real assertion, not a trivially-true mock.
  4. shellcheck on both new scripts — clean, no warnings.
  5. YAML syntax of the modified workflow — parses fine (yaml.safe_load).
  6. Executable bits — both new scripts are -rwxr-xr-x, matching the existing resolve_linked_issue.sh sibling convention the PR claims to mirror.
  7. Gradle test suite — deliberately not run. The diff touches only .github/scripts/*.sh, .github/workflows/android-firebase-distribution.yml, and docs/*.md — no Kotlin/JVM source under any module. testDebugUnitTest has no relevant surface here per AGENTS.md's own "relevant to what changed" framing, so running the full multi-module suite would burn QA time for zero signal.

AGENTS.md conventions

  • Commit message fix(ci): reject bare version strings in Firebase release notes — Conventional Commits, correct scope. ✅
  • Branch name fix/firebase-release-notes-version-link — matches fix/<short-slug> convention. ✅
  • No hardcoded versions in logic — the 0.4.6.1-alpha mentions in the script/docs are comments/examples describing the historical incident, not hardcoded version logic. ✅
  • Test exists alongside the fix, in the same commit, and is integral (not separable) — acceptable per AGENTS.md's "a bug fix and its tests can be one commit if the tests are integral." ✅

Non-blocking flag for whoever picks this up next

PR #291 (fix/firebase-invite-notes-autolink, opened 2026-08-19T04:14:20Z, ~2 minutes before this PR) also claims Closes #290 with a functionally identical fix, and also currently carries status:needs-qa. This isn't a defect in #292 itself — the script/tests here are independently correct and verified — but merging both would be redundant, and whichever lands second will likely conflict. Flagging for the principal-review step / a human, since resolving which of two duplicate PRs to keep isn't a QA-agent call.

Result

All originating-issue acceptance criteria are met, the regression guard is a real (non-mocked) assertion proven to fail on broken logic, and the fix reproduces + blocks the actual reported incident input. No regressions found in related areas (no other workflow or app code touched).

QA verdict: PASS

@github-actions github-actions Bot removed the status:needs-qa PR open, awaiting qa-agent verification label Aug 19, 2026
@libravault-pipeline-bot libravault-pipeline-bot Bot added the status:needs-review QA passed, awaiting principal-review-agent label Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Principal review — PR #292

Verdict: human-merge (routing on risk:high, not on any blocking finding — see below.)

Risk classification

Re-ran classify_pr_risk.py origin/dev HEAD myself rather than trusting the label as-is: it independently reproduces risk:high, correctly triggered by .github/workflows/android-firebase-distribution.yml matching the .github/workflows/** sensitive-path glob. Label matches script output, single commit on the branch, nothing landed after the label was set — no staleness concern. Diff is well under the 400-line auto threshold anyway, so the sensitive-path match is the sole (and sufficient) driver.

Verification performed

  • Read the full diff (not just the description) for all 4 changed files.
  • Ran .github/scripts/test_check_release_notes_version_link.sh directly: all 7 cases pass.
  • Verified the test suite actually detects a regression, not just green-by-construction: swapped VERSION_TOKEN_RE for a non-matching pattern, reran — 3 of 7 cases correctly went red — then restored the original and confirmed git status clean again.
  • Ran shellcheck on both new scripts: no findings.
  • Confirmed test_resolve_linked_issue.sh (the sibling script this PR's test file says it mirrors) is likewise not wired into any CI workflow — the "not wired in, run directly, matches existing convention" claim in the PR body checks out rather than being a novel gap.
  • Confirmed the new step is placed immediately after checkout and before JDK/Gradle setup/signing — i.e. genuinely before any build/signing work, as claimed.
  • Confirmed RELEASE_NOTES reaches the script via an env var (printf '%s' "$RELEASE_NOTES" | ...), same pattern the pre-existing Distribute step already uses — no shell interpolation of untrusted input, no new injection surface.
  • Confirmed no new network calls or dependencies are introduced (script only reads stdin).
  • Confirmed the default release_notes value ("Beta build via GitHub Actions") does not trip the new check.
  • Checked .github/agent-policy.yml's other sensitive paths: nothing else in the diff touches them.

No CONFIRMED-severity findings. One PLAUSIBLE/minor nit for a human to weigh, not blocking:

  • docs/android-firebase-distribution-process.md's "How the pipeline works" numbered step list (1. Checkout, JDK 17, Gradle setup. 2. Set up signing. ...) wasn't updated to mention the new validation step, even though the new "Gotchas" entry documents it well. Purely a doc-completeness nit, not a functional issue — the step list and the gotcha will read as slightly out of sync until someone folds it in.

Why human-merge despite no blocking findings

Per .claude/agents/principal-review-agent.md: risk:high always routes to a human regardless of finding severity. The change itself looks correct and narrowly scoped — this is a plain comment, not a request-changes, since I'm not asking for anything to change before merge.

@github-actions github-actions Bot added status:needs-human-merge Principal review done, requires human merge decision and removed status:needs-review QA passed, awaiting principal-review-agent labels Aug 19, 2026
@libravault-xyz

Copy link
Copy Markdown
Collaborator

Superseded/stale — #291 (merged 2026-08-19T05:11:38Z) already fixed the same problem (issue #290, now closed) with an equivalent CI guard in the same workflow file. This PR predates that merge and is now CONFLICTING against dev. Closing rather than merging a duplicate. Found while triaging the status:needs-human-merge backlog.

libravault-xyz added a commit that referenced this pull request Aug 20, 2026
…very 4h (#335)

* feat(ci): add every-4h human-merge sweep for the needs-human-merge backlog

docs/agent-team-pipeline.md's state machine ends most risk:high PRs at
status:needs-human-merge — correct by design, but until now that backlog
only got cleared when a human noticed it and manually asked Claude Code to
review + merge each one (as happened this session for PRs #327 and #324,
plus closing #292 and #326 as stale/superseded along the way).

This adds a new, separate workflow that automates the noticing, not the
judgment:

- human-merge-sweep.yml: schedule-triggered (every 4 hours) +
  workflow_dispatch for manual testing. Plain GITHUB_TOKEN — merging/
  closing PRs isn't blocked by this repo's "Actions can't create/approve
  PRs" setting the way *opening* one is (principal-review.yml's own
  auto-merge step already proves this), so no App-token minting needed.
- human-merge-sweep-agent.md: the actual review persona. Re-verifies each
  status:needs-human-merge PR is still current (stale/conflicting PRs get
  closed with an explanation if genuinely superseded, left alone if
  ambiguous), does a real second review (reads the whole diff, cross-
  checks claims against ground truth, checks for vacuous tests) before
  merging, and separately sweeps ALL open PRs for the same staleness
  pattern regardless of label. Hard rule, not a judgment call: never
  merges anything touching .github/workflows/**, .github/agent-policy.yml,
  or .claude/agents/** — that class of change always needs a human
  directly, however clean it looks.
- human-merge-sweep-log.md: audit trail, same spirit as auto-merge-log.md
  but for this human-merge-routed path instead of the risk:low auto-merge
  path.

This PR itself is exactly the kind of change its own new agent is
hard-coded to never touch (.github/workflows/**, .claude/agents/**) — by
design, flagging it plainly rather than leaving that as an implicit
assumption: needs a human's own read, this session will not self-merge it
even if CI is green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* feat(ci): extend human-merge sweep to cover status:needs-info too

status:needs-human-merge isn't the only place the pipeline parks work on
a human — status:needs-info (issue triage that's underspecified, or a
PR whose QA/review run crashed or hit workflow-file drift) blocks on a
human just as silently, and was out of scope for the sweep as first
built.

Adds Part 3 to human-merge-sweep-agent.md, deliberately more conservative
than Parts 1-2 given how different the task is — "is this safe to
merge/close" is a mechanical check, "does this actually need a human" is
not:

- Detects when status:needs-info was applied because the *pipeline*
  crashed (turn budget exhausted, workflow-file drift) rather than
  because there's a real open question, and retries the stage that
  crashed — at most once per item, logged to human-merge-sweep-log.md
  same as a merge.
- For everything else — the default assumption, not an edge case — never
  answers, never changes a label, never invents scope. Only ever ensures
  a clear comment exists naming the actual open question, so a human can
  answer faster.
- Hard-excludes anything labeled security/release-blocker
  (agent-policy.yml's sensitive_issue_labels) from all autonomous action,
  including investigation.

Bumped --max-turns 120→160 (three backlogs to work per run now, not two)
and broadened human-merge-sweep-log.md's scope/column naming (PR → Item)
to cover issues and retries alongside merges/closes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix(ci): missing id-token permission + retry using the wrong token

Two CONFIRMED findings from principal review of PR #335's own diff:

- permissions: was missing id-token: write. Every sibling workflow
  invoking claude-code-action carries this with an identical comment
  citing issue #158 ("Could not fetch an OIDC token" after 3 retries) —
  missed here, and continue-on-error: true on the agent step would have
  swallowed the failure silently, forever, every 4 hours.
- Part 3's retry action re-applies status:ready-for-dev/needs-qa/
  needs-review to restart a crashed pipeline stage — that label change
  must trigger the corresponding workflow, which a plain GITHUB_TOKEN
  cannot do (see docs/agent-team-pipeline.md's "Cross-workflow
  triggering"; pr-intake.yml already mints an App token for exactly this
  reason). Fixed by minting the same pipeline App token and passing it to
  the agent step as a distinctly-named PIPELINE_APP_TOKEN, with explicit
  instructions (both in the workflow prompt and the persona file) that
  it's used for that one action only — everything else stays on the
  default GH_TOKEN, unchanged.

Also tightened the retry-dedup check flagged as a plausible weak point:
"grep the comment history for retry text" is now "grep for an exact
<!-- human-merge-sweep-retry --> marker, always the first line of the
retry comment" — an exact string match instead of a fuzzy read.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high Touches a sensitive path or exceeds diff-size threshold — always human merge status:needs-human-merge Principal review done, requires human merge decision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firebase App Distribution tester invite: bare version string renders as a dead link

1 participant