fix: handle __404__ sentinel in github-dockerfile-discovery#25
Merged
Conversation
- search_org_dockerfiles: add __404__ to the existing __422__ guard so orgs with no code-search access are skipped cleanly instead of trying to jq-parse the sentinel string - fetch_dockerfile_content: check for __404__ and __422__ alongside the empty-string guard to avoid a misleading 'Unexpected encoding' warning when a file is not found Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Summary
Two places in
github-dockerfile-discovery.shcalled lib'sgh_apibut didn't handle the__404__sentinel value, introduced alongside__422__in the dual-auth refactor.Changes
enterprise/github-dockerfile-discovery/github-dockerfile-discovery.shsearch_org_dockerfiles: added__404__to the existing__422__guard — orgs that return 404 for code search are now skipped cleanly with a warning instead of crashing onjqtrying to parse__404__as JSONfetch_dockerfile_content: added__404__and__422__to the empty-string guard — avoids a misleadingUnexpected encoding '__404__'warning when a file path is not foundgithub-get-public-reposalready handles all three cases (__404__,__422__, empty) — no change needed there.Root cause
The
gh_apilibrary helper returns string sentinels__404__and__422__instead of non-zero exit codes. Any caller that only checks for empty string or only checks for__422__will silently pass the sentinel tojq, which either errors or produces unexpected output.