Skip to content

PR9: Enhanced Layer Support #3915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: pr8-unified-api
Choose a base branch
from

Conversation

ScriptedAlchemy
Copy link
Member

Summary

  • Add comprehensive unit tests for issuerLayer fallback logic for PR9
  • Complete implementation of Enhanced Layer Support as per the revised incremental PR plan

Changes Made

Test Coverage Added

  • issuerLayer fallback behavior verification: Tests demonstrate the fallback pattern that tries issuerLayer first, then falls back to undefined
  • createLookupKeyForSharing utility tests: Verify the utility function that creates lookup keys like (client)react for layered requests
  • Mocking improvements: Added proper mocks for resolveMatchedConfigs to support test environment

Implementation Details

The core functionality for PR9 was already implemented in the codebase:

Already Implemented Components:

  1. ConsumeSharedModule.ts - Layer parameter support (lines 72-74)
  2. ConsumeSharedFallbackDependency.ts - Layer support (lines 16-25)
  3. resolveMatchedConfigs.ts - issuerLayer priority logic (line 34: const layer = config.issuerLayer;)
  4. utils.ts - createLookupKeyForSharing function (lines 533-541)
  5. ConsumeSharedPlugin.ts - issuerLayer fallback logic pattern:
    unresolvedConsumes.get(createLookupKeyForSharing(request, contextInfo.issuerLayer)) ||
    unresolvedConsumes.get(createLookupKeyForSharing(request, undefined))

New Test Coverage:

  • Tests verify the fallback pattern works correctly
  • Tests verify createLookupKeyForSharing('react', 'client') returns '(client)react'
  • Tests verify edge cases with undefined, null, and empty string layer values
  • All 119 sharing tests now pass

Test Results

✓ 119 sharing tests passed
✓ issuerLayer fallback logic tests added and passing
✓ createLookupKeyForSharing utility tests passing

This completes PR9: Enhanced Layer Support as defined in the revised incremental PR plan. The implementation provides robust layer support with proper fallback mechanisms for shared module resolution.

🤖 Generated with Claude Code

ScriptedAlchemy and others added 2 commits July 15, 2025 12:12
- Added comprehensive tests for issuerLayer fallback behavior in ConsumeSharedPlugin
- Tests verify the fallback pattern: try issuerLayer first, fall back to undefined
- Tests verify createLookupKeyForSharing utility function behavior
- Added mocks for resolveMatchedConfigs to support test environment
- All 119 sharing tests now pass

This completes PR9: Enhanced Layer Support as per the implementation plan.
The core functionality was already implemented, this adds the missing tests.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

changeset-bot bot commented Jul 15, 2025

⚠️ No Changeset found

Latest commit: 2d5e3b6

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

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.

1 participant