Commit graph

4 commits

Author SHA1 Message Date
Frederic Jung
0342d90657
Faster tests, split everywhere: one sharded CI for pushes and releases
- The harness builds the DOM without the page's 2 MB of script text and
  runs the scripts straight in the window: a page load in tests takes
  about half the time (jsdom's parser was slow on the script text).
- That also took the game's source out of the DOM, which showed three
  tests that matched a phrase in the page source rather than the screen;
  they now check the panel, the routing window and the dictionary.
- CI plans its split once and runs the tests on 6 runners; every run on
  main records each file's time and caches it, so the parts stay even
  without anyone refreshing tests/durations.json.
- auto-release.yml and release.yml call the same sharded tests instead
  of running all 170 files on one runner each (11 and 15 min); a release
  is tested once, before it is tagged.
- Audit: five tests that duplicated a gameplay rule or checked nothing
  are gone; the two slowest checks sample a third of the cities, and a
  year of play to reach one due date became a moved due date.
2026-11-07 07:24:09 +01:00
Antoine
3c45d7dca1
A day that reroutes no longer stops the page at x8: every routing it needs goes to the route worker
The day split of #312 on its own, from 3.0.0, without its routing core, save or map changes. On a big network at
x8 the game stopped whenever a day rerouted: after a failure, an event, the NOC intern's shift or the sales desk's
signing, dayPost() routed on the page.

* The day is a generator (dayRun(), dayPreRun(), dayPost()): each yield is a compute() it needs. dayTick() answers
  them on the spot (tests, fallback); in play rwGo() posts each one to the route worker. A failure (failureRun()), a
  DDoS and Auto-RTBH (ddosNewsRun()), the chaos monkey's snip (mkSnipRun()), an event's cut (eventRun()), the
  intern's shift (opsRun()) and the sales desk (slAutoRun(), its trials answered by the worker with offerTrial())
  are steps of the day. fireFailure(), opsDay() and slAutoDay() still play them in one go.
* yield DAY_REST lets a long day draw a frame between two steps (half a frame, 3 to 8 ms, RW.budget). One day in
  flight at a time, resting or routing: the clock waits for the day, and a half day is never saved.
* UI.tick is set around every step (dayStep()), so quiet notifications hold in play, not only in dayTick().
* The daily mood check works out the land islands once per pass over the customers (TERR), instead of walking
  every land link for each customer afraid of sharks. This fix is thesysadmindev's, from #310; here the islands are
  worked out again if something routed meanwhile (RW.gen), since the mood loop can now rest between customers.

Same game either way: tests/day-steps.test.js plays a second page as the worker and compares each day with
dayTick(), the intern on every order, failures, events, DDoS and the monkey forced.

Thanks to thesysadmindev for the profiling in #310 that pointed at the reroutes, and for the sharks fix.
2026-11-06 14:24:18 +01:00
Frederic Jung
dd6e4f4f8a
Fix CodeQL code-scanning alerts
- Values pasted into eval'd or inline-script code go through lit() (scripts/lib/js-literal.js), which escapes <, >, /, U+2028 and U+2029 after JSON.stringify
- build test and i18n-check read script tags with a DOM parser or a plain search, not HTML regexes
- mcp.js parses the Authorization header without a backtracking regex
2026-11-05 21:24:26 +01:00
Frederic Jung
92536606dd
Tests, CHANGELOG and docs for the peering desk 2026-10-29 21:41:28 +01:00