refactor(datasource): normalise github getDigest signatures - #46187
Draft
secustor wants to merge 2 commits into
Conversation
The DatasourceApi.getDigest contract accepts newValue?: string, and the datasource index calls getDigest with a possibly-undefined value. Both GithubReleasesDatasource and GithubReleaseAttachmentsDatasource declared newValue as required, only accepted because TypeScript method parameters are bivariant, so an undefined value could reach findCommitOfTag() or the release-tag lookup at runtime without the type system catching it. Both classes now declare newValue?: string and return null immediately when it is missing, matching GithubDigestDatasource's existing pattern. GithubTagsDatasource and GithubDigestDatasource already used this shape and are unchanged. Also tightens the getDigest doc comment (in datasource.ts and types.ts) to note that newValue may be undefined and that implementations must handle that case explicitly. Behaviour change: none for the registry path, which already only ever passed a real string or undefined. In GithubReleasesDatasource, a missing newValue now returns null without issuing a GraphQL tags query (previously the query ran and still resolved no matching tag, returning null). In GithubReleaseAttachmentsDatasource, a missing newValue with a resolvable currentValue/currentDigest now returns null immediately instead of attempting a request for release tag "undefined", which could previously throw or produce an incorrect currentDigest fallback.
secustor
added this pull request to stack #46110
September 15, 2026 00:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
DatasourceApi.getDigest?(config, newValue?)is called by the registry with an optional value, butgithub-releasesandgithub-release-attachmentsdeclarednewValue: stringas required, which TypeScript only accepts because method parameters are bivariant.github-tagsandgithub-digesthad already been normalised by the registry-url layer below.getDigest(config, newValue?: string)and returnnullexplicitly when no value is given, matchinggithub-digest. One spec case per datasource proves it.getDigestdoc comment intypes.tsanddatasource.tsstates thatnewValuemay be undefined and what an implementation must return in that case.Behaviour: the registry path is unchanged. Called without a value,
github-releasesno longer issues a GraphQL tags query it could not use, andgithub-release-attachmentsno longer risks requesting a release namedundefined.Part of the datasource base-class stack; this layer sits on the github-release-attachments subclass PR and only contains its own changes.
Context
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
Code, tests and this description were written with Claude Code (Claude Fable 5.1) under the author's direction and review.
Use of AI in replying to PR comments
Who answers review comments:
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
The public repository: