Skip to content

Aurora shimmer cards 6128441558600978070 follow up - #203

Closed
alehar9320 wants to merge 7 commits into
mainfrom
aurora-shimmer-cards-6128441558600978070-follow-up
Closed

alehar9320 wants to merge 7 commits into
mainfrom
aurora-shimmer-cards-6128441558600978070-follow-up

Conversation

@alehar9320

@alehar9320 alehar9320 commented May 21, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added shimmer effect to portfolio preview cards
    • Integrated PostHog analytics
  • Tests

    • Added PostHog client test suite with validation scenarios
    • Enhanced test infrastructure with improved mock configurations
  • Chores

    • Updated deployment configuration paths
    • Added posthog-node dependency
    • Removed legacy metrics entries
    • Improved alias resolution in test configuration

Review Change Stack

google-labs-jules Bot and others added 7 commits May 20, 2026 21:15
- Competitive Signal: Vercel/Linear style hover effects.
- User Emotion Targeted: Joy, surprise.
- Implementation:
  - Lines of code: 12 (in PortfolioPreview.astro)
  - Feature flag: shimmer
- Verification:
  - format: ✅
  - lint: ✅
  - astro check: ✅
  - test: ✅
  - build: ✅

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
- Replaced direct 'cloudflare:workers' import with 'locals.runtime.env' access for portability.
- Updated 'src/__tests__/chat-api.test.ts' to provide the mock environment via 'locals.runtime.env'.
- Verified build with 'RENDER=true npm run build'.
- Verified all tests pass.

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
Competitive Signal: Vercel/Linear card effects.
User Emotion Targeted: Surprise.
Implementation:
- Lines of code: 11 (across components, schemas, and flags).
- Feature flag: shimmer.
- Experimental route: N/A.
Verification:
- format: ✅
- lint: ✅
- astro check: ✅
- test: ✅
- build: ✅
Abort Triggers: None.

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
Delight: Shimmering Cards Micro-Interaction
Competitive Signal: Vercel/Linear card effects.
User Emotion Targeted: Surprise.
Implementation:
- Lines of code: 11 (micro-interaction).
- Feature flag: shimmer.
- Experimental route: N/A.

Infrastructure: Render Build Fix
- Added Vite alias for 'cloudflare:workers' to resolve Rollup import errors on non-Cloudflare platforms.
- Verified fix with local Node adapter build.

Verification:
- format: ✅
- lint: ✅
- astro check: ✅
- test: ✅
- build: ✅ (Cloudflare & Node)
- visual: ✅ (Overflow hidden applied)

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
Delight: Shimmering Cards Micro-Interaction
- Implemented CSS shimmer overlay on portfolio cards.
- Added feature flag validation via Zod.
- Fixed visual bleed with overflow: hidden.

Infrastructure: Render Build Fix
- Added Vite alias for 'cloudflare:workers' to mock during Render/Node builds.
- Fixed Prettier formatting in astro.config.mjs.

Verification:
- format: ✅
- lint: ✅
- astro check: ✅
- test: ✅
- build: ✅ (Cloudflare & Node/Render)

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
Delight: Shimmering Cards Micro-Interaction
- Implemented CSS shimmer overlay on portfolio cards.
- Added feature flag validation via Zod.
- Fixed visual bleed with overflow: hidden.

Infrastructure: Render Build Fix
- Added Vite alias for 'cloudflare:workers' to mock during Render/Node builds.
- Improved alias path resolution using `fileURLToPath` for cross-platform compatibility.
- Fixed Prettier formatting in astro.config.mjs.

Verification:
- format: ✅
- lint: ✅
- astro check: ✅
- test: ✅
- build: ✅ (Cloudflare & Node/Render Target)
- visual: ✅ (Overflow hidden applied)

Co-authored-by: alehar9320 <5390430+alehar9320@users.noreply.github.com>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@alehar9320
alehar9320 temporarily deployed to aurora-shimmer-cards-6128441558600978070-follow-up - astro-cloudflare-personal-website-web-service PR #203 May 21, 2026 18:11 — with Render Destroyed
@coderabbitai

coderabbitai Bot commented May 21, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

PR adds PostHog analytics singleton client, refactors chat API to use direct Cloudflare env binding with updated test mocking, introduces shimmer UI effect for portfolio cards, expands public exports for releases utility, and updates Astro/Vitest configuration with proper path resolution for environment and mock aliasing.

Changes

PostHog Analytics Integration

Layer / File(s) Summary
PostHog client implementation and tests
src/lib/posthog.ts, src/lib/posthog.test.ts
Exports getPostHogClient() singleton that validates PUBLIC_POSTHOG_KEY and PUBLIC_POSTHOG_HOST, returns null on validation failure with error logging, and lazily constructs/caches a PostHog instance; comprehensive tests verify null behavior for missing/invalid config, successful instantiation with valid values, and client reuse across calls.
PostHog dependency installation
package.json
Adds posthog-node@^5.33.0 as a runtime dependency.

Chat API Environment Binding Refactor

Layer / File(s) Summary
Chat API route refactoring
src/pages/api/chat.ts
Imports Cloudflare Workers env binding directly; narrows POST handler parameter to { request } (removes locals); resolves AI and CHAT_STORE from env cast as ChatEnv; ChatEnv type changes from exported to internal interface.
Chat API tests and build alias configuration
src/__tests__/chat-api.test.ts, astro.config.mjs, vitest.config.ts
Test harness imports Workers env, uses Partial<Env> for mock environment, provides empty locals, and manages mockEnv bindings in helper; Astro config adds conditional vite.resolve.alias mapping cloudflare:workers to mock module when in Render mode; Vitest config imports fileURLToPath and reworks test alias resolution to use proper filesystem paths instead of .pathname directly.

Shimmer UI Effect for Portfolio Cards

Layer / File(s) Summary
Shimmer schema and configuration
src/content/schemas/delights.ts, src/content/delights.json
Zod schema DelightSchema exports shimmer boolean field with false default; delights.json config sets shimmer: true to enable feature.
PortfolioPreview component with shimmer effect
src/components/PortfolioPreview.astro
Component imports and parses delights.json through DelightSchema, conditionally adds shimmer CSS class to portfolio card link; new CSS defines hover shimmer overlay with ::after pseudo-element using linear gradient and keyframes animation.
Shimmer documentation
.Aurora/delights.md
Dated entry documents "Shimmering Cards" feature with "Signal: Competitive" and "Lean Implementation: CSS shimmer overlay".

Public API Exports Expansion

Layer / File(s) Summary
github-releases module exports
src/utils/github-releases.ts
ReleaseItem interface changes from internal to exported; module exports expanded to include REPO_URL alongside RELEASES_PAGE_URL.
Example component test setup
src/components/__tests__/example.test.ts
New Vitest test file demonstrates project test setup with a passing trivial assertion, providing a template for component testing.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested labels

size/L

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Aurora shimmer cards 6128441558600978070 follow up' refers to a real aspect of the changeset (shimmer card functionality and delights feature), but includes a cryptic numeric identifier that appears to be an issue/reference number without context, making it unclear and potentially confusing for someone scanning the git history. Consider removing the numeric identifier or replacing it with a clearer reference format (e.g., '#6128441558600978070') to make the title more readable and maintainable in the git history.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aurora-shimmer-cards-6128441558600978070-follow-up

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@mergify mergify Bot added the size/L label May 21, 2026
@codecov

codecov Bot commented May 21, 2026 •

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

Affected Assets, Files, and Routes:

