Repository navigation
chore: AI ruleset, quality check, Vitest and smoke tests of the built bundles - #223
Merged
Merged
Conversation
AGENTS.md, rules for code conventions, code on the customer's page and tests, the edit and stop hooks, the test-writer agent, the review command, the pre-push hook, the setup script, and the quality check that judges only what a branch adds, with its CI workflow. The quality core is byte-identical to Frontend's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 767 unit tests run on Vitest 4.1 with jsdom 26, unchanged in what they assert. Playwright loads the built bundles in Chromium: one global, every function index.d.ts declares, a strict nonce CSP, the ESM build, Node without a DOM, size budgets and the declared runtime packages. npm run typecheck checks index.d.ts. CI runs all of it; release.yml drops Jest's --ci flag, which Vitest refuses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copied from Frontend's fix-quality-core-default-branch (b2deefd0d2, draft PR GleapSDK/Frontend#3079), which is not on Frontend's master yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TobiasDuelli
marked this pull request as ready for review
November 18, 2026 14:00
LucaB01
approved these changes
Nov 18, 2026
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.
The AI-coding kit that Frontend and Server have, adapted to an SDK that runs on customers' pages, plus a test setup: Vitest instead of Jest, and Playwright smoke tests of the built bundles. The shipped bundles are byte-identical to
master.The kit
AGENTS.md,CLAUDE.md(@AGENTS.md)lateston every merge, npm on tags, the Messenger frame), commands, Done, Public API rules, Stop and ask, Production. Every command and path checked. There was noCLAUDE.mdbefore..claude/rules/code-conventions.mdsrc/index.jskeeps its default), frozen-object constants, JSDoc, and a one-job-one-system table of the SDK's own helpers (storage, cookies, nonce, frames,postMessage, links, API requests, selectors, idle work, masking)..claude/rules/host-page.md.claude/rules/testing.md.claude/settings.json,.claude/hooks/*npm run typecheck(the typings) andvitest related..claude/agents/test-writer.md.claude/commands/review.md.githooks/pre-push,.githooks/install.shmasterhere too). Installed byprepareand by the setup script.tools/quality/*,.github/workflows/quality.ymlconfig.mjs:src/**/*.js, not tests,*.generated.*or the vendoredsrc/unique-selector; PascalCase file names;<Name>.test.jscandidates; JS-flavoured fix texts.check.test.mjsruns the shared core cases plus this config's cases under Vitest (268 tests)..github/workflows/ci.ymlnpm pack --dry-run. Same job name as before. Actions pinned by SHA like Frontend.scripts/setup-worktree.shnpm ci(puts the rebuiltbuild/back), Playwright's Chromium. Copies no.env.Quality core: the fix "find the default branch instead of assuming origin/master" is not on Frontend's master yet. The core here is copied from
fix-quality-core-default-branchatb2deefd0d2(draft GleapSDK/Frontend#3079),core.sha25608c8424e…. If that PR changes before it merges, copy the core again.Two adaptations so the shared core cases pass in a JavaScript repo: the stop hook always runs
npm run typecheck(here a few seconds forindex.d.ts), and the "new runtime package" check lives in a smoke test instead of a banned import. A config-level ban collided with a core case.Research: what was adopted, and what was rejected
Adopted:
@deprecated, a CHANGELOG entry and the behaviour kept. Typings updated in the same PR. Options object from the 3rd parameter. A smoke test checksindex.d.tsagainstwindow.Gleap.cssText. No new HTML sinks with outside text.frameTargetOriginout.event.sourceor an exact origin in. Unknown names are ignored.babel.config.jsstates them, feature detection, no polyfills.runWhenIdle. Tasks stay under 50 ms.gleap-keys that are never renamed, masking at capture time, no fingerprinting.Rejected, with reasons:
.d.ts; the smoke test covers the contract.performancehints (uncompressed size only).defaultTrusted Types policy: it belongs to the customer.innerHTMLuses.sandboxon our frames: they are same-origin and need scripts.latest, an entry and its chunks can come from different versions.Partitionedcookies: these are first-party cookies.exportsorder, which would change the package's metadata. Left as an open point.Test setup
Vitest, not Jest. It matches Frontend and NativeApp, and the research found no strong reason against it here: no Babel is needed for tests, it runs ESM natively, and it supports the docblock environments. Versions:
!importantmargins with an extra shorthand, and jsdom 29 computesoverflow-xfrom anoverflowshorthand asvisible. Both are wrong against real browsers, and 11 existing assertions caught them. jsdom 26 is also what Jest 30 ships.expect()calls31 files changed mechanically (
jest.→vi., the vitest import, the@vitest-environmentdocblock). 11 changed by hand, and no assertion changed:GleapCSPNonce,GleapClickListener:isolateModules+require→vi.resetModules()+await import().GleapCaptureLogs:requireActual→importOriginal.GleapThemeManager: the real config manager comes from the module the test already imports.GleapScreenRecorder:requireMock→import.GleapSession:require('./Gleap')→import.GleapFrameManager: the mock listsGleapCaptureManager: undefined, because Vitest throws on a missing mock export where Jest returnedundefined.GleapAdminOrigins,GleapHelper,GleapMessageSecurity,GleapReplayRecorder: test titles only (%pdoes not exist in Vitest; a%%bug).Also:
jsdomURLhttp://localhost/as in Jest, and Node 25's ownlocalStorageswitched off in workers, as in Frontend.New,
npm run test:smoke(Playwright, Chromium headless shell, every request answered or aborted in the browser):window.Gleap, with no error.index.d.tsdeclares exists onwindow.Gleap, exceptsetLiveSite, which is declared but missing (open point).initializeunderscript-src 'nonce-…' 'strict-dynamic'; style-src 'nonce-…'with the API unreachable: no CSP violation and no page error.Gleap.survey-embed.js≤ 2 KB.srcimports only the declared runtime packages.Checked against mutations: a leaked global and a
<style>without a nonce fail it, and so doesimport 'rrweb'.New,
npm run typecheck:tsc --strictonindex.d.ts.The shipped SDK is unchanged
Built with each tree's own
npm ci(Node 25.8.1): a cleanmastercheckout (0296b6b) against this branch.build/browser/index.js49c08a4096ae3f84build/browser/index.js.map6db5d88cb9546d35build/cjs/index.jscbebe2511da78648build/cjs/index.js.mapa5e80a71f308b336build/esm/index.mjs95a9016ed95e69c3build/esm/index.mjs.map96dfe72f0740a453build/embed/survey-embed.js6f3feabe32d14c4bpublished/19.8.1/is identical.package.json(scripts and devDependencies).sdk.gleap.io/latest/index.jstoday has the same SHA-256 as both builds, so the CDN build is reproducible.source-map-jswent 1.2.1 → 1.2.2 (postcss, CSS only), and the output is unchanged.Dependencies
Added (dev):
vitest ^4.1.12,jsdom ^26.1.0,@playwright/test ^1.65.1,typescript ^5.9.3(quality check and typings check). Removed (dev):jest,jest-environment-jsdom, and with themscripts/testMock.js. Runtime: none.Other file changes:
release.yml:npm test -- --ci→npm test, because Vitest refuses--ciand the next release would fail. This is the only change there.preparealso installs the push hook; it fails silently when that is not possible..gitignore: Playwright's output folders.Repo hygiene (lists only, nothing changed)
masterprotection compared with Server: the same in effect. The org ruleset gives 1 approval, no force push and no deletion; Server also has a classic rule that only duplicates it. Neither has a required status check, so CI is not a merge gate.gleap/kai-voice(2026-08-25, 2 commits)fix-e2e-followups-sdk(closed fix(capture): screenshot downloads out of network logs, tint no-CORS images, user-switch identity race #179, a capture fix with tests, not on master)v7(2022),Feedback-Buttons(2020),tooltip-scrollview(2024)dependabot.yml; 165 open alerts. All 3 criticals are dev-only (webpack-dev-server). The 9 runtime-scope alerts (postcss, nanoid, source-map-js via rrweb-snapshot; fflate via @rrweb/packer) do not reach the CDN bundle. Proposal below.build/andpublished/included) found nothing in the code, the bundles or config, and no.env,.npmrcor key file was ever committed. It found 2 expired third-party tokens with personal data in old commits of a demo file. Details went to the maintainers privately, not into this public PR.demo/mediademo/index.js,demo/appwidget.*anddemo/index.min.cssfrom 2022swa-cli.config.json(Azure, unused)scripts/getPackageJson.js(unused)deploy:staging(no staging env inwrangler.jsonc)build/andpublished/latest/are stale at 19.4.1 and unused by releases.Proposed
.github/dependabot.yml125 branches fully merged into master
v3.1.102021-01-27new-screenshot-capture2021-03-13network-intercepter2021-03-25Readme-Update2021-03-26Replays2021-04-27fix2021-07-13v5.02021-07-20v5.0-app-ui2021-08-16Gleap2021-08-30Outbound-Actions2021-11-02randomize-multiple-choice2022-01-24capturewidget2022-01-27v8-movedtofixed2023-01-09bot2023-04-06v82023-06-19v12.0.02023-09-30Banner-z-index2023-10-05Tooltips2024-03-27tooltipsnew2024-04-22tooltip-mute-fix2024-07-29show-back-button-refactor2024-09-09chore/remove_ds_store2025-03-05Checklist-component2025-04-07engagement-tooltip-fix2025-04-24modal-action-button-url2025-05-13url-match-regex-fix2025-09-25screen-recorder-audio-fix2025-10-06url-regex-fix2025-10-08Added-AI-chatbar2025-10-14region-access2025-10-29checklist-producttour-action2025-12-04video-call-permissions2025-12-09red-dot-video-call2025-12-12checklist-callback-events2025-12-15checklist-event-updates2025-12-17complete-checklist-data2026-01-08hide-tooltip-on-click2026-01-12collapse-button-clickable2026-02-02default-cookie-set2026-03-02fix-child-repositions2026-03-17imp/default-font2026-03-18fix-flickering-tours2026-03-19fix-stale-activeelement2026-03-26fix-radix-pointer-events-conflict2026-04-27gleap-code/69ef75836eac35243fb454d8-7c4cb684-74fa-4f6a-9d41-b983f47707082026-04-27ai-agents2026-05-06aichatbar-hiding-fix2026-05-07observe-aichat-style-change2026-05-07page-filter-or-operator2026-05-08aichatbar-agent-name2026-05-08fix-product-tour-selector-anchor2026-05-12iframe-optimization2026-05-21iframe-tracking-workaroung2026-05-21info-card-loading-fix2026-05-21firefox-loading-fix2026-05-21ai-chatbar-mobile-style2026-06-23ai-chatbar-rework2026-06-29start-agent-method2026-06-30agent-frontend-tool2026-07-02fixed-chatbar-url2026-07-06replay-improvements2026-07-14conversation-read-notification-clear2026-07-16widget-home-v42026-07-16feature/company-identification2026-07-21tour-selector-autofill-fix2026-07-22loading-background2026-07-24gleap/141665-marker-scroll-drift2026-07-24gleap/141852-checklist-link-nested-target2026-07-26141887-widget-version-opt-in2026-07-27gleap/143124-openfeaturerequests-backbutton2026-08-07gleap/143226-csp-block-console-warning2026-08-10gleap/143352-preserve-identity-transient-session-failures2026-08-10gleap/modal-max-height2026-08-12gleap/143745-screencapture-animations-quadratic2026-08-13gleap/notification-card-redesign2026-08-17fix-145001-cobrowse-tour-audio-state2026-08-24gleap-145754-cobrowse-bubble-linebreaks2026-09-01gleap/146130-modal-blank-fallback2026-09-03kai/kai-alert-blocking-asset-creatio-88e84a072026-09-09feat/widget-realtime-domain2026-09-14gleap/147158-corp-headers2026-09-15v18-regions2026-09-18feat/authenticated-conversation-files2026-09-21gleap/147738-bounded-replay-buffer2026-09-21chore/bump-18.0.12026-09-21codex/public-repo-messaging-ai-domain2026-09-23readme-types-react-requirement2026-09-24gleap/148186-env-data-filter2026-09-25claude/screenshot-blocked-content2026-09-26release-18.1.12026-09-26claude/blocked-placeholder-layout2026-09-26claude/logs-v22026-09-27feature/messenger-expand-window2026-09-29kai/auto-detect-host-app-dark-light--a815aa692026-09-30ci/release-automation2026-09-30claude/tour-popover-flex-gap2026-10-01claude/capture-requests2026-10-01release/19.1.02026-10-01fix-admin-origin-gleap-ai2026-10-06kai/inline-banner-not-working-in-app-2679e2e92026-10-08feat/surveys-v22026-10-08feat/survey-skip-known2026-10-08release/19.2.1-js2026-10-08release/19.2.2-js2026-10-09kai-code/4dc7f75eadb0e18f71944376-36e00863-dbe0-4adf-9e7c-3f64884716b32026-10-09fix-websocket-close-code2026-10-11feat/capture-ui-v22026-10-12fix-e2e-live-202610122026-10-13fix-e2e1013-capture2026-10-13fix-e2e1013-postmessage-security2026-10-13fix-e2e-release-202610132026-10-13chore/release-19.3.12026-10-14fix-screenshot-iframes2026-10-14feat/custom-action-data2026-10-19feat/adopt-session2026-10-19chore/release-19.3.52026-10-21fix-225880-clear-identity-notification-cache2026-10-21fix-disable-cached-notifications-202610222026-10-22gleap/226492-contact-lang-update2026-10-27chore/release-19.3.6-with-2264922026-10-27fix-226629-226620-tooltips2026-10-28chore/version-19.8.02026-11-09kai-code/6afb09cb89dd294a61737312-addb9dd0-e586-40d7-80dd-0c08d96f8b8f2026-11-16types/missing-declarations2026-11-16shadow-dom-tours2026-11-17Open points
sdk.gleap.io/19.5.0,19.6.x,19.7.0and19.8.0return 404, and19.8.1will too after the next release. Since 19.5.0 nopublished/<version>/folder is committed, and the Workers build adds only the current version. Decide: commit version folders again in each release, or store them elsewhere (R2).AGENTS.mdstates the mechanism and leaves releases to people.Gleap.setLiveSiteis declared inindex.d.tsbut does not exist, so TypeScript callers get a runtimeTypeError. Remove it from the typings or add it. The smoke test lists it as the one known gap.unique-selectoris a runtime dependency nobody imports (the vendored copy insrc/unique-selectoris used). Every npm consumer installs it.Test, build and packandqualityrequired onmaster.eslint 8with@babel/eslint-parser(no config),uglify-js,babel-preset-minifyor@node-minify/*;wrangler 3is a major behind and has a high alert. No lint step in this PR: there is no ESLint config to adopt.typeslast inexports. Fixing it changes package metadata, so it was left out here.🤖 Generated with Claude Code