Skip to content

Staging#114

Merged
Shashank0701-byte merged 2 commits intomainfrom
staging
Apr 6, 2026
Merged

Staging#114
Shashank0701-byte merged 2 commits intomainfrom
staging

Conversation

@Shashank0701-byte
Copy link
Copy Markdown
Owner

@Shashank0701-byte Shashank0701-byte commented Apr 6, 2026

Summary by CodeRabbit

  • New Features
    • Added 17 new component types to the design canvas, including compute resources (Workers, Containers, Gateways), networking components (DNS, Firewalls, Proxies), storage options (NoSQL, Search indices, Graph databases), messaging services (PubSub, WebSocket), observability tools (Loggers, Metrics, Tracers), and security systems (Authentication, WAF, Vaults).
    • Enhanced practice question generation with greater variety and randomization.

…l massively

- Now the ai has more elaborate pool of questions to figure out from
feat(ui/ai): Added more Tool components and expanded the Question Pool massively  - Now the ai has more elaborate pool of questions to figure out from
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
system-craft Ready Ready Preview, Comment Apr 6, 2026 7:53pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

📝 Walkthrough

Walkthrough

This pull request introduces 17 new component types (Worker, Container, Gateway, DNS, Firewall, Proxy, NoSQL, Search, GraphDB, PubSub, WebSocket, Logger, Metrics, Tracer, Auth, WAF, Vault) across the canvas and simulation infrastructure. Updates include expanded component palette sections, color mappings for the design canvas, capacity entries for simulation nodes, enhanced question generation with randomized topic selection and additional fallback questions, hydration warning suppressions, and TypeScript compilation notes.

Changes

Cohort / File(s) Summary
Canvas Components
components/canvas/ComponentPalette.tsx, components/canvas/DesignCanvas.tsx
Expanded component palette with 10 new items across existing sections (Compute, Networking, Storage, Messaging) and 2 new sections (Observability, Security). Added corresponding color mappings and default labels in DesignCanvas for all 17 new node types.
Simulation Configuration
src/lib/simulation/constants.ts
Extended NODE_CAPACITIES constant with capacity entries for all 17 new component types.
Question Generation
src/lib/ai/questionGenerator.ts
Expanded example topic lists by difficulty level, introduced pickRandom() helper for randomized topic selection, updated prompt generation to use random topics and seed, and increased fallback question pools with multiple new curated questions per difficulty tier.
Layout Hydration
app/layout.tsx
Added suppressHydrationWarning attribute to <html> and <body> elements in RootLayout.
Authentication Context
src/lib/firebase/AuthContext.tsx
Added clarifying inline comments to AuthProvider's useEffect regarding loading state updates and subscription callback handling.
Project Metadata
git_status.txt, tsc_output.txt
Updated git status tracking and added TypeScript compilation error output file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

  • Staging #8: Introduces foundational canvas palette and design canvas component infrastructure that these changes directly extend with new item/type additions.
  • Staging #43: Modifies src/lib/ai/questionGenerator.ts for prompt and configuration logic changes, overlapping with this PR's question generation updates.
  • Staging #50: Updates components/canvas/DesignCanvas.tsx for node-type handling and styling, sharing direct code-level modifications with this PR's canvas enhancements.

Poem

🐰 Seventeen new types hop into view,
Components dance in palettes fresh and new.
Questions randomize with seeds so fine,
Canvas colors paint the grand design.
Hydration warnings softly fade away—
A rounder system greets the day! 🎨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.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 'Staging' is overly vague and does not meaningfully describe the actual changes in the pull request, which include significant additions to the component palette, canvas styling, question generation logic, and various system component types. Replace 'Staging' with a descriptive title that captures the main changes, such as 'Add new system component types and expand canvas support' or 'Extend component palette with Compute, Networking, Storage, Messaging, Observability, and Security components'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 staging

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.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 6, 2026

Deploy Preview for system-craft-staging ready!

Name Link
🔨 Latest commit 5527ea3
🔍 Latest deploy log https://app.netlify.com/projects/system-craft-staging/deploys/69d40f26e306a8000847b321
😎 Deploy Preview https://deploy-preview-114--system-craft-staging.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
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
src/lib/ai/questionGenerator.ts (1)

78-81: Use an unbiased shuffle for topic sampling.

sort(() => Math.random() - 0.5) is biased and can skew topic distribution. Prefer Fisher–Yates for reliable random subsets.

♻️ Proposed refactor
 function pickRandom<T>(arr: T[], count: number): T[] {
-    const shuffled = [...arr].sort(() => Math.random() - 0.5);
-    return shuffled.slice(0, count);
+    const shuffled = [...arr];
+    for (let i = shuffled.length - 1; i > 0; i -= 1) {
+        const j = Math.floor(Math.random() * (i + 1));
+        [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
+    }
+    return shuffled.slice(0, Math.max(0, count));
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/ai/questionGenerator.ts` around lines 78 - 81, The pickRandom
function uses a biased shuffle via sort(() => Math.random() - 0.5); replace it
with an unbiased Fisher–Yates shuffle: copy the input array (e.g., const result
= [...arr]), perform an in-place Fisher–Yates shuffle on result (swap elements
using Math.random() across indices), then return result.slice(0, Math.min(count,
result.length)); update the pickRandom<T> implementation to use this approach
and ensure it safely handles count > arr.length.
components/canvas/DesignCanvas.tsx (1)

10-38: Consider a single typed source for node metadata.

Lines 10-38 and 41-69 duplicate type keys (color + label), while the same keys are also maintained in components/canvas/ComponentPalette.tsx and src/lib/simulation/constants.ts. A shared NodeType + metadata registry would reduce drift/typo risk as new components are added.

Also applies to: 41-69

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@components/canvas/DesignCanvas.tsx` around lines 10 - 38, Duplicate node
metadata across COLOR_MAP in DesignCanvas.tsx, the palette in
ComponentPalette.tsx, and constants in src/lib/simulation/constants.ts should be
consolidated into a single typed source to avoid drift; create a shared export
(e.g., a NodeType union or enum plus a NodeMetadata registry object) in one
module (for example export NodeType and NODE_METADATA from
src/lib/simulation/constants.ts), update DesignCanvas to import NODE_METADATA
instead of COLOR_MAP, update ComponentPalette to use the same NODE_METADATA and
types, and update any code using the old keys to reference NodeType and
NODE_METADATA so all color/label/metadata lives in one place and is type-checked
across the codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@git_status.txt`:
- Around line 1-4: The PR includes a transient local file git_status.txt which
should not be versioned; remove git_status.txt from the commit and from the repo
history by deleting the file from the working tree/commit and ensuring it is
ignored going forward (add the pattern git_status.txt to .gitignore or to your
local exclude file), then amend or create a new commit without the file (or drop
it with git rm --cached if you need to keep a local copy) and force-push or
rebase as appropriate so the PR no longer contains the artifact.

In `@src/lib/ai/questionGenerator.ts`:
- Around line 222-223: Fix the user-facing grammar in the fallback requirement
strings by replacing the incorrect phrase 'Engineers can create, toggles, and
archive feature flags via a dashboard' with 'Engineers can create, toggle, and
archive feature flags via a dashboard' (and apply the same correction to the
duplicate string at the other occurrence identified by the same text); locate
the exact string occurrences in questionGenerator.ts and update them so
generated fallback questions use the corrected wording.

In `@src/lib/firebase/AuthContext.tsx`:
- Line 25: Remove the unnecessary eslint-disable comment inside the AuthContext
component's useEffect: delete the line containing "// eslint-disable-next-line
react-hooks/set-state-in-effect -- intentional: single synchronous set at mount,
not a cascading render" so the file src/lib/firebase/AuthContext.tsx no longer
contains a non-existent rule override; keep the surrounding useEffect and state
update logic unchanged.

In `@src/lib/simulation/constants.ts`:
- Line 10: The DNS constant (and other node capacity constants set to Infinity)
will render as confusing values; replace Infinity in
src/lib/simulation/constants.ts (e.g., DNS and the constants at lines 23-25)
with a large but finite ceiling (for example 1_000_000_000) or a named constant
like MAX_RENDERABLE_CAPACITY, and/or update the DesignCanvas component's
capacity formatting logic (the capacity formatting code in DesignCanvas) to
explicitly detect non-finite values and render a friendly label (e.g.,
"Unlimited" or "∞") instead of numeric formatting; pick one approach and apply
it consistently to the constants (DNS and the other Infinity entries) and the
DesignCanvas capacity formatter.

---

Nitpick comments:
In `@components/canvas/DesignCanvas.tsx`:
- Around line 10-38: Duplicate node metadata across COLOR_MAP in
DesignCanvas.tsx, the palette in ComponentPalette.tsx, and constants in
src/lib/simulation/constants.ts should be consolidated into a single typed
source to avoid drift; create a shared export (e.g., a NodeType union or enum
plus a NodeMetadata registry object) in one module (for example export NodeType
and NODE_METADATA from src/lib/simulation/constants.ts), update DesignCanvas to
import NODE_METADATA instead of COLOR_MAP, update ComponentPalette to use the
same NODE_METADATA and types, and update any code using the old keys to
reference NodeType and NODE_METADATA so all color/label/metadata lives in one
place and is type-checked across the codebase.

In `@src/lib/ai/questionGenerator.ts`:
- Around line 78-81: The pickRandom function uses a biased shuffle via sort(()
=> Math.random() - 0.5); replace it with an unbiased Fisher–Yates shuffle: copy
the input array (e.g., const result = [...arr]), perform an in-place
Fisher–Yates shuffle on result (swap elements using Math.random() across
indices), then return result.slice(0, Math.min(count, result.length)); update
the pickRandom<T> implementation to use this approach and ensure it safely
handles count > arr.length.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: b30315a5-f055-48f9-ae67-736d486638b5

📥 Commits

Reviewing files that changed from the base of the PR and between 230a785 and 5527ea3.

📒 Files selected for processing (9)
  • app/layout.tsx
  • components/canvas/ComponentPalette.tsx
  • components/canvas/DesignCanvas.tsx
  • git_status.txt
  • src/lib/ai/questionGenerator.ts
  • src/lib/firebase/AuthContext.tsx
  • src/lib/simulation/constants.ts
  • tsc_output.txt
  • tsc_output_2.txt

Comment on lines +1 to +4
M app/practice/[id]/page.tsx
M src/lib/practice/storage.ts
?? git_status.txt
?? tsc_output.txt
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove local Git status artifacts from the PR.

git_status.txt is transient local-state output and should not be versioned; it becomes stale immediately and adds review noise. Please drop it from the commit (and ignore this pattern if needed).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@git_status.txt` around lines 1 - 4, The PR includes a transient local file
git_status.txt which should not be versioned; remove git_status.txt from the
commit and from the repo history by deleting the file from the working
tree/commit and ensuring it is ignored going forward (add the pattern
git_status.txt to .gitignore or to your local exclude file), then amend or
create a new commit without the file (or drop it with git rm --cached if you
need to keep a local copy) and force-push or rebase as appropriate so the PR no
longer contains the artifact.

Comment on lines +222 to +223
'Engineers can create, toggles, and archive feature flags via a dashboard',
'Flags support percentage rollouts, user segment targeting, and kill switches',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix user-facing grammar in fallback requirements.

Line 222 and Line 261 have copy issues that will surface directly in generated fallback questions.

✏️ Suggested copy fixes
-                'Engineers can create, toggles, and archive feature flags via a dashboard',
+                'Engineers can create, toggle, and archive feature flags via a dashboard',
...
-                'Scores update reflect within 1 second',
+                'Score updates are reflected within 1 second',

Also applies to: 261-261

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/ai/questionGenerator.ts` around lines 222 - 223, Fix the user-facing
grammar in the fallback requirement strings by replacing the incorrect phrase
'Engineers can create, toggles, and archive feature flags via a dashboard' with
'Engineers can create, toggle, and archive feature flags via a dashboard' (and
apply the same correction to the duplicate string at the other occurrence
identified by the same text); locate the exact string occurrences in
questionGenerator.ts and update them so generated fallback questions use the
corrected wording.

if (!auth) {
// eslint-disable-next-line react-hooks/set-state-in-effect
// No Firebase configured — mark loading as done immediately.
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional: single synchronous set at mount, not a cascading render
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if 'react-hooks/set-state-in-effect' is defined in the project's eslint configuration

# Search for eslint configuration files
fd -e js -e json -e yaml -e yml -e cjs -e mjs '(\.eslintrc|eslint\.config)' --exec cat {}

# Search for the specific rule name in the codebase
rg -n 'set-state-in-effect' -g '!*.tsx' -g '!*.ts' -g '!*.jsx' -g '!*.js' --type-add 'config:*.{json,yml,yaml,cjs,mjs}' -t config

Repository: Shashank0701-byte/System-Craft

Length of output: 538


Remove the unnecessary eslint-disable comment.

The rule react-hooks/set-state-in-effect is not defined in your eslint configuration and is not a standard rule from eslint-plugin-react-hooks (the standard rules are rules-of-hooks and exhaustive-deps). Setting state synchronously in a useEffect is valid React, so this disable comment is unnecessary and adds noise. Remove the entire comment on line 25.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/firebase/AuthContext.tsx` at line 25, Remove the unnecessary
eslint-disable comment inside the AuthContext component's useEffect: delete the
line containing "// eslint-disable-next-line react-hooks/set-state-in-effect --
intentional: single synchronous set at mount, not a cascading render" so the
file src/lib/firebase/AuthContext.tsx no longer contains a non-existent rule
override; keep the surrounding useEffect and state update logic unchanged.

Gateway: 50000, // API Gateway handles 50k RPS
LB: 100000, // Load Balancer handles 100k RPS
CDN: 500000, // CDN handles 500k RPS (edge cached)
DNS: Infinity, // DNS resolution is effectively unlimited
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid rendering-facing Infinity capacities for regular node types.

Line 10 and Lines 23-25 introduce Infinity capacities for nodes that are rendered in metrics chips, and components/canvas/DesignCanvas.tsx Line 948 formats capacity numerically. This will show confusing values like Infinityk RPS. Consider finite high ceilings here, or add explicit non-finite formatting in the renderer.

Also applies to: 23-25

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/simulation/constants.ts` at line 10, The DNS constant (and other node
capacity constants set to Infinity) will render as confusing values; replace
Infinity in src/lib/simulation/constants.ts (e.g., DNS and the constants at
lines 23-25) with a large but finite ceiling (for example 1_000_000_000) or a
named constant like MAX_RENDERABLE_CAPACITY, and/or update the DesignCanvas
component's capacity formatting logic (the capacity formatting code in
DesignCanvas) to explicitly detect non-finite values and render a friendly label
(e.g., "Unlimited" or "∞") instead of numeric formatting; pick one approach and
apply it consistently to the constants (DNS and the other Infinity entries) and
the DesignCanvas capacity formatter.

@Shashank0701-byte Shashank0701-byte merged commit 148ab8e into main Apr 6, 2026
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