Skip to content

Conversation

@itsh01
Copy link
Collaborator

@itsh01 itsh01 commented Jul 17, 2025

Add verifyPendingEntryPointsAPIsMismatch method

Summary

Adds a method to detect when pending entry points are waiting for private APIs that will never be available due to public/private mismatches.

Changes

  • Added verifyPendingEntryPointsAPIsMismatch() to AppHost interface
  • Implemented detection logic that checks ready APIs against pending dependencies
  • Throws descriptive error when private APIs are being consumed as public
  • Added test coverage for the mismatch scenario

Why

Prevents entry points from getting stuck waiting for APIs that will never be available, making dependency issues easier to debug during development.

Why not in repluggableAppDebug

This could be useful for runtime in certain cases, though not out of the box, since the loading flow should be controllable, e.g. for 2 phases of entry points loading, maybe the consumer will want to run it after the second phase, in production environment

Comment on lines +1244 to +1246
`Entry point '${entryPoint.name}' is waiting for API '${mismatchedAPI.name}' that will never be available for it to use.\n` +
`This usually happens when trying to consume a private API as a public API.\n` +
`If the API is intended to be public, it should be declared as "public: true" in the API key, and built in both bundles.`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error message should have a mention of function that can be used to detect reason of the error - verifyPendingEntryPointsAPIsMismatch in this case

Copy link
Collaborator Author

@itsh01 itsh01 Jul 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is manually triggered when you call verifyPendingEntryPointsAPIsMismatch and not automatically, as mentioned, to allow cases of multi staged loading (and also, I wouldn't want to run it after every batch of entry points, to avoid undesired performance overhead).
Do you imagine the manually triggered error directing you to run this check again?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I thought you always doing this check. In such a case, it's quite opaque flow - one needs to be aware of this difference between how repluggable handles entries with and without public properties. And as a consequence know about this utility.

So I believe in the future someone can face similar problem and will not know what to do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, since it's the app's responsibility rather than Repluggable's, since only the app knows what's the loading sequence and thus know when to run the verification.
We need to add the complementary call in the client code where we think it's most appropriate.

@itsh01 itsh01 merged commit 6cd78de into master Jul 17, 2025
1 check passed
@itsh01 itsh01 deleted the check-unready-waiting-for-private branch July 17, 2025 14:13
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.

4 participants