DEV BOX

Build small. Understand deeply.

Time zones, data and recovery. Practical foundations for the apps we build.

THE LIBRARY

Explore the notes32

Showing 12 of 32 posts
DEV BOXAI agents / Contest retrospective

What should you prepare first for an AI agent contest with a deadline? Notes from the AI TOP 100 preliminary round

On 31 October I took part in the preliminary round of Kakao's AI TOP 100, where an AI agent is built and submitted within five hours, and I submitted just before the deadline. Leaving the problem itself out, this note covers how I split the work with two AI tools, what went well, the material that came after the last deploy, running short of credit, what testing in the real channel showed, and nine things I will change next time.

AI agentsAI TOP 100Claude Code
7 min read · KO / EN
DEV BOXWeb / URL

I searched for C++. Why did the server receive 'C '?

A search for C++ reached the server as C followed by two spaces. In a query string, + means a space only to functions that read the form format; to percent-encoding functions such as encodeURIComponent and decodeURIComponent it is just a +. Using real runs on Node.js v24.21.0 and Python 3.9.6, this note shows how to pair the function that writes a query with the one that reads it so that + signs and spaces come back intact.

URL encodingURLSearchParamsencodeURIComponent
9 min read · KO / EN
DEV BOXNode.js / TypeScript

When you run a .ts file directly with node, who checks the types?

Node.js 24 runs a TypeScript file directly with node app.ts, but it only blanks out the types and never checks them. Real runs on Node.js v24.21.0 show code with the wrong types printing 1000100 and exiting with 0, an enum and an interface imported without type failing with a SyntaxError, and a tsconfig.json paths alias being ignored. The note then sets out how to hand type checking to tsc as a separate step.

TypeScriptNode.jstype stripping
10 min read · KO / EN
DEV BOXJavaScript / RegExp

Same string, yet regex test() says true one time and false the next. Where should you look?

A regex object with the g flag remembers in lastIndex where its last search ended. Real runs on Node.js v24.21.0 show test() alternating between true and false on the same string and filter() dropping rows, then set out how each method treats lastIndex and how to fix it depending on what you want.

JavaScriptRegExplastIndex
7 min read · KO / EN
DEV BOXWeb / HTTP caching

I sent Cache-Control: no-cache. Why does the browser still store the response?

no-cache does not prevent storing; it prevents reuse without checking with the server. The same steps, run on Chromium 152, show how no-cache, no-store and max-age differ in a server log and in cache-only reads. The note also covers which to choose and fetch's cache option.

HTTPCache-Controlno-cache
9 min read · KO / EN
DEV BOXSQLite

I declared a FOREIGN KEY in SQLite. Why can an order for a missing customer still get in?

SQLite's foreign key check is off by default and must be turned on for each connection. Real runs on sqlite3 3.54.0, Python 3.12.14 and Node.js v24.21.0 compare when an order for a missing customer goes in and when it is refused, then cover the transactions and typos that silently leave the check off, and PRAGMA foreign_key_check for finding rows already in the file.

SQLiteFOREIGN KEYPRAGMA foreign_keys
8 min read · KO / EN
DEV BOXWeb / Cookies

Do cookies stay separate when two apps run on different localhost ports?

If two apps that use the same cookie name run on localhost:4371 and localhost:4372, logging in to one overwrites the other's cookie and logging out of one ends both. Cookies are stored per host name and ignore the port. Using server logs from two Node.js servers opened in a Chromium 152-based browser, this note shows the behaviour, why SameSite=Strict and __Host- do not split ports either, and how to choose between separate cookie names and separate host names.

CookieslocalhostSet-Cookie
9 min read · KO / EN
DEV BOXWeb / Next.js

I changed the environment variable and restarted. Why does my Next.js page still show the old URL?

You change NEXT_PUBLIC_API_BASE and restart next start, yet the page still calls the old API URL. Building with value A and starting with value B on Next.js 16.4.3 shows that NEXT_PUBLIC_ variables and prerendered pages keep the build value, and only a server variable without NEXT_PUBLIC_ reads the value at request time. With real runs, this note shows how to tell which values are frozen at build and three ways to fix it.

Next.jsenvironment variablesNEXT_PUBLIC_
10 min read · KO / EN
DEV BOXGit / CLI

If you change only the case of a file name, which name does git remember?

Rename button.js to Button.js on a Mac, and git status stays quiet with nothing to commit. On case-insensitive APFS, core.ignoreCase makes git keep using the old name written in the index. Using real runs on git 2.54.0, this note shows how to see which name is left and how to get the rename into a commit with git mv. With core.ignorecase set to false, git mv stops, and adding after a plain mv leaves two names in the commit.

gitgit mvcore.ignoreCase
11 min read · KO / EN
DEV BOXWeb / JavaScript

I edited the copy, so why did the original object change too?

Changing the address on a copy made with { ...user } changed the original's address as well. Spread and Object.assign create only a new outer object and share the nested objects and arrays with the original. With real runs on Node.js v24.21.0, this note shows how to copy only the path you change, and what structuredClone and a JSON round trip each keep and lose.

JavaScriptspread syntaxshallow copy
8 min read · KO / EN
DEV BOXShell / Bash

I added set -e, so why does my script keep running after a command fails?

set -e does not stop on every failure. Execution continues after a failing command early in a pipeline, a command used as a test in if, && or ||, any function called from there, and a line like local v=$(…) that combines a declaration with a command substitution. Using real runs on macOS's Bash 3.2.57 and the GNU Bash manual, this note finds the cause of each and fixes them with pipefail, || return and a split declaration.

Bashset -epipefail
7 min read · KO / EN
DEV BOXPython

Why does Python's round(2.5) give 2 instead of 3?

Python's round() sends exact halfway values to the even side, so round(2.5) is 2. round(2.675, 2) giving 2.67 has a different cause: the binary float that is actually stored. Using Python 3.12.14 output, this note separates the two causes, shows how to round money with a Decimal built from a string and ROUND_HALF_UP, and compares JavaScript's Math.round().

Pythonround()banker's rounding
8 min read · KO / EN
12 / 32 posts
ALL NOTES

Every note31

Every title in this box, by year.

202629 notes

  1. What should you prepare first for an AI agent contest with a deadline? Notes from the AI TOP 100 preliminary roundAI agents / Contest retrospective
  2. I searched for C++. Why did the server receive 'C '?Web / URL
  3. When you run a .ts file directly with node, who checks the types?Node.js / TypeScript
  4. Same string, yet regex test() says true one time and false the next. Where should you look?JavaScript / RegExp
  5. I sent Cache-Control: no-cache. Why does the browser still store the response?Web / HTTP caching
  6. I declared a FOREIGN KEY in SQLite. Why can an order for a missing customer still get in?SQLite
  7. Do cookies stay separate when two apps run on different localhost ports?Web / Cookies
  8. I changed the environment variable and restarted. Why does my Next.js page still show the old URL?Web / Next.js
  9. If you change only the case of a file name, which name does git remember?Git / CLI
  10. I edited the copy, so why did the original object change too?Web / JavaScript
  11. I added set -e, so why does my script keep running after a command fails?Shell / Bash
  12. Why does Python's round(2.5) give 2 instead of 3?Python
  13. Promise.all rejected, so why do the other requests keep running?Web / JavaScript
  14. Why did the last digit of an order ID from my API change?Web / JavaScript
  15. Why won't ^0.2.3 in package.json move up to 0.3.0?Tools / npm
  16. Why does my Python function remember the last call's value?Python
  17. Why doesn't await inside forEach pause the loop?JavaScript
  18. Why does sort() put 10 before 9 in a number array?JavaScript
  19. I added it to .gitignore, so why does Git keep committing it?Git
  20. Why did a field vanish from the JSON I sent?JavaScript
  21. Why fetch doesn't reach catch on a 404Web
  22. Using Meta Muse from Korea, and running Claude Code on its computerAI Agents
  23. SQLite backups: once the file exists, try restoring itSQLite
  24. When an app's date slips by a day: separate storage time from display timeJavaScript
  25. Why a CORS error can mean the server never saw the POSTWeb
  26. Why the request after a POST redirect is sometimes a GETWeb
  27. Why Does My AI Keep Going in Circles? Harnesses, Loops, and Graphs ExplainedAI Agents
  28. Error Messages in Personal Apps: Tell Users What to Do NextApps
  29. When Vibe Coding Stalls, the Problem Is the Map, Not the ModelAI