Skip to content

fix(github): read sema_version_req from sema.toml at each tag - #3

Merged
HelgeSverre merged 1 commit into
mainfrom
fix/sync-tag-manifest
Aug 4, 2026
Merged

HelgeSverre merged 1 commit into
mainfrom
fix/sync-tag-manifest

Conversation

@HelgeSverre

Copy link
Copy Markdown
Member

GitHub-linked packages lost sema_version_req on every release after the initial link: sync_tag took it as a parameter and only the link handler passed one — the sync endpoint and webhook both passed None, so the row stored NULL and the client read that as "no requirement". The gate never fired for the normal release flow.

The link path was wrong the other way: it applied the default branch's sema.toml to every historic tag, so editing the field rewrote past releases.

sync_tag now fetches sema.toml at the tag itself and drops the parameter, fixing all three callers at once. The webhook has no authenticated user, so it reads the repo with an owner's stored GitHub token via a new dal::owners::first_user_id.

Failure policy: a tag with no readable sema.toml records no requirement (tags older than the manifest must still import); a manifest that parses but holds an invalid requirement is an error recorded in the sync log.

Also adds the end-to-end test that was missing — pinning the sema_version_req JSON key through publish → GET, which is the break that would silently disable the client check.

123 tests pass, clippy clean.

sync_tag took the requirement as a parameter, and only the link handler
passed one. The sync endpoint and the webhook both passed None, so every
release after the initial link stored NULL. The client reads NULL as "no
requirement", which means the gate never fired for the normal release flow of
a GitHub-linked package. The link path was wrong in the other direction: it
applied the default branch sema.toml to every historic tag, so editing the
field rewrote the requirement of past releases.

sync_tag now fetches sema.toml at the tag itself and drops the parameter, so
all three callers record what each release actually declared. The webhook has
no authenticated user, so it reads the repo with an owner stored GitHub token
via the new dal::owners::first_user_id.

A tag with no readable sema.toml records no requirement, because tags older
than the manifest must still import. A manifest that parses but holds an
invalid requirement is an error recorded in the sync log, so the maintainer
sees it instead of the release silently losing its constraint.

sync_tag now takes RepoAccess rather than four more positional &str
arguments, which also satisfies clippy::too_many_arguments.

Tests: tag_sema_version_req is split out as a pure function and covered for
the valid, absent, unparsable, invalid, and non-string cases. Adds an
integration test that pins the sema_version_req JSON key end to end through
publish and GET, which is the break that would silently disable the client
check, and one that a bad requirement is refused without creating the
package.
@HelgeSverre
HelgeSverre merged commit bd87584 into main Aug 4, 2026
1 check passed
@HelgeSverre
HelgeSverre deleted the fix/sync-tag-manifest branch August 4, 2026 17:37
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.

1 participant