Skip to content

fix: keep recorded scope bindings in CachedSource cached data - #294

Merged
alexander-akait merged 1 commit into
claude/update-deps-github-actions-5ydosefrom
claude/scopes-cached-data
Sep 26, 2026
Merged

alexander-akait merged 1 commit into
claude/update-deps-github-actions-5ydosefrom
claude/scopes-cached-data

Conversation

@alexander-akait

Copy link
Copy Markdown
Member

Summary

Stacked on #293, which is stacked on #275; the diff here is only this fix.

#293 has CachedSource record the bindings a scopes request streams, so it can replay them. getCachedData() still dropped them. A CachedSource restored from webpack's persistent cache therefore had to stream its original again to report its bindings, and one restored without an original could not report them at all.

This change carries the recorded bindings in the buffered map entries of getCachedData(). The constructor already takes those entries as they are, so a restored source replays the bindings straight from its data. The field is only added when bindings were recorded, so cached data from requests without scopes is unchanged. The bindings are Map<string, string>s in an array indexed by source, which webpack's serializer handles.

What kind of change does this PR introduce?

fix

Did you add tests for your changes?

Yes, in test/scopes.js:

  • "keeps the bindings in the data a restored source is built from": a CachedSource restored from getCachedData(), whose original throws if it's used, produces the same scopes field. This test fails without the fix.
  • "adds nothing to the data when no request asked for scopes"

The full suite passes: 89,937 tests under node --test on Node.js 22, and under Jest on Node.js 20 and 10.

Does this PR introduce a breaking change?

No. Cached data gains an optional scopeBindings field only after a scopes request.

If relevant, what needs to be documented once your changes are merged or what have you already documented in this PR?

Nothing.

Use of AI

Claude Code found the gap while fixing #293 and wrote the change and tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ThsbPWvW5vnYWEaFs2Q22F


Generated by Claude Code

`getCachedData()` dropped the bindings a `scopes` request recorded, so
a `CachedSource` restored from persistent cache had to stream its
original again to report them, and one restored without an original
could not. Carry them in the buffered map entries; the constructor
already takes the entries as they are. Data from requests without the
`scopes` option is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ThsbPWvW5vnYWEaFs2Q22F
@changeset-bot

changeset-bot Bot commented Sep 26, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c86ff86

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

One or more co-authors of this pull request were not found. You must specify co-authors in commit message trailer via:

Co-authored-by: name <email>

Supported Co-authored-by: formats include:

  1. Anything <id+login@users.noreply.github.com> - it will locate your GitHub user by id part.
  2. Anything <login@users.noreply.github.com> - it will locate your GitHub user by login part.
  3. Anything <public-email> - it will locate your GitHub user by public-email part. Note that this email must be made public on Github.
  4. Anything <other-email> - it will locate your GitHub user by other-email part but only if that email was used before for any other CLA as a main commit author.
  5. login <any-valid-email> - it will locate your GitHub user by login part, note that login part must be at least 3 characters long.

Alternatively, if the co-author should not be included, remove the Co-authored-by: line from the commit message.

Please update your commit message(s) by doing git commit --amend and then git push [--force] and then request re-running CLA check via commenting on this pull request:

/easycla

@alexander-akait
alexander-akait merged commit c86ff86 into claude/update-deps-github-actions-5ydose Sep 26, 2026
3 of 4 checks passed
@alexander-akait
alexander-akait deleted the claude/scopes-cached-data branch September 26, 2026 13:22

Copy link
Copy Markdown
Member Author

Folded into #293, whose branch now includes this commit (c86ff86). Closing in favor of that single PR.


Generated by Claude Code

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.

2 participants