Skip to content

badges: 240 badges use the angle-bracket malformation, which validate-badge-urls does not detect #3751

Open

Description

@eleshar

Found while verifying #3720 on merged develop. The badge URL gate passes, but a second, rarer malformation is still present in 24 files and the gate cannot see it.

The shape

![Docs Validation](<https://img.shields.io/badge/Docs> Validation-OK-success.svg)

#3720 fixed the common shape, where the destination is a bare URL containing a space:

![Docs Validation](https://img.shields.io/badge/Docs Validation-OK-success.svg)   ← was
![Docs Validation](https://img.shields.io/badge/Docs%20Validation-OK-success.svg)  ← now

The angle-bracket form wraps the destination in <...> and places the closing > mid-URL, which breaks the image differently: GitHub ends the destination at the >, leaving Validation-OK-success.svg) as literal text.

Why the gate does not report it

scripts/validation/validate-badge-urls.cjs documents this at lines 42-46 and declines to match it:

A second, rarer malformation wraps the destination in angle brackets and places the > mid-URL... That one is not matched here: the closing > sits inside the destination, so it needs a different pattern, and no file in the repository currently uses it. Adding it blind would mean guessing at a shape with no evidence to test against.

That reasoning was correct when written and is now false. 240 occurrences exist across 24 files, so there is now plenty of evidence to test against. They are not a hypothetical:

./tests/README.md
./.github/specs/008-label-audit-consolidation/{spec,tasks,research,plan,quickstart,data-model}.md
./.github/specs/008-label-audit-consolidation/contracts/*.md
./.github/specs/008-label-audit-consolidation/checklists/requirements.md
./.github/specs/005-requirements-quality-checklist/research.md
./skills/markdown-to-html/references/code-blocks-to-html.md
./docs/BADGES_{EXAMPLES,GOVERNANCE,TROUBLESHOOTING}.md   (inside code fences — examples, leave)

tests/README.md is the clearest case: its whole BADGES-START/BADGES-END block is angle-bracketed and auto-generated, so it will regenerate broken on the next badge run.

Confirmed pre-existing, not introduced by #3720

tests/README.md line 5 was already in this form at b028d5d8d3, before the merge. #3720 neither caused nor fixed it — it fixed a different shape. git diff b028d5d8d3..d9e36d403f -- tests/README.md is empty.

Suggested change

  1. Extend BROKEN_BADGE with a second alternative for the angle form, capturing the destination up to the mid-URL >.
  2. Add --fix support for it, reusing repairBadge.
  3. Decide per file whether the fenced examples in docs/BADGES_*.md should be rewritten. They are documentation showing the malformation, so repairing them would destroy the thing they exist to illustrate — the fence tracker should keep excluding them, and that exclusion needs a test so a future change does not silently start rewriting the documentation.
  4. Regenerate tests/README.md's badge block rather than hand-editing it, or the generator has to be fixed first — fix(skills): correct twelve documentation defects and check the contracts (#3702) #3716 fixed the generator for the bare form, so the same generator path likely emits the angle form for labels containing a colon, e.g. Badges: Documentation Update.

Worth checking which of the two the generator emits, because fixing only the files leaves the block regenerating itself broken.

Activity

  1. linear-code commented on Oct 2, 2026

    @linear-code
  2. eleshar commented on Oct 2, 2026

    @eleshar
    ContributorAuthor

    Correction to this issue after checking the generator, which changes the recommended fix.

    The generator does not emit the angle form. scripts/agents/branding.agent.js:335 builds every badge as:

    return `![${label}](https://img.shields.io/badge/${encodeBadgeSegment(label)}-${encodeBadgeSegment(successText)}-success.svg)`;

    That is the bare form, and encodeBadgeSegment() percent-encodes it. #3716 fixed this function, so the generator is correct today.

    So the 240 angle-form badges are stale output from an older generator, not something that regenerates broken. My earlier suggestion that tests/README.md would regenerate itself broken on the next badge run is wrong — the next run rewrites that block to the correct bare-encoded form, and the problem resolves itself for any file the badge bot owns.

    That narrows the real scope considerably. The files that matter are the ones the badge bot does not own, because they are hand-maintained or inside a spec:

    • .github/specs/008-label-audit-consolidation/ and .github/specs/005-requirements-quality-checklist/ — specification documents, not badge-block owners.
    • skills/markdown-to-html/references/code-blocks-to-html.md — a reference example.
    • docs/BADGES_*.md — documentation showing the malformation; the fence tracker should keep excluding these.

    Revised suggested change

    1. Confirm which of the 24 files carry a BADGES-START/BADGES-END block the bot owns. Those will self-heal on the next badge run; verify rather than edit them, so the count of genuinely hand-maintained occurrences is known before any code is written.
    2. Add the angle-form alternative to BROKEN_BADGE for the remaining hand-maintained files, with --fix support via the existing repairBadge.
    3. Keep the fence exclusion for docs/BADGES_*.md and add a test pinning it, so repairing the malformation does not rewrite the documentation that illustrates it.

    Step 1 is deliberately first: if every one of the 24 turns out to be bot-owned, the correct action is to run the badge generator and close this with no code change at all.

  3. eleshar commented on Oct 2, 2026

    @eleshar
    ContributorAuthor

    Step 1 done, and it changes the conclusion again. Correcting myself twice on this issue; the final answer is the one that matters.

    All 24 files carry BADGES-START, but the bot does not own them

    The badge bot writes a block only when it is generating metadata badges from frontmatter and it has a readmePath. updateBadgesInReadme() returns false and writes nothing when allBadges.length === 0 — and these 24 files are specification documents, contract files and reference material, not skill or agent READMEs. scripts/agents/includes/badges.js never references tests/README.md at all.

    So BADGES-START in these files was itself written by an older bot run and is now orphaned. Nothing will regenerate it. My previous comment's claim that they self-heal was wrong: the bot does not target them, so the next run changes nothing.

    Corrected conclusion

    • The 240 angle-form badges are stale and orphaned, not regenerating.
    • The generator is correct and emits the bare form.
    • These files will not fix themselves. They need either the --fix path extended to the angle form, or the stale blocks removed.

    Revised recommended action

    1. Extend BROKEN_BADGE with an alternative for the angle form — destination closed by a mid-URL > — and add --fix support reusing repairBadge. This is the real work: one pattern, one repair path, tests for both.
    2. Pin the fence exclusion. docs/BADGES_{EXAMPLES,GOVERNANCE,TROUBLESHOOTING}.md illustrate the malformation inside code fences. createFenceTracker() already skips fenced lines, which is why they do not appear in the 240; add a test so a future pattern change does not start rewriting the documentation that exists to demonstrate it.
    3. Decide separately whether the orphaned BADGES-START blocks in spec documents should be rewritten or deleted. That is a content decision, not a validation one — those blocks do not describe anything true about a specification contract, and updateBadgesInReadme() would now strip them for having no metadata badges. Worth a maintainer's call rather than a mechanical fix.

    No verification is owed on #3720 itself: this is a pre-existing gap it did not introduce and did not claim to close.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions