Skip to content

fix(companion-freshness): compare against htpx's latest release, not main - #376

Merged
Gerrrt merged 2 commits into
mainfrom
fix/companion-freshness-against-releases
Nov 23, 2026
Merged

Gerrrt merged 2 commits into
mainfrom
fix/companion-freshness-against-releases

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

What & why

The companion advances on htpx release tags (htpx's fan-out; #296, #297 and #359 were all tag syncs), but test/check-companion-freshness.sh compared companion_sha with htpx main. main takes CI-only bot commits between releases that never touch the corpus, so the scheduled companion-freshness run sat red for eight weeks after v3.3.0 over two of them (#375 cleared it). It would go red again after every sync.

New rule: the companion is current when the newest vX.Y.Z release commit is the vendored commit or an ancestor of it.

  • Ancestry needs history, so the check fetches htpx's commits only (--filter=tree:0, no trees or blobs) into a throwaway bare repo and runs git merge-base --is-ancestor. Equality alone, which check-core-freshness.sh uses for core's exact release pins, would call a past-the-release lock such as chore(companion): sync htpx → main (v3.3.0-2-g1901625) #375's "behind".
  • Pre-release tags are ignored. v3.4.0-rc1 isn't a release, and sort -V would rank it above the final.
  • A companion_sha upstream doesn't have is now a hard failure (exit 1) instead of a misleading "behind".
  • With no release tags upstream, the check falls back to the branch tip, the old behaviour.
  • A "behind" result names the exact scripts/sync-companion.sh --ref <tag> to run. The workflow summary and make companion-check help now say "latest release".

Checks

Ran the script against live htpx with companion.lock temporarily set to each state:

Lock Result
current main (v3.3.0 + 2) ✅ current — 2 commit(s) past v3.3.0, exit 0
exactly v3.3.0 ✅ current, exit 0
v3.2.0 ⚠️ behind @v3.3.0, suggests --ref v3.3.0, exit 2
a made-up SHA ❌ "not on main or any tag", exit 1
unreachable upstream skipped, exit 0
  • make lint: bash -n and the return-trap check pass. shellcheck and markdownlint aren't installed locally, so CI's pinned ones cover them.

🤖 Generated with Claude Code

…main

The companion advances on htpx release tags (#296, #297, #359), but the
scheduled freshness check compared companion_sha with htpx main. main
takes CI-only bot commits between releases that never reach the corpus,
so the check sat red for eight weeks after v3.3.0 over two of them and
would have gone red again after every sync.

"Current" now means the newest vX.Y.Z release commit is the vendored
commit or an ancestor of it. Ancestry needs history, so the check
fetches htpx's commits only (--filter=tree:0) into a throwaway bare
repo; a lock synced past the release, like #375's, stays current.
Pre-release tags are ignored, a companion_sha upstream does not have is
a hard failure (exit 1) instead of a false "behind", and with no
release tags upstream the check falls back to the branch tip.

A behind result names the exact `scripts/sync-companion.sh --ref <tag>`
to run, and the workflow summary and Makefile help say "latest release".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 23, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Ignored tag-listing failures can still cause false drift reports, while incomplete branch fetching can incorrectly flag valid companion locks as broken.

2 open issues
What changed in this PR

This PR aligns companion freshness checks with htpx’s release-based updates, avoiding false drift alerts from commits added to main between releases.

Changes:

  • Compare the vendored commit with the latest stable release tag, accepting commits that include that release’s history.
  • Add ancestry checks and invalid-lock detection, with branch-tip fallback when no releases exist.
  • Update sync guidance, workflow summaries, Makefile help, and the changelog.
File Description
test/​check-companion-freshness.sh Adds release selection, ancestry checks, and release-specific remediation.
Makefile Updates companion-check help to reference the latest release.
CHANGELOG.md Documents the revised freshness behavior.
.github/​workflows/​companion-freshness.yml Updates drift summaries and release-sync guidance.

Review effort: Balanced

Comment thread test/check-companion-freshness.sh Resolved
Comment thread test/check-companion-freshness.sh Resolved
@Gerrrt
Gerrrt enabled auto-merge (squash) November 23, 2026 21:27
…ranch, one Changed heading

A failed `ls-remote --tags` used to leave REL_TAG empty exactly like an
upstream with no releases, and fall back to comparing with main: the
false drift this check exists to stop reporting. The listing's status
is now checked on its own, and only a successful empty listing falls
back.

The ancestry fetch took only companion_branch, but `sync-companion.sh
--ref <branch>` can lock a commit on another branch without changing
that field, which the check would then call broken. It now fetches every
branch head plus all tags.

CHANGELOG: the entry moves into the existing `### Changed` section;
a second one under [Unreleased] failed markdownlint MD024.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit b0246c6 into main Nov 23, 2026
22 checks passed
@Gerrrt
Gerrrt deleted the fix/companion-freshness-against-releases branch November 23, 2026 21:30
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.

2 participants