Skip to content

Tickets batch: Java Driver imports, nginx reload, tooling - #439

Open
Kyu-seok wants to merge 21 commits into
masterfrom
integration/tickets-2026-11-22
Open

Kyu-seok wants to merge 21 commits into
masterfrom
integration/tickets-2026-11-22

Conversation

@Kyu-seok

@Kyu-seok Kyu-seok commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Five tickets (#412 #434 #435 #436 #437) with no spec, landed on one integration branch.

State directory: ~/.cache/implement-spec/tickets-2026-11-22/ (brief: BRIEF.md, merge log: merge-log.md). Integration tip: ff59ae5d.

Merged

  • Java Drivers: a user import fails to compile below a Library #412 (ticket/412-java-driver-imports): In 72 Java Drivers the Library markers and helper classes move below {USER_CODE}, so submitted Java that opens with an import compiles; JavaDriversCompileTest compiles every Driver under a leading import (72 failures on the base, 0 now); all 201 Java references Accepted locally and 14 of 14 runs on Judge0 with and without the import; docs/DRIVER_CODE.md, docs/SUBMISSION_FLOW.md and the problem-generator agent show the new order. Owed: A decision: a runtime frame inside a Library now shows on the last user line, so that line can carry the same message twice (once per frame); deduping is a follow-up if wanted.
  • Walkthrough tracers: move the shared nested helpers into codebite.py #435 (ticket/435-tracer-nested-helpers): The twelve nested functions that Walkthrough tracers shared are eleven tested helpers in scripts/walkthroughs/codebite.py (nid binds the kit's node_id instead), imported by the 30 tracers that had copies; nested-copies.known and the code in check-tracer-helpers.py that read it are removed; all 200 tracers regenerate byte-identical.
  • Deploy: a frontend change recreates nginx and fails requests for ~2 s #434 (ticket/434-nginx-reload): A frontend deploy fills the codebite-frontend volume (assets first, index.html renamed in last; a replaced build's assets stay 7 days) and reloads a running stock nginx:1.31-alpine; deploy-prod.sh tests nginx.conf before rolling anything and logs whether nginx was kept, reloaded or recreated; infra/nginx is mounted as a directory so a pulled config reaches the container; ADR 0014. Local loop: 17 of 723 requests to / lost on the base, 0 of 569 across two frontend deploys on the branch. Owed: The deploy of this PR recreates codebite-nginx one last time (about 2 s). The next deploy that changes frontend/ should log Container codebite-nginx Running and nginx: kept running, reloaded (frontend published): post its run id on Deploy: a frontend change recreates nginx and fails requests for ~2 s #434. Exercised only on compose 2.15.1 (the server runs 5.1.0), and the failed-health-check rollback was not run whole. To know: the config test fails, stopping a deploy, when grafana is down; a failed publish stops the deploy with the backend already rolled and no automatic rollback; the old codebite-nginx:latest image stays on the server until removed.
  • merge-ticket: --refresh a branch that reported one merge late #437 (ticket/437-merge-ticket-refresh): scripts/merge-ticket.sh --refresh merges the integration tip into a ticket branch that lacks it (in its worktree, or a temporary one), stops on a conflict naming the files, runs the pre-commit hook's path-scoped checks over the paths the ticket adds (never Gradle) and then takes the existing no-checks push; .githooks/pre-commit takes its path list from CODEBITE_HOOK_PATHS when set, so the rules are reused, not restated; without --refresh nothing changes (one usage-line assertion updated).
  • dev-branch-servers: start --wait, one live set at a time #436 (ticket/436-branch-servers-wait): scripts/dev-branch-servers.sh start --wait waits while another worktree's set is live (app processes on its database, or a start still running), naming that worktree, and gives up with exit 1 after CODEBITE_BRANCH_SERVERS_WAIT seconds (default 1800) naming the set and the command that stops it; a dead set or a gone worktree holds nothing; plain start is unchanged; docs/agents/parallel-sessions.md and CLAUDE.md tell agents to start with --wait --detach. Owed: .claude/skills/restate-problem/SKILL.md and the hint in scripts/judge-run.py still say start --detach.
  • Java Drivers: a user import fails to compile below a Library #412 Deploy: a frontend change recreates nginx and fails requests for ~2 s #434 dev-branch-servers: start --wait, one live set at a time #436 merge-ticket: --refresh a branch that reported one merge late #437 (ticket/review-fixes): Code-review fixes: under merge-ticket.sh --refresh the path-scoped checks always run, so a failed one stays failed on a rerun, and every step of the refresh is checked and named; a failed frontend publish rolls the deploy back the way a failed final health check does (one roll_back), the frontend restore stops at its first failed step with PREVIOUS FRONTEND BUILD NOT RESTORED, the nginx config test fails closed when compose cannot say whether nginx runs, and every reload goes through compose exec; frontend/publish.sh computes its build id null-delimited and is under shellcheck and the script-test path rule; docs/DEPLOYMENT_PLAN.md follows ADR 0014; a fixture for a helper class above {USER_CODE}, and the ProgramTest line-number cases run on a fixture Driver; the restate-problem skill and judge-run.py say start --wait --detach.
  • dev-branch-servers: start --wait, one live set at a time #436 (ticket/detached-test-race): scripts/dev-branch-servers.test.sh: the "detached start died" case has a log file of its own; it shared one with the case before it and failed CI run 45004083219 on a race that was already on master.

#412

#412 Java Drivers: Libraries and helper classes below {USER_CODE}

In 72 Java Drivers (70 with a Library marker, 2 with a Node class of their own) everything but the Driver's import lines moved from above {USER_CODE} to just below it. Java allows no import after a class, so a submission that opened with import java.util.stream.*; failed with class, interface, or enum expected on a line the user didn't write. Nothing in the user's code is hoisted or rewritten; ProblemAssets, Program and UserCodeLineMapper are unchanged.

The count is 0. Java Drivers with a Library marker or a class declaration above {USER_CODE}:

perl -0ne 'print "$ARGV\n" if /\A(.*?)\{USER_CODE\}/s && $1 =~ /\{\{LIB:|^\s*(?:\w+\s+)*(?:class|interface|enum)\s/m' common/src/main/resources/drivers/*/java.java | wc -l

prints 0 on this branch and 72 on the base.

The check. JavaDriversCompileTest.everyJavaDriverCompilesWhenTheUsersCodeOpensWithAnImport compiles every Java Driver at --release 13 with import java.util.stream.*; typed above its Starter Code. Before the move it named 72 Drivers (add-score-lists: line 41: class, interface, or enum expected | import java.util.stream.*; and 71 more); after it, none.

What a user sees for a runtime frame inside a Library. The same as for a Main frame: the frame is below their code, so it is pinned to the last line of their code with the exception's message. Before, a Library frame was above their code and dropped, and only the Main frame was pinned there; now both are, so the last line carries the message twice. A frame in their own code still names its own line.

Run on Judge0 through the branch backend, binary-tree-level-order, a submission that opens with an import and returns a list holding null:

import java.util.stream.*;
class Solution {
    public List<List<Integer>> levelOrder(TreeNode root) {
        List<List<Integer>> levels = new ArrayList<>();
        levels.add(null);
        return levels;
    }
}
Exception in thread "main" java.lang.NullPointerException
	at JsonOutput.intList2D(Main.java:112)
	at Main.main(Main.java:160)

The result's errors: two entries, both on the last line of the user's code, both java.lang.NullPointerException, inUserCode: true.

Errors in the user's own code, same backend, add-score-lists (the user's code now starts on line 3 of the Program, right after import java.util.*;):

Submission Judge0 said Reported on user line
line 4 lacks its ; Main.java:6: error: ';' expected 4
line 5 dereferences null at Solution.addScoreLists(Main.java:7), at Main.main(Main.java:56) 5 (and 7, the last line, for the Main frame, as before)

ProgramTest pins the three cases on the real add-score-lists Driver.

Judge0 (scripts/judge-run.sh … --languages java against the branch backend, Judge0 at nucbox:2358), each reference solution as it is and again with import java.util.stream.*; as its first line: add-score-lists (ListNode), balanced-hamster-tree (TreeNode), brawler-lane-collision (JsonOutput), binary-tree-level-order (TreeNode and JsonOutput), snapshot-town-map (Node), clone-quest-log and populating-next-pointers (a Node class of the Driver's own): 14 of 14 ACCEPTED.

Local judge. scripts/judge-local.sh <slug> --languages java over all 201 problems with a Java Driver, after the move: 201 ACCEPTED, none failed or NOT JUDGED.

#434

#434: a frontend deploy no longer replaces nginx

The loop

The production compose file's nginx service (and, on the branch, its frontend service) as written, beside a stub backend and a stub grafana, under compose project ticket434 on 127.0.0.1:8434. The frontend is the real one, built by frontend/Dockerfile; each "frontend change" appends a console.info to src/main.tsx, which renames the entry chunk. A client requests / and build 1's hashed entry chunk every 100 ms and counts every answer that isn't 200 (000 is no answer: refused, reset or nothing in 2 s). Deploys 2 and 3 run under it. Loop-only edits: project and image names, the port, and a 1 GB node heap cap in the build stage (a 4 GB Docker VM shared with other sessions).

Red, on master (e749425)

Deploys by the commands scripts/deploy-prod.sh ran there: compose build, compose up -d --remove-orphans, nginx -s reload.

--- served index.html names: /assets/index-BilxLQx_.js
--- build 3's index.html names: /assets/index-BilxLQx_.js
/assets/index-FLLWtXtS.js                  723 requests, 295 failed
/                                          723 requests, 17 failed
  failed: / 000 x17
  failed: /assets/index-FLLWtXtS.js 404 x277
  failed: /assets/index-FLLWtXtS.js 000 x18
/ failed in two windows, one per deploy, each at "Container ticket434-nginx Recreate":
  1.2 s, 9 requests to / unanswered
  1.1 s, 8 requests to / unanswered

Every answered request for build 1's chunk after the first swap was a 404: the old build left with the old container.

Green, on the branch

Deploys by the functions main() calls for the front, in its order: compose --profile publish build, check_nginx_conf, update_front. One request loop ran through all of: deploy 2, deploy 3, a broken nginx.conf, a rollback to build 2 (restore_front), and a deploy that changes nothing.

--- build 1 is up; its hashed asset: /assets/index-FLLWtXtS.js ---
=== deploy 2 (frontend changed) ===
Frontend published (build 635382312-6224)
--- nginx: kept running, reloaded (frontend published) ---
=== deploy 3 (frontend changed) ===
Frontend published (build 3638116739-6225)
--- nginx: kept running, reloaded (frontend published) ---
--- served index.html names:    /assets/index-BilxLQx_.js
--- build 3's index.html names: /assets/index-BilxLQx_.js
--- build 1's asset /assets/index-FLLWtXtS.js: 200
--- build 2's asset /assets/index-Ci1UVHUr.js: 200
=== broken nginx.conf ===
nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/conf.d/nginx.conf:116
--- check_nginx_conf failed, as main() needs to stop the deploy ---
=== rollback to build 2 (restore_front after the checkout) ===
Frontend published (build 635382312-6224)
--- served index.html names: /assets/index-Ci1UVHUr.js (build 2's: /assets/index-Ci1UVHUr.js)
=== deploy with nothing changed ===
Frontend unchanged (build 635382312-6224)
--- nginx: kept running, no reload (nothing it serves or proxies changed) ---
/assets/index-FLLWtXtS.js                  569 requests, 0 failed
/                                          569 requests, 0 failed
  • Zero failed requests, and after deploy 3 the served index.html is build 3's.
  • Build 1's chunk answered 200 for the whole loop (569 of 569), through both swaps and the rollback; build 2's answered 200 after deploy 3.
  • The broken config failed nginx -t in the throwaway container; nothing was reloaded and the loop kept getting 200. In main() that failure checks out the previous commit and exits 1 before the backend roll (scripts/deploy-prod.test.sh runs that path against a stub docker).

A changed nginx.conf (a new response header, the file replaced by rename as git pull does), under a second run of the loop on the same stack. It is a separate run because the first run's edit of the config was a no-op, a bug in the harness's perl; that step is left out of the log above:

--- header before: none
--- nginx: kept running, reloaded (nginx.conf changed) ---
--- header after: X-Loop-434: yes
/assets/index-Ci1UVHUr.js                   57 requests, 0 failed
/                                           57 requests, 0 failed

A change to the nginx service itself, after the loop (this is the one case that still drops requests):

Container ticket434-nginx  Recreate
Container ticket434-nginx  Recreated
Container ticket434-nginx  Started
--- nginx: recreated (its image or service definition changed) ---
--- still serving: 200

What the loop found on the way

  • nginx -t in a throwaway container needs the compose network's grafana to resolve, so on a first bring-up with nothing running it failed. check_nginx_conf now skips when no nginx is running: there is nothing serving to protect.
  • The old mount was the single file nginx.conf. git replaces that file on a pull, so the running container kept the old one and the deploy's reload re-read the old config; a config change only took effect when the container was next recreated. The mount is now the directory.

The first deploy of this PR

It replaces codebite-nginx once more (its image and mounts change), so expect one last ~2 s gap; the volume is filled before that and no step by hand is needed. It pulls nginx:1.31-alpine and alpine:3.22. The old codebite-nginx:latest image stays on the server until someone runs docker image rm codebite-nginx.

Owed after merge

The first deploy after this one that changes frontend/ should log

 Container codebite-nginx Running
--- nginx: kept running, reloaded (frontend published) ---

and no Container codebite-nginx Recreate. Its run id goes on the issue.

Outside the ticket's key interfaces

  • frontend/publish.sh (new) and scripts/frontend-publish.test.sh (new): the copy into the volume and its test.
  • frontend/nginx.conf (deleted): it was the baked image's own config, and the frontend image no longer contains nginx.

#435

nested-copies.known and the code that reads it are removed. All twelve listed nested functions moved, no line was kept, so the list was empty. An empty list with a reader is a standing way to let a copy through; with it gone, scripts/check-tracer-helpers.py fails on every function two tracers share, nested or top-level, with no exception to add. Its three list tests (listed copy passes, third copy fails, STALE) are replaced by one: a nested-copies.known naming a copy no longer lets it pass.

No pair was judged "only alike": each of the twelve had the same meaning in every tracer that had it.

Where each went (scripts/walkthroughs/codebite.py, each with tests in scripts/walkthroughs-codebite.test.py):

Nested function Now In the tracer
bits (digits list, 2 files) bit_digits(v, width) called directly
bits (text, 2 files) bit_text(v, width) called directly
cell (4) table_cell(i, j) called directly
frame (7, one grid view table) table_frame(run, grid, caption, …) frame = partial(table_frame, run, grid)
frame (2, topological sort) task_frame(run, n, prereqs, waiting, finished, ready, caption, leaving=None, …) bound with partial; leaving is now an argument of the one frame that draws it, not a variable set and cleared around it
find (3) halving_find(parent, x, writes, visited) find = partial(halving_find, parent)
root_of (3) union_root(parent, x) root_of = partial(union_root, parent)
measure (2) hold_to_best(left, right, best, best_span), returning the new best and span instead of setting them with nonlocal called directly
name (3) node_name(node, dummy) name = partial(node_name, dummy=dummy)
obj (2) node_object(node) called directly
returned (5) record_return(result, value) returned = partial(record_return, result)
nid (6) no new helper: it only wrapped the kit's node_id(order, node) nid = partial(node_id, order)

Every Walkthrough was regenerated from its tracer against a database at this branch's migrations: no change under common/src/main/resources/walkthroughs/.

Closes #412
Closes #434
Closes #435
Closes #436
Closes #437

🤖 Generated with Claude Code

Kyu-seok and others added 21 commits November 22, 2026 16:53
Java allows no import after a class, so a submission that opened with
an import failed to compile under the 72 Drivers that put a Library
marker or a class of their own above {USER_CODE}. Everything but the
Driver's imports now comes after it. JavaDriversCompileTest compiles
every Driver under a leading user import; ProgramTest pins the user's
line numbers on a moved Driver.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Each nested function two or more tracers shared is now one helper in
codebite.py taking what the copy closed over, bound in the tracer with
functools.partial where it had many call sites. nid only wrapped the
kit's node_id, so it is bound from there. nested-copies.known is empty
and goes, with the code that read it: the check now fails on any copy.

Every Walkthrough regenerates byte-identical.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…he user's code (#412)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The frontend's built files were baked into the nginx image, so a deploy
that changed the frontend replaced codebite-nginx and nothing listened
on port 80 for about 2 s. nginx is now a stock image serving the
codebite-frontend volume; the frontend image only holds the build and
publish.sh, which copies it in (assets first, index.html renamed in
last, a replaced build's assets kept 7 days). deploy-prod.sh tests the
pulled nginx.conf before it rolls anything, publishes, and reloads
nginx only when something it serves or proxies changed; the log says
whether nginx was kept, reloaded or recreated. infra/nginx is mounted
as a directory so a pulled nginx.conf is the one a reload reads.
docs/adr/0014 records the decision.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ested helpers in codebite.py (#435)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…unning nginx (#434)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
start --wait waits while another worktree's set is live (app processes carrying its database, or the start that claimed the slot still running), says once whose, and gives up after CODEBITE_BRANCH_SERVERS_WAIT seconds naming the set and the command that stops it. A removed worktree's servers and a dead start's state hold nothing. Without --wait, start is as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ch behind the tip (#437)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t, one live set at a time (#436)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Under --refresh the path-scoped checks now run for every branch, one
that already contains HEAD too: a failed check leaves the refresh merge
on the branch in its worktree, and the rerun used to find the tip
contained and push unchecked. The rerun after a fix takes the local
branch when it is ahead of origin's. Each step of refresh_ticket is
checked and named (errexit is off under its caller's ||).

frontend/publish.sh joins the shellcheck globs (hook, repo_checks, CI)
and the hook's path rule that runs the script tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A publish that fails after the backend rolled now takes the rollback a
failed final health check takes (roll_back: previous commit, backend
and frontend build). restore_front checks each step and a failed
restore is logged loudly; check_nginx_conf skips only when a `ps` that
succeeded names no nginx; every reload goes through compose.
publish.sh computes its build id null-delimited, one checked step at a
time, so a spaced file name counts and a failed find or cksum stops it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The second await_detached case reused the first case's log, and its
writer truncates it in the background, so the old summary line could
still be there on the first read (CI run 45004083219).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…og between cases

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@Kyu-seok
Kyu-seok marked this pull request as ready for review November 22, 2026 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant