test(attestations): keep require in call position for evidence gate - #234
Merged
Merged
Conversation
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.
The packed-attestations fixture read
require.cacheinside theisLoadedclosure. The consumer-evidence collector invalidates a file's require-derived bindings whenrequireis used as a value, so the fixture's dynamicpathToFileURL(load.resolve(...))import — otherwise a supported statically resolvable pattern — stopped resolving. That has kept the fleet lib-usage aggregate producer red since the fixture landed, so the published aggregate is stale and theVerify public consumer usage evidenceCI gate fails on every pull request.Reads the shared module cache through an untracked
require('node:module')._cachebinding instead.Module._cache === require.cache === createRequire(...).cacheon Node 26 (verified), soisLoadedobserves the same cache the packed package loads into.requireandloadnow appear only in call position.Verified the collector resolves both
@socketsecurity/libleaves from the edited fixture.Note
Low Risk
Test-only fixture change with no production or security impact; restores CI evidence aggregation behavior.
Overview
Fixes the packed attestations integration fixture so the consumer usage evidence collector can still statically resolve
@socketsecurity/libimports.isLoaded()previously readrequire.cache, which counts as usingrequireas a value and breaks resolution of the fixture’spathToFileURL(load.resolve(...))dynamic import pattern. The fixture now reads the same shared cache viarequire('node:module')._cache, leavingrequireandcreateRequireonly in call position while preserving lazy-load assertions forsigstore-verify.js.Reviewed by Cursor Bugbot for commit 708c25c. Configure here.