view changes for bundle: molecular-mars-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
_astro/page.7B3wUQdQ.js (New) 264.73kB 264.73kB 100.0% 🚀
_astro/PostHog.astro_astro_type_script_index_0_lang.DdmGLYQ_.js (New) 188.58kB 188.58kB 100.0% 🚀
_astro/github-releases.BMxmVSTW.js (New) 63.1kB 63.1kB 100.0% 🚀
_astro/whats-new.astro_astro_type_script_index_0_lang.xW27F-op.js (New) 2.85kB 2.85kB 100.0% 🚀
_astro/Footer.astro_astro_type_script_index_0_lang.B8BH94k4.js (New) 718 bytes 718 bytes 100.0% 🚀
_astro/page.BjHlUFBB.js (Deleted) -264.73kB 0 bytes -100.0% 🗑️
_astro/PostHog.astro_astro_type_script_index_0_lang.BHpblTFJ.js (Deleted) -188.58kB 0 bytes -100.0% 🗑️
_astro/github-releases.BNujVhKr.js (Deleted) -63.1kB 0 bytes -100.0% 🗑️
_astro/whats-new.astro_astro_type_script_index_0_lang.pbyaYvw8.js (Deleted) -2.85kB 0 bytes -100.0% 🗑️
_astro/Footer.astro_astro_type_script_index_0_lang.CFRAAYXa.js (Deleted) -718 bytes 0 bytes -100.0% 🗑️

Files in _astro/github-releases.BMxmVSTW.js:

  • ./src/utils/github-releases.ts → Total Size: 3.15kB

@cloudflare-workers-and-pages

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
me 128d32a Commit Preview URL

Branch Preview URL
May 21 2026, 06:12 PM

@codecov

codecov Bot commented May 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
src/lib/posthog.test.ts (1)

17-22: ⚡ Quick win

Add coverage for the "empty key" branch.

The source file has a dedicated branch that's meant to log an error when the key is present but invalid (e.g., empty string), but there's currently no test exercising PUBLIC_POSTHOG_KEY=''. Adding such a test would both lock in the intent and surface the bug noted on posthog.ts (the if (env.key) truthy-check actually skips the empty-string case, contrary to the inline comment there).

♻️ Suggested additional test
+  it('returns null without logging when the PostHog key is an empty string', async () => {
+    vi.stubEnv('PUBLIC_POSTHOG_KEY', '');
+    const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+
+    const { getPostHogClient } = await import('./posthog');
+
+    expect(getPostHogClient()).toBeNull();
+    // Decide intended behavior: should this log? Currently it does NOT,
+    // which contradicts the comment in posthog.ts.
+    expect(consoleSpy).not.toHaveBeenCalled();
+    expect(PostHogMock).not.toHaveBeenCalled();
+  });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/posthog.test.ts` around lines 17 - 22, Add a new test that exercises
the "empty key" branch by setting process.env.PUBLIC_POSTHOG_KEY = '' before
importing the module, then import getPostHogClient (use jest.resetModules() or
jest.isolateModules to ensure the env is read on import), call
getPostHogClient() and assert the expected behavior (e.g., returns null) and
that the error logging path was invoked (verify PostHogMock was not called and
the logger/error function was called); reference the getPostHogClient function
and PostHogMock to locate where to add assertions.
src/lib/posthog.ts (2)

29-35: 💤 Low value

Singleton caches config from the first successful call.

posthogClient is created once and reused even if PUBLIC_POSTHOG_KEY/PUBLIC_POSTHOG_HOST change later (e.g., during HMR or test runs that don't reset the module). Tests already work around this via vi.resetModules(), so consumers in production are unaffected — flagging so reviewers know this is intentional.

Also note: with flushAt: 1 / flushInterval: 0, every capture triggers an immediate send. In Cloudflare Workers you'll likely still need ctx.waitUntil(client.flush()) (or shutdown()) at the end of each request to guarantee in-flight requests aren't dropped when the isolate is suspended. Not a defect here, but worth ensuring at call sites.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/posthog.ts` around lines 29 - 35, The singleton posthogClient is
created once and reused even if the incoming key/host change; update the factory
so it detects config changes and recreates the client when needed: read the
current key and host values and if posthogClient exists but its
storedKey/storedHost (add small internal vars like cachedPosthogKey and
cachedPosthogHost) differ from the current key/host, call
posthogClient.shutdown()/flush() if available, then replace it with a new
PostHog(key, { host, flushAt: 1, flushInterval: 0 }); alternatively expose a
resetPosthogClient() helper to clear the cached client for tests; reference the
posthogClient variable and the new PostHog(...) constructor when implementing
this change.

6-9: 💤 Low value

Use Zod v4 z.url() for host

z.string().url() is deprecated in Zod v4; prefer the standalone z.url() format schema.

♻️ Optional refactor
 const PostHogConfigSchema = z.object({
   key: z.string().min(1),
-  host: z.string().url().optional(),
+  host: z.url().optional(),
 });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/posthog.ts` around lines 6 - 9, Replace the deprecated
z.string().url() usage in the PostHogConfigSchema by using the Zod v4 url
schema: update the host field in PostHogConfigSchema to use z.url().optional()
instead of z.string().url(), ensuring the schema still validates optional URLs;
(make the change where PostHogConfigSchema is declared and keep the key field
as-is).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Line 31: The PR introduced a new top-level runtime dependency "posthog-node"
in package.json which violates the rule that new top-level deps require explicit
permission; either remove/revert that dependency from package.json (or change it
to a dev-only dependency if appropriate) or update the PR with explicit approval
from the designated approver (add the approver's sign-off in the PR description)
before merging; locate the change by inspecting the package.json entry
"posthog-node" and act accordingly.

In `@src/components/PortfolioPreview.astro`:
- Around line 86-100: Update the infinite hover shimmer so it respects users'
reduced-motion preference: wrap the animation and related properties in a
prefers-reduced-motion: no-preference media query, rename the `@keyframes` from
the single-letter identifier `s` to a descriptive name like `shimmer-slide`, and
add `pointer-events: none` to `.shimmer:hover::after` so the overlay can't block
nested element interactions; ensure the animation property on
`.shimmer:hover::after` references the new `shimmer-slide` keyframes.

In `@src/lib/posthog.test.ts`:
- Around line 1-65: The comment in getPostHogClient about "Only log if the key
is present but invalid (e.g. empty string)" is out of sync with the code because
the current conditional uses if (env.key) which treats '' as falsy and prevents
logging; update the conditional in the getPostHogClient implementation to
explicitly check for undefined (e.g., if (env.key !== undefined)) so an empty
string will still trigger the error logging path, and keep the comment as-is (or
instead update the comment to match whichever behavior you choose).

---

Nitpick comments:
In `@src/lib/posthog.test.ts`:
- Around line 17-22: Add a new test that exercises the "empty key" branch by
setting process.env.PUBLIC_POSTHOG_KEY = '' before importing the module, then
import getPostHogClient (use jest.resetModules() or jest.isolateModules to
ensure the env is read on import), call getPostHogClient() and assert the
expected behavior (e.g., returns null) and that the error logging path was
invoked (verify PostHogMock was not called and the logger/error function was
called); reference the getPostHogClient function and PostHogMock to locate where
to add assertions.

In `@src/lib/posthog.ts`:
- Around line 29-35: The singleton posthogClient is created once and reused even
if the incoming key/host change; update the factory so it detects config changes
and recreates the client when needed: read the current key and host values and
if posthogClient exists but its storedKey/storedHost (add small internal vars
like cachedPosthogKey and cachedPosthogHost) differ from the current key/host,
call posthogClient.shutdown()/flush() if available, then replace it with a new
PostHog(key, { host, flushAt: 1, flushInterval: 0 }); alternatively expose a
resetPosthogClient() helper to clear the cached client for tests; reference the
posthogClient variable and the new PostHog(...) constructor when implementing
this change.
- Around line 6-9: Replace the deprecated z.string().url() usage in the
PostHogConfigSchema by using the Zod v4 url schema: update the host field in
PostHogConfigSchema to use z.url().optional() instead of z.string().url(),
ensuring the schema still validates optional URLs; (make the change where
PostHogConfigSchema is declared and keep the key field as-is).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 953cec8d-871b-4d2d-822a-1b27ebebb17d

📥 Commits

Reviewing files that changed from the base of the PR and between c4fd62f and 128d32a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (15)
  • .Aurora/delights.md
  • .Pruning/metrics.md
  • .wrangler/deploy/config.json
  • astro.config.mjs
  • package.json
  • src/__tests__/chat-api.test.ts
  • src/components/PortfolioPreview.astro
  • src/components/__tests__/example.test.ts
  • src/content/delights.json
  • src/content/schemas/delights.ts
  • src/lib/posthog.test.ts
  • src/lib/posthog.ts
  • src/pages/api/chat.ts
  • src/utils/github-releases.ts
  • vitest.config.ts
💤 Files with no reviewable changes (1)
  • .Pruning/metrics.md

Comment thread package.json
"@sentry/cloudflare": "^10.50.0",
"astro": "^6.3.3",
"posthog-js": "^1.372.6",
"posthog-node": "^5.33.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

New top-level dependency — confirm explicit permission.

Adding posthog-node introduces a new runtime dependency. Per the repo guidelines, new top-level dependencies require explicit permission (Zod is the only standing exception). Please confirm this addition was pre-approved before merging.

As per coding guidelines: "NEVER add new top-level dependencies without explicit permission (except Zod which is a core dependency)".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 31, The PR introduced a new top-level runtime
dependency "posthog-node" in package.json which violates the rule that new
top-level deps require explicit permission; either remove/revert that dependency
from package.json (or change it to a dev-only dependency if appropriate) or
update the PR with explicit approval from the designated approver (add the
approver's sign-off in the PR description) before merging; locate the change by
inspecting the package.json entry "posthog-node" and act accordingly.

Comment on lines +86 to +100
.shimmer:hover::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
animation: s 1.2s infinite;
}
@keyframes s {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Respect prefers-reduced-motion for the infinite shimmer.

The hover shimmer runs an infinite translate animation with no reduced-motion guard. Users who have requested reduced motion (vestibular/motion sensitivity) will still see the looping effect. Gate the animation behind a media query so it only animates when motion is allowed.

♿ Proposed fix
   .shimmer:hover::after {
     content: '';
     position: absolute;
     inset: 0;
+    pointer-events: none;
     background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
-    animation: s 1.2s infinite;
+    animation: shimmer-sweep 1.2s infinite;
   }
-  `@keyframes` s {
+  `@keyframes` shimmer-sweep {
     0% {
       transform: translateX(-100%);
     }
     100% {
       transform: translateX(100%);
     }
   }
+  `@media` (prefers-reduced-motion: reduce) {
+    .shimmer:hover::after {
+      animation: none;
+    }
+  }

Also renames the keyframe from the single-letter s to a self-describing identifier and adds pointer-events: none so the overlay can never interfere with hit-testing on nested elements.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.shimmer:hover::after {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
animation: s 1.2s infinite;
}
@keyframes s {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}
.shimmer:hover::after {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
animation: shimmer-sweep 1.2s infinite;
}
`@keyframes` shimmer-sweep {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(100%);
}
}
`@media` (prefers-reduced-motion: reduce) {
.shimmer:hover::after {
animation: none;
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/PortfolioPreview.astro` around lines 86 - 100, Update the
infinite hover shimmer so it respects users' reduced-motion preference: wrap the
animation and related properties in a prefers-reduced-motion: no-preference
media query, rename the `@keyframes` from the single-letter identifier `s` to a
descriptive name like `shimmer-slide`, and add `pointer-events: none` to
`.shimmer:hover::after` so the overlay can't block nested element interactions;
ensure the animation property on `.shimmer:hover::after` references the new
`shimmer-slide` keyframes.

Comment thread src/lib/posthog.test.ts
Comment on lines +1 to +65
import { beforeEach, describe, expect, it, vi } from 'vitest';
import type { Mock } from 'vitest';

const PostHogMock = vi.fn();

vi.mock('posthog-node', () => ({
PostHog: PostHogMock,
}));

describe('getPostHogClient', () => {
beforeEach(() => {
PostHogMock.mockClear();
vi.resetModules();
vi.unstubAllEnvs();
});

it('returns null when the PostHog key is missing', async () => {
const { getPostHogClient } = await import('./posthog');

expect(getPostHogClient()).toBeNull();
expect(PostHogMock).not.toHaveBeenCalled();
});

it('returns null and logs an error when the PostHog host is invalid', async () => {
vi.stubEnv('PUBLIC_POSTHOG_KEY', 'test-key');
vi.stubEnv('PUBLIC_POSTHOG_HOST', 'not-a-url');
const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});

const { getPostHogClient } = await import('./posthog');

expect(getPostHogClient()).toBeNull();
expect(consoleSpy).toHaveBeenCalled();
expect(PostHogMock).not.toHaveBeenCalled();
});

it('creates a PostHog client with the configured env vars', async () => {
vi.stubEnv('PUBLIC_POSTHOG_KEY', 'test-key');
vi.stubEnv('PUBLIC_POSTHOG_HOST', 'https://eu.i.posthog.com');

const { getPostHogClient } = await import('./posthog');

const client = getPostHogClient();

expect(PostHogMock).toHaveBeenCalledTimes(1);
expect(PostHogMock).toHaveBeenCalledWith('test-key', {
host: 'https://eu.i.posthog.com',
flushAt: 1,
flushInterval: 0,
});
expect(client).toBe((PostHogMock as Mock).mock.results[0]?.value);
});

it('reuses the cached PostHog client for repeated calls', async () => {
vi.stubEnv('PUBLIC_POSTHOG_KEY', 'test-key');
vi.stubEnv('PUBLIC_POSTHOG_HOST', 'https://eu.i.posthog.com');

const { getPostHogClient } = await import('./posthog');

const firstClient = getPostHogClient();
const secondClient = getPostHogClient();

expect(firstClient).toBe(secondClient);
expect(PostHogMock).toHaveBeenCalledTimes(1);
});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Root cause note: comment vs. behavior mismatch in posthog.ts.

Cross-referencing with src/lib/posthog.ts lines 19-25: the comment says "Only log if the key is present but invalid (e.g. empty string)", but if (env.key) treats '' as falsy and therefore does not log on an empty string — the opposite of what the comment promises. Either tighten the check to if (env.key !== undefined) or update the comment to match. Mentioning here since the test suite is the natural place this would have been caught.

🐛 Suggested fix in src/lib/posthog.ts
   if (!result.success) {
-    // Only log if the key is present but invalid (e.g. empty string)
-    if (env.key) {
+    // Only log if the key is present (including empty string) but invalid
+    if (env.key !== undefined) {
       console.error('Invalid PostHog configuration:', result.error.format());
     }
     return null;
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/posthog.test.ts` around lines 1 - 65, The comment in getPostHogClient
about "Only log if the key is present but invalid (e.g. empty string)" is out of
sync with the code because the current conditional uses if (env.key) which
treats '' as falsy and prevents logging; update the conditional in the
getPostHogClient implementation to explicitly check for undefined (e.g., if
(env.key !== undefined)) so an empty string will still trigger the error logging
path, and keep the comment as-is (or instead update the comment to match
whichever behavior you choose).

@mergify mergify Bot added the conflict label May 21, 2026
@mergify mergify Bot removed the conflict label Aug 14, 2026
@mergify

mergify Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@mergify mergify Bot added the conflict label Aug 14, 2026
@alehar9320

Copy link
Copy Markdown
Owner Author

Stale agent-codename PR. Closed to clear the queue after hire-path and Astro 7 landed on main. Reopen only if we explicitly pick this work up against current main.

@alehar9320 alehar9320 closed this Aug 15, 2026
@mergify mergify Bot removed the conflict label Aug 15, 2026

This branch was successfully deployed

No deployments
aurora-shimmer-cards-6128441558600978070-follow-up - astro-cloudflare-personal-website-web-service PR #203 — 128d32a3 Deployed May 21, 2026 by alehar9320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant