sql: re-seed lookup rows on upgrade - #63
Conversation
That sounds like really dangerous advice: NicTool/server/sql ➜ grep nt_nameserver_id * on master [$!] via 🐪 v5.40.4
04_nt_nameserver.sql: nt_nameserver_id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL,
04_nt_nameserver.sql: PRIMARY KEY (`nt_nameserver_id`),
04_nt_nameserver.sql: KEY `nt_nameserver_idx1` (`name`),
04_nt_nameserver.sql: KEY `nt_nameserver_idx2` (`deleted`),
04_nt_nameserver.sql: nt_nameserver_id SMALLINT UNSIGNED NOT NULL,
04_nt_nameserver.sql: KEY `nt_nameserver_log_idx1` (`nt_nameserver_id`),
04_nt_nameserver.sql:INSERT INTO nt_nameserver_log(nt_group_id,nt_user_id, action, timestamp, nt_nameserver_id) VALUES (1,1,'added',UNIX_TIMESTAMP(), 1);
04_nt_nameserver.sql:INSERT INTO nt_nameserver_log(nt_group_id,nt_user_id, action, timestamp, nt_nameserver_id) VALUES (1,1,'added',UNIX_TIMESTAMP(), 2);
04_nt_nameserver.sql:INSERT INTO nt_nameserver_log(nt_group_id,nt_user_id, action, timestamp, nt_nameserver_id) VALUES (1,1,'added',UNIX_TIMESTAMP(), 3);
04_nt_nameserver.sql: nt_nameserver_id SMALLINT UNSIGNED NOT NULL,
04_nt_nameserver.sql: KEY `nt_nameserver_export_log_idx1` (`nt_nameserver_id`)
08_nt_zone.sql: nt_nameserver_id smallint(5) unsigned NOT NULL,
08_nt_zone.sql: UNIQUE KEY `zone_ns_id` (`nt_zone_id`,`nt_nameserver_id`) |
c810950 to
3e97628
Compare
|
sorry I was having my clanker reason about its wanker move here, add tests to avoid similar facepalm |
774aaf4 to
073887b
Compare
|
The That instrumentation did catch something this run. The three records the test So it isn't the pagination or the search filter — rows that reported |
NicTool/api#63 added a new sql file whose header read `# Copyright 2004-2024`, copied from an older file two years out of date. It took the maintainer noticing to fix it. A copyright line in the first ten lines of a file now has to name the current year as its newest. Run against that original commit, it says: ``` sql/upgrade/06_reseed_lookup_tables.sql:1: copyright runs to 2024, not 2026 (a line you add carries today's year) ``` The ten-line window is what separates a banner from a string that builds one: without it the rule flags its own test fixtures, which is how the first attempt at this went. Checking only comments doesn't work either — `.sql` comments are `--` here, so the `#` header that carried the bug classifies as code.
NicTool/api#63 fails intermittently on node 24 while the same head passes node 22, macOS, Windows, and docker. Local repetitions need to keep the failed run's diagnostics without paying the virtiofs cost of a bind-mounted `node_modules`. Add an opt-in `make stress-api RUNTIME=node:24 N=25` target. It copies the api checkout into a runtime-derived image, runs all iterations against the compose db, prints failed output, retains every log, and reports the measured flake rate. `make test` is unchanged. At api#63 head `073887b`, node v24.20.0 passed 25/25 runs (395 tests each): 0 failures, skips, or cancellations; 0.00% flake rate; no `DIAGZR` block. Single runs also passed with node 25 and node 24 alpine. Test concurrency is the next variable to change because that revision passes all mysql test files to one unconstrained `node --test` invocation. Checks: - `uv run --with pyyaml==6.0.2 python -m unittest discover -v` - `uvx ruff check .` - `docker compose --env-file docker/.env --profile all --profile test --profile stress config --quiet`
|
A primary intent of this PR, as stated in the description, is to add
|
A database created by 2.x has the nameserver export types and record types of its day; nothing in sql/upgrade added the ones v3 introduced, so an upgraded install cannot create a coredns or native nameserver (lib/nameserver/test/runtime.js fails with "unknown nameserver type: native" on such a database). The header claims an id a site already uses keeps its own row and skips the one below it. A test runs that claim rather than asserting it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RxcUNWRPrY7gKukije8hFC Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014AUjj218gbhUHLi7kvDPtd
a585ad3 to
05f33aa
Compare
05f33aa to
da19535
Compare
|
Fixed in |
|
I think your agents are getting dumber. Or ... clumsier? That's the least elegant SQL I've seen in quite a while, and the tests are ... nearly as clumsy. You're not testing the infinite monkey theorem are you? |
|
consider #72 as a less clumsy alternative. |
|
I deffo drove off the cliff into roadrunner land with Ox Alpha (GLM-5.3 Flash) and need to give the harness a good scrub, alongside a better adversarial review loop that's custom-tuned rather than simply "when done, throw it over to another model." I've created a corpus tool + anonymised DB snapshot out of a few old database backups I have laying around, imagine getting going and starting to solicit for other "as live" donor DBs may help tighten it up. And then I wonder about backfilling some of the Greg Schueler style extended tests in areas of v2 that evolved after the initial cut of v2.01. |
|
Yeah, the harness could do with a simplicity and performance refactor. |
|
the Claude /code-review skill is NOT fast but is pretty good. Copilot's code review is pretty good too. |
A database created by 2.x has the nameserver export types and record types of its day; nothing in
sql/upgradeadded the ones v3 introduced, so an upgraded install can't create acorednsornativenameserver (lib/nameserver/test/runtime.jsfails withunknown nameserver type: nativeon such a database). Found by running a 2.41 production dump through the upgrade path; with this file applied that database passes the runtime tests.INSERT IGNOREkeeps an operator's own row under a clashing id; the header says how to check.