Skip to content

feat(importer): send the core importer version in init messages - #187

Merged
behnam-oneschema merged 2 commits into
mainfrom
devin/core-version-in-init-message
Aug 30, 2026
Merged

behnam-oneschema merged 2 commits into
mainfrom
devin/core-version-in-init-message

Conversation

@behnam-oneschema

Copy link
Copy Markdown
Member

Summary

Every message the importer posts into the embed iframe is stamped by #iframeEventEmit with version / client / @from, and setClient(client, version) overwrites both #client and #version. So for @oneschema/react, @oneschema/vue and @oneschema/angular the core importer version never reaches the app — the wrapper version takes its place, and server-side telemetry has no way to tell which core protocol actually ran a session.

That distinction is not cosmetic: React and Vue inline a core build, while @oneschema/angular takes @oneschema/importer as a peer, so @oneschema/angular@0.7.5 paired with core 0.6.1 for anyone who installed before #177 — a wrapper version simply does not imply a core version.

The fix is one immutable field and one line on the wire:

   #client = "Importer"
   #version = version          // wrapper-overwritable, unchanged
+  #coreVersion = version      // never touched by setClient()

   #iframeEventEmit(message) {
     ...JSON.stringify({
       version: this.#version,
       client: this.#client,
+      coreVersion: this.#coreVersion,
       "@from": `${this.#client}#${this.#version}`,

Deliberately not in launch()'s baseMessage or OneSchemaSharedInitParams: stamping it in the single place that already stamps identity means coreVersion cannot drift from the bundle it was built into, and no wrapper package needs to change (or can get it wrong). @from is left alone so existing log/debug parsing keeps working.

The consumer is oneschema/oneschema#20562, which reads coreVersion off the init/init-session message and records it as sdk_core_version on sdk_sessions_total. It ships first and treats the field as optional, so ordering is safe either way; until this is published, every session reports sdk_core_version="unknown".

Two incidental notes:

  • The changeset patches all four linked importer packages. That is not bookkeeping: React and Vue inline the core, so they have to be republished for their users to send anything at all.
  • packages/importer's test:ci was "true", i.e. CI ran no importer tests. The new regression test would never have run on a PR, so test:ci now actually invokes it (second commit). It is node --test against the built dist/main.js with a minimal window/iframe stub, matching the fact that the package has no unit-test harness today; test:unit builds first for local runs, while test:ci relies on CI's existing build step.

Test plan

The test that matters is the wrapper case — setClient("React", "0.7.4") must change version and @from while leaving coreVersion at the core package version:

corepack yarn workspace @oneschema/importer test:ci
  ✔ posts the core package version on init messages
  ✔ keeps the core version separate from the wrapper identity
  pass 2, fail 0

corepack yarn workspace @oneschema/importer check   # eslint + tsc --noEmit — passed
corepack yarn workspace @oneschema/importer build   # emitted oneschema-importer-0.7.5.min.js, module.mjs, index.d.ts

Built bundles now send coreVersion: "0.7.5".

Not exercised locally: an end-to-end wrapper session against a live embed app. The wrapper packages are untouched and the assertion above covers the only path that could regress, but the full-service confirmation will come from the SDK matrix in oneschema/oneschema once this is published.

Link to Devin session: https://app.devin.ai/sessions/bf7327c4513c45c0b0845edeb7aad2d9
Open in Devin Desktop: https://app.devin.ai/desktop/session/bf7327c4513c45c0b0845edeb7aad2d9?variant=devin
Requested by: @behnam-oneschema

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: ea4f53d2-66b1-4d1a-8a11-475117afead5

📥 Commits

Reviewing files that changed from the base of the PR and between 0b85af5 and ebcad0f.

📒 Files selected for processing (4)
  • .changeset/strong-cats-report.md
  • packages/importer/package.json
  • packages/importer/src/importer.ts
  • packages/importer/test/importer.test.cjs

Limit details: You’ve used the included review currently available. Your 109 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


Walkthrough

The importer now includes its core package version in outbound iframe initialization messages. Tests verify this metadata separately from wrapper-specific values. Importer CI scripts now run the Node test suite, and a changeset records patch releases.

Changes

Importer core version metadata

Layer / File(s) Summary
Add core version to iframe payload
packages/importer/src/importer.ts
The importer stores its package version and includes it as coreVersion in outbound iframe messages.
Validate and release the metadata change
packages/importer/test/importer.test.cjs, packages/importer/package.json, .changeset/strong-cats-report.md
Node tests verify initialization metadata and wrapper-specific values. CI scripts run the tests. The changeset records patch releases for four packages.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to ebcad

The PR adds the core importer version to iframe initialization messages while preserving wrapper identity fields and adds focused regression coverage; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: hkardos

🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Security Check ✅ Passed No new security concern is introduced. The PR adds only the static package version to messages that already contain client/version metadata and credentials. The existing postMessage target origin an…
Title check ✅ Passed The title uses the required Conventional Commits format, "feat(importer):", and accurately describes adding the core importer version to initialization messages.
Description check ✅ Passed The description directly explains the coreVersion change, wrapper-version behavior, package updates, testing changes, and test results.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (2 skipped: 2 unsupported.)

Full details: Security Check

Explanation

No new security concern is introduced. The PR adds only the static package version to messages that already contain client/version metadata and credentials. The existing postMessage target origin and message-source checks remain unchanged. #coreVersion is private, is not derived from user input, and does not affect authentication or authorization. The test fixture uses placeholder values only.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devin/core-version-in-init-message

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Bundle size report

Package/file Gzip size Raw size Delta vs base (gzip)
@oneschema/angular/esm2022/base-index.mjs 553 B 700 B 0 B (0.00%)
@oneschema/angular/esm2022/oneschema-angular.mjs 421 B 512 B 0 B (0.00%)
@oneschema/angular/esm2022/src/lib/oneschema.button.mjs 1,411 B 2,578 B 0 B (0.00%)
@oneschema/angular/esm2022/src/lib/oneschema.module.mjs 1,459 B 3,363 B 0 B (0.00%)
@oneschema/angular/esm2022/src/lib/oneschema.params.mjs 603 B 848 B 0 B (0.00%)
@oneschema/angular/esm2022/src/lib/oneschema.service.mjs 1,544 B 3,189 B 0 B (0.00%)
@oneschema/angular/esm2022/src/public-api.mjs 517 B 761 B 0 B (0.00%)
@oneschema/angular/fesm2022/oneschema-angular.mjs 1,465 B 5,025 B 0 B (0.00%)
@oneschema/filefeeds-react/main.js 7,857 B 35,825 B 0 B (0.00%)
@oneschema/filefeeds-react/module.js 7,730 B 35,424 B 0 B (0.00%)
@oneschema/filefeeds-react/module.mjs 7,731 B 35,425 B 0 B (0.00%)
@oneschema/filefeeds/main.js 6,694 B 29,909 B 0 B (0.00%)
@oneschema/filefeeds/module.js 6,647 B 29,774 B 0 B (0.00%)
@oneschema/filefeeds/module.mjs 6,648 B 29,775 B 0 B (0.00%)
@oneschema/filefeeds/oneschema-filefeeds-0.5.3.min.js 3,278 B 9,350 B 0 B (0.00%)
@oneschema/filefeeds/oneschema-filefeeds-0.5.latest.min.js 3,282 B 9,355 B 0 B (0.00%)
@oneschema/importer/main.js 8,443 B 39,638 B +27 B (0.32%)
@oneschema/importer/module.js 8,389 B 39,396 B +27 B (0.32%)
@oneschema/importer/module.mjs 8,390 B 39,397 B +27 B (0.32%)
@oneschema/importer/oneschema-importer-0.7.5.min.js 4,049 B 12,108 B +26 B (0.65%)
@oneschema/importer/oneschema-importer-0.7.latest.min.js 4,053 B 12,113 B +26 B (0.65%)
@oneschema/react/main.js 10,185 B 45,718 B +28 B (0.28%)
@oneschema/react/module.js 10,060 B 45,190 B +31 B (0.31%)
@oneschema/react/module.mjs 10,061 B 45,191 B +31 B (0.31%)
@oneschema/vue/main.js 26,781 B 114,082 B +46 B (0.17%)
@oneschema/vue/module.js 26,732 B 113,951 B +49 B (0.18%)
@oneschema/vue/module.mjs 26,733 B 113,952 B +49 B (0.18%)

@devin-ai-integration

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
coderabbitai Bot requested a review from hkardos August 30, 2026 02:35
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review August 30, 2026 02:41
@behnam-oneschema
behnam-oneschema enabled auto-merge (squash) August 30, 2026 03:04
behnam-oneschema and others added 2 commits August 29, 2026 20:04
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
test: ci was a no-op, so the new core-version regression test would never have run on a pull request.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@behnam-oneschema
behnam-oneschema force-pushed the devin/core-version-in-init-message branch from ebcad0f to b350169 Compare August 30, 2026 03:04
@behnam-oneschema
behnam-oneschema removed the request for review from hkardos August 30, 2026 03:05
@behnam-oneschema
behnam-oneschema merged commit 1e273db into main Aug 30, 2026
4 checks passed
@behnam-oneschema
behnam-oneschema deleted the devin/core-version-in-init-message branch August 30, 2026 03:07
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