Skip to content

feat(examples): add Signal demo app#6

Merged
sathergate merged 16 commits into
mainfrom
feature/signal-demo
Mar 30, 2026
Merged

feat(examples): add Signal demo app#6
sathergate merged 16 commits into
mainfrom
feature/signal-demo

Conversation

@sathergate
Copy link
Copy Markdown
Owner

Summary

  • Adds examples/signal/ — a full-stack Next.js developer discovery feed that demonstrates five sathergate-toolkit packages as invisible infrastructure
  • Uses searchcraft (fuzzy search), ratelimit-next (60 req/min search / 5 req/hr submit), flagpost (50% new_feed_layout A/B rollout), croncall (hourly trending score job), and vaultbox (env fallback pattern)
  • 20 seed items across tools, links, and opportunities with HN-style trending scores (votes / (ageHours + 2)^1.5)

Test Plan

  • cd examples/signal && npm install && npm run dev — server starts on :3000
  • Search "cron" — returns 2 results via searchcraft
  • Submit 6 times in an hour — 6th returns 429 with Retry-After countdown
  • Open in two different browsers — new_feed_layout flag varies by session userId
  • GET /api/cron without Authorization header — returns 401
  • GET /api/cron with Authorization: Bearer test-secret (.env.local) — returns { job: "trending", scores: [...] }
  • Footer shows: 🚩 new_feed_layout (50% rollout) · 🛡 Search: 60 req/min · Submit: 5 req/hr · ⏰ Trending: hourly cron

🤖 Generated with Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b283ee7070

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +22 to +26
if (typeof sessionStorage === "undefined") return "user-demo";
const stored = sessionStorage.getItem("signal-uid");
if (stored) return stored;
const uid = `user-${Math.random().toString(36).slice(2, 9)}`;
sessionStorage.setItem("signal-uid", uid);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Derive rollout user ID consistently across SSR/client

The userId is computed during render from sessionStorage, but server prerendering has no sessionStorage and falls back to "user-demo", while first client render can generate a random ID. Since the layout variant is derived from this ID, first-time visits can hydrate with a different variant than the HTML, causing layout mismatch/flash and inconsistent A/B assignment. Use an ID source available on both server and client (e.g., cookie) or defer variant selection until after mount.

Useful? React with 👍 / 👎.

Comment on lines +51 to +53
const data = await res.json();
setSearchResults(data.results ?? []);
setSearchError(null);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ignore stale search responses before setting results

Search responses are applied unconditionally after await res.json(), so an older request can finish after a newer one and overwrite the latest query's results (common when typing quickly on variable latency). This makes the visible results drift from the current input. Gate updates by request id or cancel superseded fetches with AbortController.

Useful? React with 👍 / 👎.

@sathergate sathergate merged commit 8902e60 into main Mar 30, 2026
8 of 9 checks passed
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