Skip to content

fix: publishing readiness, unit tests, and CI environment config#2

Merged
jaysin586 merged 1 commit into
mainfrom
fix/add-license-and-publish-readiness
Apr 14, 2026
Merged

fix: publishing readiness, unit tests, and CI environment config#2
jaysin586 merged 1 commit into
mainfrom
fix/add-license-and-publish-readiness

Conversation

@jaysin586

Copy link
Copy Markdown
Contributor

Summary

Adds all missing pieces required for npm publishing and Cloudflare docs deployment to work end-to-end. The previous PR (#1) failed CI due to missing LICENSE, missing unit tests, a console.log in src/lib, and incomplete workflow configuration.

Changes

📦 Publishing readiness

  • Add MIT LICENSE file (required for npm tarball)
  • Remove console.log from src/lib to pass the debug-check CI job
  • Add worker-configuration.d.ts for Cloudflare types

🧪 Unit tests

  • Add 31 vitest unit tests for ChatHeightCache, calculateTotalHeight, calculateOffsetForIndex, captureScrollAnchor, restoreScrollAnchor

🔄 CI/CD fixes

  • Add ci environment to coveralls workflow
  • Add docs environment to cloudflare-deploy workflow
  • Expand cloudflare-deploy trigger paths (src/, static/, config files)
  • Add pnpm cache to cloudflare-deploy setup-node step
  • Add sitemap:manifest script and generation for docs deploy

📦 Dependency bumps

  • Svelte 5.55.3 → 5.55.4
  • typescript-eslint 8.58.1 → 8.58.2
  • wrangler 4.81.1 → 4.82.2

Commits

  • 18737c2 fix: remove console.log from src/lib to pass debug-check CI
  • e5c872e test: add unit tests for ChatHeightCache and chatAnchoring
  • 4356d45 chore: add worker-configuration.d.ts for Cloudflare types
  • 787b680 build: bump svelte 5.55.4, typescript-eslint 8.58.2, wrangler 4.82.2
  • a5d7729 ci(cloudflare): expand deploy trigger paths and add pnpm cache
  • 02fa2a0 build: add sitemap:manifest script for cloudflare-deploy workflow
  • fa409da ci: add docs environment to cloudflare-deploy workflow
  • e69b539 ci: add ci environment to coveralls workflow
  • 5a6dcd8 chore: add MIT LICENSE file for npm publishing

The npm-publish workflow's debug-check job rejects console.log in
src/lib. Debug output is now exclusively via the onDebugInfo callback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e1e94ffe-7b81-4dea-a721-302973e932c4

📥 Commits

Reviewing files that changed from the base of the PR and between ba07382 and 18737c2.

📒 Files selected for processing (1)
  • src/lib/SvelteVirtualChat.svelte

📝 Walkthrough

Walkthrough

The debug prop was removed from SvelteVirtualChatProps, eliminating direct consumer control over debug logging output. Debug information continues to be computed and emitted via the existing onDebugInfo callback mechanism. Conditional console logging statements were deleted accordingly.

Changes

Cohort / File(s) Summary
Debug Logging Removal
src/lib/SvelteVirtualChat.svelte
Removed debug boolean prop and associated conditional console.log statements; debug info still flows through onDebugInfo callback.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 The debug flag hops away,
Yet info flows another way—
Through callbacks clean and bright,
The logs now out of sight,
Simpler code to start the day! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/add-license-and-publish-readiness

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

@blacksmith-sh

blacksmith-sh Bot commented Apr 14, 2026

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
tests/chat/scroll-away.spec.ts › Append While Scrolled Away/
starts with 50 messages following bottom
View Logs

Fix in Cursor

jaysin586 added a commit that referenced this pull request Apr 28, 2026
Pre-fix, the visible-range loop translated scrollTop into messages-local
coordinates with `Math.max(0, scrollTop - topGap)`, forgetting that the
header sits above the messages container in the same scroll space. With
a header on top, the loop walked offsets in the wrong coordinate system;
when the viewport sat past every message (e.g. inside a tall footer),
visibleStart fell back to 0 and the loop set visibleEnd to the last
index, so the slice spanned every message and virtualization collapsed.

- Extract calculateVisibleRange as a pure function in chatMeasurement,
  testable independently of the DOM
- Subtract headerHeight as well as topGap from scrollTop
- Anchor the visibleStart === -1 fallback at messages.length - 1 so
  overscan walks backwards from the end instead of dragging in the head
- Add unit tests covering both regression paths (fix #1, fix #2) plus
  the standard scrolled-top / scrolled-bottom / variable-height cases
jaysin586 added a commit that referenced this pull request Apr 28, 2026
Adds a realistic genai-style fixture (header inside the scroll box, tall
markdown-y messages, composer rendered as a sibling outside the chat)
and end-to-end coverage for the headerHeight visible-range bug. The
math-level "viewport inside tall footer" case is already covered by the
fix #2 unit test in chatMeasurement.svelte.test.ts.

- New /tests/chat/genai-like fixture with load-50 / load-200 buttons,
  debug stats strip, and a composer that lives outside the scroll box
- New tests/chat/genai-like.spec.ts: bounded DOM at 50 and 200 msgs,
  sequential anchored ids, domMessageCount parity
- header-footer.spec.ts: regression test pinning the viewport at the
  bottom and asserting dom < 25 with 50+ messages
- /tests landing page: link the new fixture under "Tests — Performance"
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