Skip to content

Code review: escape typed input, keep widget focus, bound verify runs - #12

Merged
devmtnaing merged 1 commit into
mainfrom
code-review-fixes
Sep 28, 2026
Merged

devmtnaing merged 1 commit into
mainfrom
code-review-fixes

Conversation

@devmtnaing

Copy link
Copy Markdown
Owner

Fixes from the whole-codebase review. Nothing else is open, so this is against main with no stack.

Bugs

  • Escaping (longest-substring): the field accepts <, > and &, and the narration and widget spliced them in raw. A link with ?s=a<i>b put a real <i> into step 6, which read The run is "a", length 4. It now reads The run is "a<i>", length 4. The stage and hover tip already escaped, so they are unchanged.
  • Widget focus: 44 of 46 part 1 widgets dropped focus to <body> when a preset chip was chosen with the keyboard, and 6 did the same for cells. One listener in stepper.js (keepFocus) puts focus back on the redrawn element with the same data-* attributes. Widgets that already refocus are left alone.
  • Home page: replaceState in the search box is wrapped in try, because Safari throws when it is called too often (the same guard stepper.js already has).

Tooling

  • run.py: each approach × language has a 20-minute timeout, and a timed-out Docker container is removed by name.
  • rust:1-slim is pinned to rust:1.98-slim, the version the badges quote (rustc 1.98). This touches a comment in every lesson.
  • audit.mjs: the untouched-page query check now waits out the 150ms address debounce, and the space-test cleanup only clicks Play if playback is actually running.

Duplicate code: esc() now lives in kit.js, and valid-palindrome drops its own copy. The lesson-kit reference covers esc() and the stable data-* key widgets need.

Checked

  • npm run check: 46 lessons, 0 failures.
  • npm run audit: passed, 46 pages.
  • run.py --strict on longest-substring, valid-palindrome and merge-intervals: all passed.
  • The timeout path was forced with a tiny limit: it reported FAIL and left no containers.
  • A browser probe found no chip or cell focus lost in any widget.

- longest-substring: narration and widget lines escape the string the
  reader typed; a shared ?s=a<i>b link injected markup and garbled step 6
- esc() moves to kit.js, the one escaper lessons import; valid-palindrome
  drops its own copy
- the stepper puts focus back on a redrawn widget chip or cell, which 44
  widgets dropped to <body> on a keyboard pick
- home page: a rate-limited replaceState in Safari no longer throws
- run.py: each approach x language times out after 20 minutes and removes
  its container; rust:1-slim pinned to rust:1.98-slim, the version the
  badges quote
- audit: wait out the 150ms address debounce before checking for a query,
  and stop playback only if the space test started it
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: bc198bf4-d768-416c-b31f-4b2a0b5026a7


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.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ 026afe1 2026-09-28T08:57:50.455Z Visit the dashboard ↗

@devmtnaing
devmtnaing merged commit b358a67 into main Sep 28, 2026
52 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