Repository navigation
fix(importer): skip the embed launcher for missing or blank client IDs - #209
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
Bundle size report
|
behnam-oneschema
marked this pull request as ready for review
October 19, 2026 19:04
3 tasks done
behnam-oneschema
added a commit
that referenced
this pull request
Oct 19, 2026
…s (0.7.8 backport) (#210) ## Summary This backports #209 to the new `release/0.7` maintenance line as `@oneschema/importer` 0.7.8. It also adds the release plumbing that publishes that line under the npm dist-tag `release-0.7`, so `latest` never moves. `release/0.7` was cut from `9eaa44a0b42a8c9fbe8561a83384b554aabf5037` (`Version Packages (#188)`). All four `@oneschema/{importer,react,vue,angular}@0.7.7` tags point at that commit. ### Fix, adapted to the 0.7.7 synchronous API (no new public API or enum members) ```ts // setIframe(), after the destroyed check if (!this.#hasValidClientId()) { console.error(INVALID_CLIENT_ID_MESSAGE); return } // iframe src never set queryParams.push(`embed_client_id=${encodeURIComponent(this.#params.clientId)}`) // launch(), after _hasAttemptedLaunch = true; launchSession() delegates here // emits "launched" with, and returns, the same shape as the MissingJwt/MissingTemplate failures: { success: false, error: OneSchemaLaunchError.LaunchError, message: INVALID_CLIENT_ID_MESSAGE } ``` - A client ID is invalid when it is missing, not a string, or blank after trimming. The message is `"OneSchema config error: clientId must be a non-empty string"`. - The existing generic `LaunchError` code is used because main's `InvalidClientId` is a new enum member and can't ship in a patch. ### Maintenance release plumbing (this branch only; main's `release.yml` is untouched) - `.changeset/config.json`: `baseBranch: "release/0.7"`. - `package.json`: the `release` script runs `changeset publish --tag release-0.7`. - `release.yml`: triggers on push to `release/0.7`. The Changesets action gets `branch: release/0.7` and title/commit `Version Packages (release/0.7)`, so the version PR targets `release/0.7` from `changeset-release/release/0.7`, which can't collide with main's `changeset-release/main`. The read-only `verify` job, the `release` environment, OIDC trusted publishing, pinned actions, tag checks and `verify-published.mjs` (which packs `name@version`, not a dist-tag) are unchanged. ### How maintenance releases work (also in `CONTRIBUTING.md#maintenance-releases`; README updated) 1. `release/<major>.<minor>` is cut from that line's last release commit. 2. Fixes land through PRs into it, each with a patch changeset. 3. A push opens `Version Packages (release/0.7)`. Merging that PR publishes under `release-0.7`. 4. `^0.7.x` ranges resolve to the newest 0.7 patch by semver. `@oneschema/react@0.7.1` depends on `@oneschema/importer@^0.7.0`, so it picks up 0.7.8 on a fresh resolve or `npm update`. ## Repo-admin steps (Behnam) - [x] Add `release/0.7` to the `release` environment's deployment-branch policy. (API confirms the policies are now `main` and `release/0.7`.) - [x] Add branch protection for `release/0.7`. (`protect-main` ruleset now also includes `refs/heads/release/*`; API confirms `release/0.7` gets deletion, non-fast-forward, linear history, pull request and required status check rules.) - [x] Confirm npm trusted publishing for all four packages accepts `release.yml` + environment `release` when it runs from `release/0.7`. (npm's trusted-publisher settings have no branch field; the first real check is the first `release/0.7` publish.) ## Notes - `yarn changeset status --verbose` plans **only `@oneschema/importer` 0.7.8**. With this config the linked group does not bump the wrappers. React, Vue and Angular stay at 0.7.7, and their `^0.7.7` importer range already admits 0.7.8. I didn't add wrapper changesets. - Unverified: the Changesets action also creates GitHub Releases, and GitHub may mark a 0.7.x release as the repo's "Latest" release after 1.0 ships. This does not affect npm's `latest` tag. ## Testing - `yarn build`, `yarn check` (0 errors; one pre-existing ESLint warning in `filefeeds-react`), `yarn test:ci` (importer 9/9), `yarn check:ranges`, `yarn check:install`, `actionlint`. - New importer tests cover `""`, whitespace, `undefined` and `123` (no src, no iframe, exact failure return and `launched` event, `console.error`, no iframe message). They also cover managed-DOM construction with no client ID (nothing appended), the unchanged default URL, encoding `client id/one` → `client%20id%2Fone`, and `launchSession()` returning the same failure. Link to Devin session: https://app.devin.ai/sessions/8e97956405544cdb86cfaa00c37b94ca Open in Devin Desktop: https://app.devin.ai/desktop/session/8e97956405544cdb86cfaa00c37b94ca?variant=devin Requested by: @behnam-oneschema --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
Summary
OneSchemaImporterClassbuilt the iframe URL asembed_client_id=${clientId}. An integration that mounts the importer before its config has loaded therefore loaded/embed-launcher?embed_client_id=(or=undefined) and showed the error page. In prod this comes to roughly 5k blank launches a day from one customer on@oneschema/react0.7.1, repeating every few seconds.Behavior change, when
clientIdis missing, not a string, or blank after trim:INVALID_CLIENT_ID_MESSAGEis "OneSchema config error: clientId must be a non-empty string".OneSchemaLaunchError.InvalidClientIdis a new enum member. None of the existing codes fit:MissingJwt,MissingTemplateandMissingSessionTokeneach name a different parameter. It is appended afterCancelled, so the numeric values of the existing members don't change. It is documented in the enum JSDoc and in the synchronous-rejection list inpackages/importer/LAUNCH-SEQUENCE.md.mainalready carries unreleased major changesets, so a new member is fine here.encodeURIComponent-ed in the launcher URL. For plain IDs such asclient-idthe URL doesn't change..changeset/blank-client-id.md(@oneschema/importerpatch).Testing
yarn build: passes.yarn check: passes afteryarn build. There are 0 errors and one existing ESLint warning infilefeeds-react.yarn workspace @oneschema/importer test:ci: 42/42 pass. The new tests:clientIdof"", whitespace,undefinedor123sets no iframe src.launch()andlaunchSession()reject withInvalidClientIdand emit thelaunchedfailure event.@oneschema/reacthas no automated test harness. Itstest:ciistrue, andtest/holds only a manual Parcel page, so this PR adds no<OneSchemaImporter clientId="">test there.yarn check: this is a build-order issue, not something this PR introduced. On a cleanorigin/main,yarn checkwithout a prior build fails the same way (@oneschema/importernot found, then cascadingOneSchemaServiceerrors), and it passes afteryarn build. CI already runs "Build packages" before "Check packages".Link to Devin session: https://app.devin.ai/sessions/8e97956405544cdb86cfaa00c37b94ca
Open in Devin Desktop: https://app.devin.ai/desktop/session/8e97956405544cdb86cfaa00c37b94ca?variant=devin
Requested by: @behnam-oneschema