Skip to content

🧹 [code health improvement] Implement data fetching for cryptogram#30

Open
lemononmars wants to merge 1 commit into
mainfrom
code-health-cryptogram-fetch-4104112311433260691
Open

🧹 [code health improvement] Implement data fetching for cryptogram#30
lemononmars wants to merge 1 commit into
mainfrom
code-health-cryptogram-fetch-4104112311433260691

Conversation

@lemononmars

Copy link
Copy Markdown
Owner

🎯 What: The code health issue addressed
Implemented true asynchronous data fetching logic for the Cryptogram puzzle route src/routes/puzzles/cryptogram/[id].ts to resolve an existing TODO: make it fetch, await, etc? placeholder.

💡 Why: How this improves maintainability
The prior code solely relied on hardcoded local arrays, preventing the puzzle content from scaling or updating dynamically via the CMS database (Supabase). By correctly fetching from Supabase with a fallback to the static data array, the component is robust, ready for dynamically published content, yet safe from regressions.

Verification: How you confirmed the change is safe
Ran Svelte checks, rebuilt the server output using npm run build, and ran unit tests via npm run test, ensuring existing utility tests and code structures remain unimpacted. Pre-existing static fallback behavior was thoroughly preserved.

Result: The improvement achieved
A cleaner, more scalable routing endpoint capable of seamlessly querying live puzzle database records without breaking backward compatibility for older, statically defined puzzles.


PR created automatically by Jules for task 4104112311433260691 started by @lemononmars

…gram

Replaced the static data lookup placeholder in `src/routes/puzzles/cryptogram/[id].ts` with a proper Supabase query. Preserved the array-based logic as a robust fallback.
- Added `import { from }` and executed an asynchronous Supabase `from('cryptogram').select('*')` query to retrieve data.
- Handled errors and formatting mappings so it adheres to the expected `content` structure (`type` and `date`).
- Maintained backward compatibility via static data fallback if the DB fetch fails or returns no matches.
- Extracted and safely retained the previous modulo `id` bounds-wrapping logic required by existing components.

Co-authored-by: lemononmars <26631189+lemononmars@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
codebreaker Ready Ready Preview, Comment Jun 28, 2026 4:25pm

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