fix: skip commitsha if not available (requires https)#58
Merged
Conversation
Reviewer's GuideAdds a runtime check for Web Crypto (crypto.subtle) availability in the commit SHA browser test and conditionally skips the test when running in non-secure contexts where the API is unavailable. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
- The result of
isSecureContextfrom theEvaluatecall is currently unused; if it's not needed, consider removing it from the returned object to simplify the JS snippet, or log/use it explicitly if it’s intended for debugging. TestCommitSHASearchnow performs an initialNavigate(bt.URL)before callingperformSearch, which may itself navigate; ifperformSearchalready handles navigation, consider reusing that mechanism for the crypto check to avoid redundant page loads.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The result of `isSecureContext` from the `Evaluate` call is currently unused; if it's not needed, consider removing it from the returned object to simplify the JS snippet, or log/use it explicitly if it’s intended for debugging.
- `TestCommitSHASearch` now performs an initial `Navigate(bt.URL)` before calling `performSearch`, which may itself navigate; if `performSearch` already handles navigation, consider reusing that mechanism for the crypto check to avoid redundant page loads.
## Individual Comments
### Comment 1
<location> `test/rekorsearchui/rekor_search_sign_verify_test.go:463-465` </location>
<code_context>
+
+ // Check if crypto.subtle is available (required for commitSha search)
+ // crypto.subtle is only available in secure contexts (HTTPS, localhost)
+ cryptoCheck, err := bt.Browser.Page.Evaluate(`() => {
+ return {
+ available: typeof crypto !== 'undefined' && crypto.subtle !== undefined,
+ isSecureContext: window.isSecureContext
+ };
</code_context>
<issue_to_address>
**suggestion (testing):** Consider asserting on or logging `isSecureContext` to better understand why the test is being skipped.
Since `isSecureContext` is already returned from `Evaluate` but unused, consider either logging it with the skip message (e.g., `isSecureContext=false`) or adding an assertion that in secure environments `isSecureContext` is true whenever `available` is true. This will help distinguish HTTP vs. other failure modes and reduce environment-related flakiness.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Signed-off-by: Kristian Da Costa Menezes <kdacosta@redhat.com>
c6a08d6 to
33ddd5a
Compare
Member
Author
osmman
approved these changes
Dec 1, 2025
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 by Sourcery
Tests: