Skip to content

Conversation

@charliecreates
Copy link
Contributor

Adds the vibe identified by the slug occupational-basilisk-4371 to the Featured Vibes collection.

Context

  • Issue: add to featured vibes #274
  • Source of truth: app/components/FeaturedVibes.tsx (publishedVibes array)
  • Display name resolved from the published app’s <title> tag: “Create Emotional Playlists”.

Changes

  • Inserted { name: 'Create Emotional Playlists', slug: 'occupational-basilisk-4371' } at the top of publishedVibes.

Impact

  • Surfaces consuming Featured Vibes (e.g., Quick Suggestions on the home route) will now randomly include this vibe among the featured set (component shuffles and slices to requested count).
  • No ordering/limit replacement required: the component shuffles publishedVibes and slices by count, so adding an item simply increases the candidate pool.
  • No API/feed changes detected; the featured list is front-end only.

Verification

# Local checks
$ pnpm check
✓ format: no changes
✓ typecheck: pass
✓ tests: 69 files, 395 tests passed (4 skipped)

# Slug existence
$ curl -sSIL https://occupational-basilisk-4371.vibesdiy.app/ | head -n1
HTTP/2 200
$ curl -sSIL https://occupational-basilisk-4371.vibesdiy.app/screenshot.png | head -n1
HTTP/2 200

Closes #274

@netlify
Copy link

netlify bot commented Aug 21, 2025

Deploy Preview for fireproof-ai-builder ready!

Name Link
🔨 Latest commit e8052bf
🔍 Latest deploy log https://app.netlify.com/projects/fireproof-ai-builder/deploys/68ed3f9488cf090008d0b4b7
😎 Deploy Preview https://deploy-preview-280--fireproof-ai-builder.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor Author

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

  • Overwriting window.location directly in tests risks cross-test pollution and missing Location properties; mock the getter and restore after each test instead. [tests/vibe-route.test.tsx]
  • Tests relying on Date.now and setTimeout(10) are flaky; switch to fake timers and fixed system time. [tests/useSimpleChat/saveCode.test.tsx]
  • vite.server.allowedHosts was narrowed to a single Netlify host, likely breaking ngrok and other dev flows; make it configurable and include prior defaults. [vite.config.ts]
  • Minor: misleading comment in Vite config still references ngrok despite setting a Netlify domain.
Summary of changes
  • Updated multiple tests to reflect eager Fireproof initialization and removed legacy API key/credit checks.
  • Rewrote useSession tests to mock use-fireproof directly and assert eager DB init calls; adjusted expectations accordingly.
  • Removed post-login effect test and added new saveCodeAsAiMessage tests for useSimpleChat.
  • Modified vibe-route tests to assert redirect via window.location.replace instead of iframe embedding.
  • Added a settings-route detection test to useViewState.
  • Tweaked AuthContext mocks across tests to align with current hook usage.
  • Updated tsconfig (exclude stories, module interop options) and Vite config (changed server.allowedHosts).

Comment on lines 6 to 15
// Mock window.location.replace to prevent navigation errors
const mockReplace = vi.fn();
Object.defineProperty(window, 'location', {
value: {
replace: mockReplace,
search: '',
},
writable: true,
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Overwriting window.location with a plain object can leak into other tests and break code that expects a full Location object (e.g., origin, href). It’s also not restored after tests, risking cross-test pollution. Prefer mocking the getter for window.location to override just replace and restore it in afterEach.

Suggestion

Use a getter spy and restore after each test instead of redefining window.location:

const mockReplace = vi.fn();
const originalLocation = window.location;

beforeEach(() => {
  vi.spyOn(window, 'location', 'get').mockReturnValue({
    ...originalLocation,
    replace: mockReplace as any,
    search: '',
  } as any);
  mockReplace.mockClear();
});

afterEach(() => {
  vi.restoreAllMocks();
});

Then remove the Object.defineProperty(window, 'location', ...) block. Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this change.

Comment on lines 167 to 192
it('ensures user edit messages always have the newest timestamp', async () => {
const wrapper = createWrapper();
const { result } = renderHook(() => useSimpleChat('test-session'), { wrapper });

await waitFor(() => {
expect(result.current.saveCodeAsAiMessage).toBeDefined();
});

// First edit - should create new messages
await result.current.saveCodeAsAiMessage('console.log("first edit");', result.current.docs);
const afterFirstEdit = Date.now();

// Wait a bit to ensure different timestamps
await new Promise((resolve) => setTimeout(resolve, 10));

// Second edit - should create new messages with newer timestamps
const beforeSecondEdit = Date.now();
await result.current.saveCodeAsAiMessage('console.log("second edit");', result.current.docs);
const afterSecondEdit = Date.now();

// This test verifies the function doesn't throw and can be called multiple times
// The actual timestamp verification would need more complex mocking to test properly
// The real test is in the implementation behavior where timestamps are always current
expect(beforeSecondEdit).toBeGreaterThanOrEqual(afterFirstEdit);
expect(afterSecondEdit).toBeGreaterThanOrEqual(beforeSecondEdit);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Date.now + setTimeout(10) pattern introduces timing flakiness and can intermittently fail on slow CI. These tests don’t need real time—use fake timers and fixed system time to make them deterministic.

Suggestion

Adopt fake timers and fixed system time in this suite:

import { vi } from 'vitest';

beforeEach(() => {
  vi.useFakeTimers();
  vi.setSystemTime(new Date('2024-01-01T00:00:00Z'));
});

afterEach(() => {
  vi.useRealTimers();
});

Then replace await new Promise((r) => setTimeout(r, 10)); with await vi.advanceTimersByTimeAsync(10);. This removes flakiness while preserving the intent. Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this change.

vite.config.ts Outdated
server: {
host: '0.0.0.0', // Listen on all local IPs
allowedHosts: ['.ngrok-free.app'], // Specific ngrok hostname
allowedHosts: ['devserver-main--fireproof-ai-builder.netlify.app'], // Specific ngrok hostname
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing server.allowedHosts from a permissive pattern (.ngrok-free.app) to a single Netlify hostname will block dev flows that rely on ngrok or other hostnames. The inline comment also references ngrok while the value is a Netlify domain, which is misleading. Consider supporting both (and potentially more) via an environment variable.

Suggestion

Parameterize allowed hosts and keep sensible defaults for local tooling:

const defaultAllowedHosts = ['.ngrok-free.app', 'devserver-main--fireproof-ai-builder.netlify.app'];
const allowedHostsEnv = process.env.VITE_ALLOWED_HOSTS
  ? process.env.VITE_ALLOWED_HOSTS.split(',').map((s) => s.trim()).filter(Boolean)
  : undefined;

server: {
  host: '0.0.0.0',
  allowedHosts: allowedHostsEnv ?? defaultAllowedHosts,
  cors: true,
  hmr: true,
  watch: { ignored: ['**/tests/**'] },
}

Also update the comment to accurately reflect the Netlify hostname. Reply with "@CharlieHelps yes please" if you'd like me to add a commit with this change.

@charliecreates charliecreates bot removed the request for review from CharlieHelps August 21, 2025 18:34
@jchris
Copy link
Contributor

jchris commented Oct 13, 2025

rebase to main and add https://vivaldi-quasar-3156_pingpong.vibesdiy.app/ also call it Bricksalot -- @CharlieHelps

@jchris jchris marked this pull request as draft October 13, 2025 17:27
@jchris jchris requested a review from CharlieHelps October 13, 2025 17:27
@jchris
Copy link
Contributor

jchris commented Oct 13, 2025

rebase to main and add https://vivaldi-quasar-3156_pingpong.vibesdiy.app/ also call it Bricksalot -- @CharlieHelps

@charliecreates
Copy link
Contributor Author

charliecreates bot commented Oct 13, 2025

Expand this to see my work.
  • Fetched latest main and the PR branch and compared heads to outline the rebase surface area on PR #280.
  • Reviewed the PR diff to identify overlapping touchpoints in apps/web and packages/* that could complicate a clean rebase.
  • Surveyed config/branding touchpoints for the domain/rename: next.config.* (image/URL allowlists), vercel.json (redirects/headers), and apps/web/src/config/* including PRODUCT_NAME/APP_TITLE.
  • Verified https://vivaldi-quasar-3156_pingpong.vibesdiy.app/ responds over HTTPS.
  • Ran pnpm -w lint and pnpm -w typecheck; both completed without errors or blockers.
  • Acknowledged the request in this comment to add the domain and rename to “Bricksalot.”
  • Attempted rebase onto origin/main and a merge fallback; conflicts span app/routes/vibe.tsx, netlify/edge-functions/vibe-meta.ts, vibes.diy/pkg/cf-worker/utils/meta-utils.ts, tests/vibe-route.test.tsx, netlify.toml, package.json, pnpm-lock.yaml, tsconfig.json, and vibes.diy/pkg/app/components/*, indicating structural shifts on main.
  • Executed pnpm check (format, build, tests, lint); build completed, Vitest v3.2.4 test suites exited cleanly (code 0) with no new type/lint blockers reported.

Copy link
Contributor Author

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

  • tests/vibe-route.test.tsx replaces window.location wholesale, risking cross-test pollution and breaking APIs; mock the getter and restore instead.
  • useSimpleChat saveCode tests rely on real time (Date.now, setTimeout), causing flakiness; switch to fake timers and advance explicitly.
  • Vite server.allowedHosts narrowed to a single Netlify host, likely breaking ngrok and other dev flows; parameterize and keep broader defaults. The inline comment is also misleading.
  • Other test refactors look aligned with recent architectural changes (eager Fireproof init, removed credits), with no apparent issues.
Additional notes (2)
  • Maintainability | tests/useSession.test.ts:1-5
    vi.mock('use-fireproof', ...) is declared after importing both useSession and useFireproof. While Vitest hoists vi.mock, relying on that transform is brittle—importing modules that internally import use-fireproof before the mock can lead to the real module being used in some bundler setups. Make the mock definition unambiguously run before those imports.

  • Maintainability | tests/useSimpleChat/setup.tsx:11-12
    callCount in the call-ai mock accumulates across tests and isn’t reset, creating inter‑test coupling. If any test order changes or additional tests are added, expectations may inadvertently depend on prior calls.

Summary of changes
  • Updated tests to align with eager Fireproof initialization (useSession) and removed obsolete API key/credit provisioning mocks.
  • Added a new test suite for useSimpleChat.saveCodeAsAiMessage and enhanced useViewState tests to detect the settings view from URL path.
  • Adjusted test wrappers to avoid unnecessary AuthProvider use; standardized env mocks (including CALLAI_ENDPOINT) for hermetic tests.
  • Modified vite.config.ts to change server.allowedHosts to a specific Netlify domain; updated tsconfig.json to exclude Storybook files and tweak compiler options.
  • Simplified various test setups and removed a deprecated post-login effect test.

See files: tests/useSession.test.ts, tests/useSimpleChat/saveCode.test.tsx, tests/useSimpleChat-codeReady.test.ts, tests/vibe-route.test.tsx, vite.config.ts, tsconfig.json.

@charliecreates charliecreates bot removed the request for review from CharlieHelps October 13, 2025 17:31
…d 'Create Emotional Playlists' (occupational-basilisk-4371) to featured list\n\n- Rebased branch to latest main by resetting to origin/main and reapplying minimal change\n- Per request in PR #280 (2025-10-13): add https://vivaldi-quasar-3156_pingpong.vibesdiy.app/ and call it Bricksalot
@charliecreates charliecreates bot force-pushed the ai-274-add-to-featured-vibes branch from a9eca6e to e8052bf Compare October 13, 2025 18:06
@charliecreates
Copy link
Contributor Author

Rebased this branch to the latest main and added the requested vibe.

  • Added “Bricksalot” → slug: vivaldi-quasar-3156_pingpong
  • Also added “Create Emotional Playlists” → slug: occupational-basilisk-4371

Commit: e8052bf

Changes
  • Updated vibes.diy/pkg/app/components/FeaturedVibes.tsx
    • Inserted at the top of publishedVibes:
      • { name: "Bricksalot", slug: "vivaldi-quasar-3156_pingpong" }
      • { name: "Create Emotional Playlists", slug: "occupational-basilisk-4371" }
    • Left the rest of the list as‑is
Verification
# Local CI bundle
$ pnpm check

# Results (summarized)
- Build: OK
- Tests: 136 files, 657 passed, 86 skipped, 0 failed
- Lint: OK
- Format: applied

# URL checks
$ curl -sSIL https://vivaldi-quasar-3156_pingpong.vibesdiy.app/ | head -n1
HTTP/2 200
$ curl -sSIL https://vivaldi-quasar-3156_pingpong.vibesdiy.app/screenshot.png | head -n1
HTTP/2 200

$ curl -sSIL https://occupational-basilisk-4371.vibesdiy.app/ | head -n1
HTTP/2 200
$ curl -sSIL https://occupational-basilisk-4371.vibesdiy.app/screenshot.png | head -n1
HTTP/2 200

Notes:

  • To satisfy “rebase to main,” I reset the branch to origin/main and reapplied only the Featured Vibes change so the PR now contains a minimal, up‑to‑date diff.
  • Self‑review found no issues in the touched file; other suggestions were unrelated to this change and were left as‑is to keep the scope tight.

@jchris this should match your request: rebased to main, added the new URL, and labeled it “Bricksalot.”

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.

add to featured vibes

3 participants