fix: preserve quoted hyphenated export names in discovery#1896
fix: preserve quoted hyphenated export names in discovery#1896IzaakGough wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the runtime loader to preserve literal hyphens in entry points for flat export names. The extractStack function in src/runtime/loader.ts has been updated to use separate prefixes for endpoint IDs and entry points, preventing hyphens from being incorrectly replaced with dots. Additionally, corresponding unit and integration tests have been added to verify this behavior. There are no review comments, and I have no feedback to provide.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request modifies the extractStack function in src/runtime/loader.ts to separate the prefix logic into endpointIdPrefix and entryPointPrefix. This change ensures that literal hyphens in flat export names are preserved in the entry point instead of being incorrectly replaced with dots, while nested object exports still correctly use dot notation. Unit and integration tests have been added to verify this behavior. There are no review comments, and I have no additional feedback to provide.
Fixes #8469
This change fixes function discovery for quoted export names that contain hyphens, for example:
Problem
The current discovery logic derives
entryPointfrom the manifest endpoint id by replacing-with..That works for grouped exports, where a flattened manifest id like
grouped-fnshould map back to an entry point likegrouped.fn.However, it is incorrect for quoted export names that literally contain hyphens. In that case, the discovered function id is something like
dummystore-bot, but converting that todummystore.botproduces the wrong runtime entry point.As a result, downstream tooling can fail to deploy or invoke these functions correctly.
Change
This PR updates runtime discovery to track two separate paths during stack extraction:
entryPoint, which preserves the actual export access pathWith this change:
entryPointfor downstream consumersTests
This PR adds coverage for the fix in two places:
extractStackCompanion Change In
firebase-toolsThis is the primary fix.
There is a companion PR in
firebase-toolsthat updates the CLI to trust the SDK-providedentryPointinstead of re-deriving it from function ids, and also updatesfunctions:shellto use the discoveredentryPoint.Companion PR: #10573
Validation
Validated with:
firebase-functionsdiscovery testsfirebase-toolsfollow-up changesnpm packon localfirebase-functionsnpm packon localfirebase-toolsdummystore-botThat deploy succeeded and the function was recognized and deployed under the correct name.