Skip to content

fix(repo-settings): apply the unreadable guard to the topics probe too - #325

Merged
KaiSchwarz-cnic merged 1 commit into
masterfrom
RSRMID-2989/repo-settings-topics-guard
Aug 24, 2026
Merged

fix(repo-settings): apply the unreadable guard to the topics probe too#325
KaiSchwarz-cnic merged 1 commit into
masterfrom
RSRMID-2989/repo-settings-topics-guard

Conversation

@KaiSchwarz-cnic

@KaiSchwarz-cnic KaiSchwarz-cnic commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

One-line fix: the topics probe never got the guard that RSRMID-2988 applied to the secrets and variables probes. Brings this copy back in line with the template, where all three are fixed together.

Jira: RSRMID-2989

Type of change

  • Bug fix (fix) — releases a patch
  • New feature (feat) — releases a minor
  • Breaking change — BREAKING CHANGE: in the commit body, plus a MIGRATION.md section
  • Non-releasing (ci / build / chore / docs / test / refactor)

Note the fix(...) type is safe here: scripts/ is not src/, so semantic-release will not cut a release from it.

The defect

Same one fixed in the other two probes:

got_topics=$(gh api … 2>/dev/null || echo unknown)

On a 403, gh api exits non-zero and writes the error JSON to stdout, so this captures the JSON with unknown appended. That never equals unknown, so compare()'s unreadable guard misses and the row is reported as drift with a JSON blob as its observed value — rather than being counted as unreadable.

Why it stayed hidden

topics happens to be readable on a public repository with the current token, so the drift run stayed clean and the bug never showed. It would have surfaced the first time this ran against a repository or token where it wasn't — which is precisely the situation the unreadable count exists to report honestly.

I fixed two of the three probes under RSRMID-2988 and missed this one; it turned up while porting the fix upstream to the template.

Verification

  • shellcheck scripts/repo-settings.sh at default severity — exit 0
  • composer lint — exit 0
  • pnpm repo:settings — still drift: 0 unreadable: 0 unconfigured: 0, topics row still reads correctly
  • Both copies confirmed identical on all three probe lines

Checklist

  • Commit messages follow <type>(<scope>): <summary> with a scope
  • composer lint runs locally and passes
  • Documentation updated where behaviour changed — the rationale comment already covers all three probes
  • A breaking change carries its migration note — n/a
  • No guard test was deleted or weakened
  • No secrets, credentials or internal hostnames in the diff

RSRMID-2988 fixed this idiom in the secrets and variables probes and missed the
topics one at line 187, which has exactly the same defect: on a 403 `gh api`
exits non-zero *and* prints the error JSON to stdout, so
`$(cmd || echo unknown)` captures that JSON with `unknown` appended, never equals
`unknown`, and compare() reports drift with a JSON blob as the observed value
instead of counting the row as unreadable.

Topics happens to be readable on a public repository with the current token,
which is why the run stayed clean and the bug stayed hidden — it would have
surfaced the first time this ran against a repository or token where it was not.

Brings this copy back in line with the template, where all three probes are fixed
together under the same issue.

RSRMID-2989
@KaiSchwarz-cnic
KaiSchwarz-cnic requested a review from a team as a code owner August 24, 2026 14:32
@KaiSchwarz-cnic
KaiSchwarz-cnic merged commit a9de757 into master Aug 24, 2026
14 checks passed
@KaiSchwarz-cnic
KaiSchwarz-cnic deleted the RSRMID-2989/repo-settings-topics-guard branch August 24, 2026 14:34
@KaiSchwarz-cnic

Copy link
Copy Markdown
Collaborator Author

🎉 This PR is included in version 33.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant