Skip to content

Feature framework polishing - #147

Merged
alowrydi merged 41 commits into
mainfrom
feature-framework-polishing
Oct 29, 2026
Merged

alowrydi merged 41 commits into
mainfrom
feature-framework-polishing

Conversation

@alowrydi

Copy link
Copy Markdown
Collaborator

Summary

Restores TorQ behaviour in existing KDB-X framework modules, porting TorQ (@4be4fc3) literally, except where the sections below list a difference. What each commit carries:

  • Behaviour commits have k4unit rows that fail before the change and pass after it.
  • A differential run against legacy TorQ, with an exact ~ match in separate q processes, exists only for timer, rdb, housekeeping, gateway, compression, eodtime and getconfig. The tickerplants, wdb, dbwrite, servers, pubsub and merge were compared with legacy by reading its source. The tickerplants, wdb, rdb and tickerlogreplay were also run in TorqX-POC.
  • Not behaviour changes: 4a23758 and 4c507a2 are test-only, ae3d204 is a merge of main, and 4f150ed and f628a50 are doc fixes.
Commit Module Change
875e34f di.eodtime getdailyadjustment reads the clock once, so the data-timezone offset is exact
cc5aac6 di.pubsub addfiltered/subscribestrfilter read the filters column TorQ sends; filtered subscriptions on the tickerplant path were silently unfiltered
1187c80 di.merge Restores merge.q failure and attribute behaviour
0d460cb di.timer Failed jobs are logged through the injected logger; framework jobs reschedule as .timer.repeat
16d7232 di.timer params stored as a list; maxtime end bound; nextruntime recomputed only after a run
0f7d914 di.timer Adds addjob.once and removefunc
0cc02d3 di.torq.servers Adds startupdepcycles and startupdependent
ae3d204 – Merge of main (#145); conflict in gateway/test.csv, both test blocks kept
4a23758 di.torq.config Test fixtures under a per-run directory
d3ee4b4 di.timer (+ callers) Timespan periods, mode and dupcheck checks, legacy first-run timing; callers migrated in the same commit
6298ab5 di.torq Stamps q's -t interval into config as timerms
20b45a7 di.torq.proc.segmentedtp Batches every -t ms, as TorQ's .z.ts
bd5442f di.torq.proc.chainedtp Accepts a sub-second pubinterval
51745be di.torq.proc.tickerplant -t decides batched or immediate
c7d7413 di.dbwrite Savedown hooks and TorQ's default sort
6e7cf94 di.torq.proc.wdb Save down hooks through di.dbwrite; postreplay unprotected
6f2bbbf di.torq.proc.tickerlogreplay Save down hooks through di.dbwrite (their source superseded by 389f56b)
aac042a di.torq.proc.rdb Save down hooks through di.dbwrite; g# kept after the standalone clear; postreplay unprotected
59abed1 di.compression Worker processes compress a table each (TorQ #732); single-file compress exported
99a4b72 di.torq.proc.housekeeping TorQ's job csv format and action names; rm skips directories
3a12e2f di.torq.servers addh, refreshattributes, gethpbytype, root gethandlebytype, the addprocscustom hook (serverselect.md note included)
3370059 di.eodtime Readers for the roll and data timezone and roll offset
f97837a di.torq.config getconfig and getconfigfile over the two roots
84bad6e di.torq, di.torq.config -parentproctype tier for settings and app code (one commit: cascade's new argument)
4941b05 di.torq.proc.gateway getdata behind the EOD reload gate
5e8b444 di.torq.proc.gateway Single-type queries run during the EOD reload, as TorQ's checkeod
4c507a2 di.torq.servers Test-only: fixture on OS-assigned ports with a listener check
6cdfcd1 di.torq.proc.tickerplant upd rolls the day first when past the roll, as TorQ's tickerplant.q:46,51,68,70 (TorqX-POC finding F1)
389f56b di.torq.proc.tickerlogreplay upd, savedownmanipulation and postreplay from config, as wdb and rdb (TorqX-POC finding F7)
4f150ed di.torq.proc.wdb Doc: wdb.md sortcsv fallback is the sym-then-time p# default, not "time asc"
f628a50 di.dbwrite Doc: dbwrite.md built-in default is the sym-then-time p# default, not "time ascending"
2143e10 di.torq.proc.tickerplant rolltimezone/datatimezone/rolltimeoffset reach di.eodtime intact; any of them stopped the tickerplant starting (from #128)
ee3ea38 di.torq.proc.gateway synccallsallowed reaches di.asyncdispatch as a boolean, not a dict (from #128)

Breaking changes

  • di.timer init requires the log dependency (0d460cb) and errors without it; the (::) config form is gone.
  • di.timer dupcheck is on by default (d3ee4b4): adding a job with the same function and parameters as an existing one is now rejected, as legacy repeat/once. Calls that used to add a duplicate fail; pass dupcheck:0b to allow it.
  • di.timer addjob period must be a timespan (d3ee4b4). An integer period now throws period must be a timespan. This applies to every caller, external ones included. All callers in this repo are migrated, but app code is not: the TorqX-POC feed (code/processes/feed.q:160) passed seconds and failed init until changed to 0D00:00:01*period. Any app calling addjob with an integer period breaks the same way.
  • Housekeeping job csv is TorQ's format again (99a4b72). A port-format csv (action,path,match,exclude,age,unit,dirs, actions gzip/tar) is no longer read. The process still starts, but every run logs cannot read job csv: ... incorrect layout and does nothing. Convert to function,path,match,exclude,age,agemin,checkfordirectory with actions rm/zip/tardir.
  • Classic tickerplant publishmode and pubperiod are removed (51745be). No error is raised: the keys are no longer read, and q's -t decides (batched every -t ms, immediate otherwise). A process that relied on publishmode=batched without -t now publishes immediately.
  • tickerlogreplay hooks come from config (389f56b): upd, savedownmanipulation and postreplay are read from config keys at init; main read root .replay.upd/.replay.savedownmanipulation/.replay.postreplay set before use, and those are no longer read. A launched process sets them in its settings file (a .q file; TOML can't hold functions).
  • di.torq.config cascade takes parentproctype before proctype (84bad6e); direct callers must pass it (a null symbol for none).

Required TorqX-POC changes (TorqX-POC feature-framework-polishing, 8b213b4)

The matching POC branch goes into TorqX-POC main on its own. It includes the .q settings twins beside every .toml (c977801). It carries the changes below in 54a8731; 8b213b4 adds only a wdb1 settings comment fix. Running the POC against this branch needs:

  • code/processes/feed.q:160: period → 0D00:00:01*period (feed1 fails init without it; observed in the smoke test);
  • appconfig/housekeeping.csv converted to TorQ's format (without it housekeeping logs an error each run and does nothing; observed against the old csv).

54a8731 also drops the stale publishmode line from appconfig/settings/tickerplant1.q/.toml, which nothing reads any more.

Behaviour changes reviewers should know about

di.timer (0d460cb, 16d7232, 0f7d914, d3ee4b4)

  • init requires the log dependency (see Breaking changes).
  • A single trap, as TorQ's timer.q: a job's error reaches runandschedule's handler, which logs it at ERR with the job id; a failing job doesn't stop the other jobs in the same tick.
  • Mode 1 → mode 3 for gateway gwtimeout/gwrmqueries/gwrminactive, wdb wdbsave and torq querylogflush: they reschedule from the end of the previous run, as .timer.repeat.
  • maxtime: a job whose next run would fall after its end time is disabled after it runs. nextruntime is recomputed only after a run; before, a job added after the jobs table emptied never ran.
  • A non-timespan period now throws in addjob, for internal and external callers alike (see Breaking changes).
  • dupcheck is on by default (see Breaking changes); housekeeping passes dupcheck:0b.
  • A mode outside the scheduling modes is rejected and not stored. First run follows legacy: an unset start runs now; a past start aligns forward on its period; once is due at its runtime.

di.merge (1187c80): getextrapartitiontype returns () after logging when there's no p row; mergebypart reads segments unprotected; upsert failures and non-enumerable columns log ERR then signal; mergehybrid no longer re-sorts or applies p# (callers do, as TorQ); a failed merge stops end of day before segments are deleted.

di.torq / tickerplants (6298ab5, 20b45a7, bd5442f, 51745be, 2143e10)

  • di.torq reads q's own -t once from .z.X (q consumes -t) and stamps it as timerms. The tickerplants batch on it, as TorQ's .z.ts; with no -t (or -t 0) they use 1000ms, as legacy. The batch phase can be up to one \t tick later than legacy; the rate matches.
  • chainedtp: a sub-second pubinterval is accepted. Known difference: the port's first batch runs at init, legacy's one pubinterval later (legacy's timing from its source, .timer.rep[.proc.cp[];…] aligning a just-past start forward; not executed); the init-time batch publishes nothing while the tables are empty.
  • chainedtp pubinterval rounds up to the timer tick, as in TorQ: a 500ms job gave the same gaps under TorQ's timer.q and di.timer, 500/600ms at a 100ms tick and 600ms at TorQ's default 200ms tick.
  • Classic tickerplant timezone settings (2143e10): eoddeps amended keys into enlist[`log]!enlist logdep, a one-row-table-valued dict, so each added value became a row of the log dict and any rolltimezone/datatimezone/rolltimeoffset setting stopped init with 'type. Now built by joins, log first, as segmentedtp.q:29. In the TorqX-POC, tickerplant1 with a New York roll, Tokyo data and a 1h offset failed init before; after, it starts with a 9h adjustment and a 05:00 UTC roll.
  • Classic tickerplant, breaking for port-format settings: publishmode and pubperiod are removed; as TorQ, -t decides (batched every -t ms, immediate otherwise). A classic tickerplant that was set to immediate, started with -t 200, now batches every 200ms, as legacy.
  • Classic tickerplant roll in upd (6cdfcd1): as TorQ, upd rolls the day first when past the roll: always in immediate mode, and for unstamped data in batched mode. Feed-stamped batched data is left to the 1s tpeodcheck job, as legacy. Before, every mode relied on tpeodcheck, and the TorqX-POC logged 24 rows up to 462ms after the roll into the old day's log; after, 0, with the roll 2.4ms after the roll time.

di.dbwrite and its writers (c7d7413, 6e7cf94, 6f2bbbf, aac042a)

  • Savedown hooks savedownmanipulation and postreplay, as TorQ's dbwriteutils.q, configured through init; each is set only when passed, so a later init keeps it (#762's intent). The default postreplay is {[d;p]}, a deliberate difference from TorQ: it avoids the 'rank that #762's projection causes in legacy.
  • Default sort is TorQ's config/sort.csv: every writer without a sort csv sorts by sym then time with p# on sym. A table without sym logs a sort and an attribute error each end of day, as legacy. (All TorqX-POC tables, packets included, have sym and time; the smoke test logged no sort errors.)
  • wdb: its postreplay error trap is dropped, as legacy wdb.q:333; a failing hook stops end of day after the move and leaves currentpartition on the old date, as legacy.
  • tickerlogreplay: the save down hooks and upd come from config at init, as wdb's and rdb's do; before, root .replay.* names were read, which a launched process can't set before init (app code loads after it). Proved in the TorqX-POC: a savedownmanipulation in settings/tickerlogreplay1.q doubled every replayed price (1337 rows; ratio 2.0, 1.0 before). The root .save.* copies are gone.
  • rdb: the hooks come from config (TorQ's names are .save.*; backlog). postreplay runs unprotected after the save, clear and attribute reapply and before the HDB reload, as legacy rdb.q:118. g# is kept after the standalone clear, as legacy rdb.q:104,115. The dbwrite setup moved ahead of the tickerplant wait (it reads only config, the log dependency and TORQXAPPHOME). Differential r1-r5: state matches legacy; r1/r2 differ only by legacy's #762 'rank and log wording.

di.compression (59abed1): with worker processes (-s below 0), each worker compresses and verifies one table, as TorQ #732; performance only, the final state is the same. compress is exported for single files; it writes file_kdbtempzip and leaves the original, as legacy. TorQ's caller is housekeeping's kdbzip (housekeeping.q:64), not ported; see residuals.

di.torq.proc.housekeeping (99a4b72)

  • Breaking for port-format job csvs: the job csv is TorQ's format again (function,path,match,exclude,age,agemin,checkfordirectory, the last two by position and optional, so TorQ's 5-column csv loads; null function/age rows skipped and logged); the actions are TorQ's rm, zip, tardir. TorqX-POC's csv is converted (POC 54a8731).
  • rm on a matched directory is skipped and logged, as legacy's rm -f fails on one. Under dry-run it is reported as if it would remove it (di.os isdir under dry-run; backlog; legacy has no dry-run).
  • The port traps each job; legacy's wrapper each stops at the first error. Differential, seven cases (k1–k5, k7, k8): on-disk state matches for k1–k5 and k7; k8 (a csv naming a root function) differs by design.

di.torq.servers (0cc02d3, 3a12e2f)

  • Adds startupdepcycles/startupdependent, .servers.addh, .servers.refreshattributes, .servers.getserverbytype/.servers.gethpbytype and root .servers.gethandlebytype (which reopens dead handles first; the module's exported gethandlebytype doesn't), as trackservers.q. addprocs calls .servers.addprocscustom[res;procs] (a no-op by default, kept if already defined). getserverbytype/gethpbytype share names with di.serverselect's, which read its own server pool.
  • All 10 .servers.* names in TorQ's apidetails (handlers/apidetails.q:26-35: SERVERS, opencon, addh, addw, addnthawc, getservers, gethandlebytype, gethpbytype, startup, refreshattributes) are defined as root .servers.* names once the module is initialised (checked at f628a50). startup differs in signature (see residuals).

di.eodtime (3370059): adds getrolltimezone, getdatatimezone, getrolltimeoffset (legacy callers read .eodtime.rolltimezone/datatimezone/rolltimeoffset, e.g. dataaccessutils.q:11). They have no ported caller yet: the port's dataaccess has no readtableproperties. getday stays internal (not in apidetails). Differential: settings, d and dailyadj match legacy.

di.torq.config (4a23758, f97837a, 84bad6e)

  • getconfig[builtinroot;approot;path;level]/getconfigfile, as .proc.getconfig: app before builtin, levels 0/1/2; pure. No ported caller yet. Differential against legacy's own source: 24 of 24 match.
  • -parentproctype, as torq.q:376-380, :593, :643: a reserved flag stamped into config as a symbol atom; its settings tier sits between default and the proctype; code/<parentproctype>/ loads between common and the proctype, gated by loadprocesscode. A process launched with -parentproctype wdb now inherits an app wdb.q tier and loads code/wdb/ first; before, the flag was ignored. (Unit tests only; see the open gaps.) Breaking for direct cascade callers: it takes parentproctype before proctype (null for none).

di.torq.proc.gateway (4941b05, 5e8b444, ee3ea38)

  • getdata is now behind the EOD reload gate, through the same helper as asyncexec/asyncexecjpt; before, it was dispatched to the rdb and hdb mid-reload.
  • During a reload a query spanning more than one server type is rejected and a single-type query runs, as TorQ's checkeod; a getdata counts as the server types of the partitions its range covers (g1 now matches legacy).
  • Legacy getdata was compared by source, not executed (it needs TorQ's dataaccess stack); its routing ends in .gw.asyncexecjpt/.gw.syncexecjt, whose reload behaviour was measured.
  • synccallsallowed (ee3ea38): it was amended into a one-row-table-valued dict as eoddeps was, so it reached di.asyncdispatch as `info`warn`error!111b and syncexec's check would throw 'type. Now joined, log first.

Testing

  • k4unit, every suite, origin/main (0901741) against 4c507a2, run one at a time; the suites 6cdfcd1 and 389f56b touch were rerun at 389f56b (tickerplant, tickerlogreplay), with wdb and dbwrite rerun for the doc fixes, and tickerplant, gateway, eodtime, asyncdispatch and torq rerun for 2143e10/ee3ea38. Every suite that differs gains tests and nothing else; the remaining failures also occur on main (kx.log rows, and suites that fail on main too).
Per-suite counts, main against tip
Suite main tip Why
di.timer 66/66 179/179 new tests
di.torq 75/75 83/83 new tests
di.torq.config 0 tests 68/76 main fails in setup (shared /tmp fixture, fixed in 4a23758); the 8 failures are kx.log rows (KX module not installed here)
di.dbwrite 165/169 191/195 new tests; the same 4 kx.log failures
di.compression 64/64 73/73 new tests
di.eodtime 49/49 58/58 new tests
di.merge 238/238 240/240 new tests
di.pubsub 122/122 133/133 new tests
di.torq.servers 58/58 71/71 new tests
di.torq.proc.gateway 12/12 39/39 new tests; ee3ea38's 4 rows: 37/39 before the fix
di.torq.proc.housekeeping 89/89 102/102 new tests
di.torq.proc.rdb 4/4 11/11 new tests
di.torq.proc.tickerplant 39/39 65/65 new tests; 6cdfcd1's 10 rows: 57/61 before the fix; 2143e10's 4 rows: 61/65 before the fix
di.torq.proc.tickerlogreplay 96/96 96/96 389f56b replaced the .replay.* rows with config rows: 93/96 before the fix, the upd row showing the default in use
di.torq.proc.segmentedtp 77/77 80/80 new tests
di.torq.proc.wdb 80/80 83/83 new tests
di.torq.proc.chainedtp 71/71 72/72 new tests

Every other suite has the same count on both, including the failures that also occur on main (asyncutil 17, datadog 11, cache 4, dataloader 3; analytics and pqx run 0). di.clienttracking ran 0 on the tip in the batch because the main run left its fixed-port peers up; on its own it's 44/44 on both.

  • Differentials against legacy TorQ, in separate q processes with an exact ~ match: timer, rdb (r1-r5), housekeeping (k1–k5, k7, k8), gateway (g0-g3), compression (two workers), eodtime, getconfig. Results match legacy except where noted in the behaviour sections above.
  • TorqX-POC, on its matching branch:
    • an end-of-day smoke test;
    • a findings run that found F0–F7;
    • two consecutive ends of day on the segmented stack (scenario 10), where everything matched expectation except a legacy file-handle leak;
    • two consecutive rolls on the classic tickerplant, with no late rows, no double roll and flat counters.
TorqX-POC evidence
  • End-of-day smoke test on the tip: full stack started per the README, data flowing, end of day forced on stp1.

    • wdb sorted, moved 2026.10.20 into the HDB, and hdb, rdb and idb reloaded (3 of 3); the gateway got reloadstart/reloadend.
    • HDB rows equal stp1's tickerplant logs for the day exactly: trade 2683 (699+530+1454), quote 14773 (3858+3165+7750); p# on sym, time sorted within sym; no working partition left.
    • The gateway answers on the new partition; the rdb holds only data since the roll.
    • No error lines in any POC log; the only warnings are Connection refused while the stack starts.
    • feed1 first failed init (period must be a timespan): POC app code passed integer seconds to addjob. Fixed in the POC (feed.q:160, POC 54a8731).
  • TorqX-POC findings run (POC feature-framework-polishing), aimed at finding defects. Observed by the author in the stack: batching (-t on stp1 and tickerplant1, chainedtp pubinterval), timers, end of day (rdb, wdb, hooks), gateway queries during the reload, getconfig, a servers dependency started late (found through discovery), and compression at -s 0. Housekeeping ran against a scratch fixture with the module, not housekeeping1 in the stack. It found F1 and F7 (fixed above), F0 and F6 (backlog), and F2–F5 plus a failing wdb postreplay (kept legacy behaviour, below).

  • F1 in the POC: see the classic tickerplant item above (24 late rows before, 0 after).

  • F7 in the POC: see the tickerlogreplay item above (price ratio 2.0 with the hook in settings/tickerlogreplay1.q).

  • Scenario 10, two consecutive ends of day on the segmented stack at 389f56b (stp1 → sctp1 → rdb1/wdb1 → hdb, plus idb1, gateway1, housekeeping1, feed1). Every process loaded modules from the 389f56b working tree (QPATH read from each). Root tables were unchanged on all 10 processes across every probe. Before and after each end of day:

    • timer jobs unchanged on every process, except wdb1's one-shot sortflushend (4 → 5 at the first, 5 → 5 at the second);
    • .Q.w[] used flat; rdb1 drops at each reload (1,323,952 → 1,204,784; 1,326,448 → 1,197,440);
    • .z.W counts unchanged on every process;
    • rdb1 holds only rows after each roll;
    • wdb1 currentpartition 10.22 → 10.23 → 10.24, tabsizes empty after each;
    • hdb partitions 2026.10.22 (254 trade / 1468 quote) and 2026.10.23 (248 / 1341) equal stp1's log for each day exactly; trade, quote and packets only;
    • no error lines in any log;
    • one fail against expectation: stp1 open files 15 → 16 → 17, its error log left open each day. That's legacy behaviour (see below).

    This stack doesn't contain F1 or F7, so it shows the rest of the stack at the tip, not those fixes.

  • Classic tickerplant through two consecutive rolls at 389f56b (discovery1 → tickerplant1 immediate → chainedtp1). A probe sent one quote every 20ms (320 in all) and set a roll 2s ahead twice:

    • two ends of day, 2026.10.22 → .23 → .24, each about 20ms after its roll time; no double roll;
    • tickerplant1 logs 150 / 150 / 20 rows, 0 stamped after their day's roll, and none lost;
    • chainedtp1's logs hold the same 150 / 150 / 20;
    • jobs (3 and 4), .z.W (3 and 3) and open files (11 and 11) identical before, between and after the rolls; root tables unchanged.
  • Claim-by-claim smoke test in the TorqX-POC (at f628a50; tickerplant1's timezone run and the startupdependent run at 2143e10/ee3ea38):

    Claim Shown
    di.timer non-timespan period, mode 9 and a duplicate rejected (dupcheck 0b allows it); a past start aligned forward on its period; once ran once; removefunc removed only its job; a throwing job disabled and logged through the injected logger; a description stored; all 33 jobs on 10 processes have timespan periods
    Tickerplants tickerplant1 immediate without -t, 500ms batches with -t 500; stp1 batches at -t 200; chainedtp1 accepts a 500ms pubinterval (rounds up to the tick, as TorQ)
    dbwrite hooks, p# wdb1, a standalone rdb1 and tickerlogreplay: rows equal the logs, savedownmanipulation applied once, postreplay once per end of day (once per log file in replay), p# sym, sorted sym then time
    rdb g# kept through classic tickerplant1 → chainedtp1; the segmented path strips attributes, as TorQ
    housekeeping TorQ 7- and 5-column csvs; null-age row skipped; rm/zip/tardir acted; rm on a directory skipped and logged
    compression two workers on a copy of an hdb partition, one table each; single-file compress writes only <file>_kdbtempzip and leaves the original, as TorQ
    servers addh, gethpbytype, startupdepcycles (error after its cycles), startupdependent (blocked until the hdb started), refreshattributes, the addprocscustom hook
    config -parentproctype wdb tier and code/wdb/ on a non-sort process; getconfig levels 0/1/2 and getconfigfile
    eodtime readers return the configured timezones and offset; the single clock read is shown by unit tests only
    gateway during the reload gate, single-type and one-partition getdata answered, multi-type rejected
    merge, pubsub partandmerge replay merged into a p# table; filtered subscription delivered only matching rows and columns; merge failure paths covered by unit tests only

Kept legacy behaviour found in the POC (not changed; legacy by reading its source, not by running TorQ)

  • F2: after an sctp restart, rdb1 permanently misses the outage window (observed: 0 rows for 13:35). Legacy resubscribes without replay (subscriptions.q:155-157).
  • F3: rows are applied twice at the subscription boundary through a chained STP (observed: 19 rows at 13:48:46.551). Legacy has the same two-step design (stplog.q:112-115).
  • F4: a table without sym breaks compression. TorQ's default sort leaves a 0-byte sym file, and compression's -19! on it aborts the whole run (reproduced in q). Legacy applies the attribute the same way (dbwriteutils.q:60-66).
  • F5: -s negative with no workers makes compression recurse until 'stack (observed). Legacy has the same line (#732).
  • A failing wdb postreplay strands the next day's data (observed in the POC with a throwing hook; asserted by the wdb failedpostreplay test). The partition is moved but no reload is sent, tabsizes isn't cleared, and currentpartition stays on the old date, so the next day's flushes go to the old date's working directory until fixpartition or a restart. Legacy calls it unprotected (wdb.q:334) and sets currentpartition only at the end.
  • segmentedtp leaks one file handle per day in error mode (observed in scenario 10: stp1 open files 15 → 16 → 17, each day's segmentederrorlogfile still open). End of day closes only logtabs, the data tables, and the error log is reopened each day (TorQ stplog.q:232,253,265; port stplog.q:198,215,225).

Open gaps in the POC testing

  • .servers.refreshattributes[]: re-registered gateway1 with discovery1 in the POC. Discovery logs nothing for a register; discovery1's SERVERS row for gateway1 kept its handle and its startp/lastp moved to the call time (13:02:26 → 13:02:46).
  • Compression with -s -2: shown with two workers on a copy of an hdb partition, not the live hdb (one table per worker, gzip level 6, data reads back equal).
  • g# after a standalone rdb's clear: kept through classic tickerplant1 → chainedtp1; the segmented path strips attributes, as TorQ does (segmentedtickerplant.q:37).
  • -parentproctype: tier and code/wdb/ loading shown on a non-sort process (housekeeping with -parentproctype wdb; the proctype tier still wins). A real sort process still can't start (F6).
  • startupdependent with a late dependency: connected in the POC with discovery; mechanism not isolated. gateway1 blocked on startupdependent[`hdb;1] with the hdb down and returned with a live hdb connection once it started, though a dead hdb row was in SERVERS.

Residual differences from legacy (backlog, not in this PR)

  • gateway reload: legacy holds multi-type async queries until reloadend and errors those in flight at reloadstart; the port rejects them and lets in-flight ones finish. Sized: gateway hold-and-replay ~15 lines, a di.asyncdispatch failinflight export ~10, and for getdata an explicit-client entry point in di.dataaccess ~6.
  • housekeeping: kdbzip not ported (legacy leaves the original plus an _kdbtempzip copy every run; not in apidetails; unused by TorQ's and the starter pack's csv); csv functions must be built-ins or registered with addaction; an unmatched { in a path is left alone.
  • servers: .servers.startup[] (niladic) throws 'type (run against the initialised module at 389f56b); the port's startup takes a config dict. No caller in this repo or TorqX-POC uses the niladic form (grep). opencon logs every failed connection (legacy only with DEBUG), predating this PR.
  • config: legacy's $KDBSERVCONFIG tier is not searched (two roots).
  • rdb: onlyclearsaved, savetables, gc flags and smallest-table-first save order not ported (TorQ sets them only to their defaults; the starter pack doesn't). Hook names: rdb config keys vs legacy .save.*; tickerlogreplay config keys vs legacy .replay.* (a TorQ settings file that sets .replay.* would need a compatibility layer).
  • timer: the failed-job message id format; params is the argument list (di.timer convention).
  • merge: sym order in a merged partition follows first write, as legacy (merge.q:51).

Backlog found during this work

  • di.os isdir/isfile are wrong under dry-run: issymlink runs through the dry-run stub, so every path reads as a symlink. Port-only (legacy .os has no dry-run).
  • Test fixtures picked ports with no listener and spawned q on them; about 1 run in 30 the spawn couldn't bind (Address already in use), and once another process answered on the port. Gateway and servers suites now use OS-assigned ports with a listener check (30/30 runs each); clienttracking still uses fixed ports.
  • KDB-X like throws 'nyi with 3 or more * in a pattern.
  • startupdepcycles/startupdependent never reconnect a process.csv dependency that was down at the first attempt (legacy behaviour, kept; by source, and see the open gaps for what the POC showed).
  • F0, TorqX-POC launcher: torqx.sh takes -t as its tmux flag (torqx.sh:348), so q's -t can't be passed through it; the POC's -t runs used a hand-built command. Its own launcher change.
  • F6, on main too (Feature segmentedtp #144): sort/sortworker processes can't start through di.torq. The dependency audit requires di.subscriptions, which wdb/deps.toml:4 declares but sort mode never loads. Dropping it from deps.toml would weaken the audit for the normal wdb, so it needs its own change.
  • TorqX-POC: hdb/2015.01.07 holds only trade (loader1 rewrites it); forcing an end of day by hand needs .stplg.getnextendUTC[] after setnextroll (observed; legacy caches nextendUTC the same way, by source).
  • Flaky di.pubsub test (clt:first key .z.W), on main too.

alowrydi and others added 30 commits October 19, 2026 16:48
getdailyadjustment read .z.p twice, so the data-timezone offset drifted by
nanoseconds between the two reads and was never exact. It now reads the clock
once. Tests assert an exact +9h offset for Asia/Tokyo (no DST).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
addfiltered read the condition column `filts`, but TorQ's pubsub.q and the
port's own .ps.subtablefiltered send `filters`, so filtered subscriptions on
the tickerplant path were silently unfiltered. addfiltered and
subscribestrfilter now use `filters`. Tests cover the parsed where clause and
column list, filtered delivery, and rejection of an invalid filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- getextrapartitiontype returns () after logging when neither the table nor
  default has a p# row, as legacy does, instead of the logger's return value.
- mergebypart reads segments unprotected (get each partchunks): an unreadable
  segment fails the batch before anything is upserted.
- mergebypart's upsert handler logs ERR and then re-signals the error.
- checkenumerabletype logs ERR and then signals for a non-enumerable column.
- mergehybrid no longer re-sorts the whole destination and applies p#; the
  callers apply p# after merging, as in TorQ. Its tests and docs go with it.

A failed merge now stops end of day before the segments are deleted; a wdb
caller-level test (failedmerge) covers this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e as TorQ's .timer.repeat

- init requires a `log dependency in its dict; the (::) config form is gone.
  The only non-test caller, di.torq buildtimerdep, now passes the log dep.
- Single trap, as TorQ's timer.q: execute no longer traps, so a job's error
  reaches runandschedule's handler (jobfailed), which logs ERR with the job id
  and error whatever debug is set to, and returns 0b.
- gateway gwtimeout/gwrmqueries/gwrminactive, wdb wdbsave and torq querylogflush
  move from mode 1 to mode 3 (reschedule from the end of the previous run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rQ's timer

D-T1: addjob.custom stores (),params and upserts a keyed row, so a job
with an atom parameter no longer types the params column.
D-T2: a job whose next run would fall after maxtime is disabled after
its run, as TorQ's timer checks the next run against the period end.
D-T3: nextruntime is recomputed after each run instead of every tick,
as TorQ's timer does, so a job added after the table empties still runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…timer.removefunc

addjob.once schedules a one-off job at a set time (startattime, maxruns 1).
removefunc deletes every job running a function with given parameters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… trackservers.q

reqproctypesnotconn and the two root projections on startupdepcyclestypename,
alongside the existing startupdepnamecycles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict in di/torq/proc/gateway/test.csv: both sides added a block after the
export checks. Kept both - the timer-mode check from this branch, then main's
late-backend registration tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The suite wrote to fixed /tmp/diconfig* directories, so on a shared host it
failed in setup when another user owned them and ran no rows. Fixtures now
live under /tmp/diconfig_<pid>/, built from TD, and are removed after the
run. Test logic is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n timing; migrate callers

As TorQ's timer.q, which the port is moving to:
- period is a timespan, as .timer.repeat takes it; addjob rejects any other
  period type, and any mode outside the scheduling modes, before the job is
  stored (a stored bad row stopped the scheduler on every tick)
- a job with the same function and parameters as an existing one is
  rejected unless dupcheck is 0b; dupcheck defaults on, as repeat/once
- modes 1-3 first run: an unset start runs now, a past start aligns forward
  on its period (no catch-up burst); once is due at its runtime as given
- a description column and opts key
- mode 5 buckets on the period's minutes

Callers in subscriptions, torq, logroll, housekeeping (dupcheck 0b, as legacy
housekeeping.q:157), gateway, chainedtp, servers, tickerplant, segmentedtp,
wdb and dataaccess pass timespans in the same commit, so no commit breaks.
Their test mocks record timespans. timer, servers, subscriptions, logroll and
asyncdispatch docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
q consumes its own -t, so cmdlinet reads it from the full command line .z.X,
once, and init stamps it into config as timerms (ms, null if not given). The
tickerplants batch on it as TorQ's .z.ts runs at -t, without reading the
command line themselves - the same env-free boundary as processcsv. Tests
launch real processes through torqx_init.q with and without -t.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The stpzts job's period was fixed at 1s. It now follows config timerms (q's
-t, stamped by di.torq), falling back to 1000ms when -t is unset or 0, as
legacy segmentedtickerplant.q does. segmentedchainedtp gets the same period.
Test peers start with -t 200, -t 0 and -t 300.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ainedtp

The whole-seconds guard existed only because di.timer took integer seconds.
TorQ registers publishalltables with any timespan pubinterval
(chainedtp.q:209-210); the port now does too, in timer mode 2 (legacy 1h).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tickerplant.q

publishmode and pubperiod are removed (breaking for port-format settings).
As TorQ's classic tickerplant, the tickerplant batches every -t ms when q is
started with -t (config timerms, stamped by di.torq) and publishes each
update immediately otherwise. The end-of-day check stays its separate 1s job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- savedownmanipulation and postreplay, as TorQ's .save hooks, configured
  through init and set only when passed (TorQ #762's intent); postreplay
  defaults to {[d;p]}, avoiding the 'rank that #762's projection causes in
  legacy
- savedown and appenddown apply manipulate before enumerating; failures are
  logged and the original rows written, as .save.manipulate
- the built-in default is TorQ's config/sort.csv: p# on sym, sorted by sym
  then time

wdb's sort-mode test expectations change because of the new default sort
(sym then time, p#); its sortcsvhonoured test now uses a time-only csv so it
still proves an override.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…otected, as TorQ's wdb

The private manipulate and trapped postreplay go; wdb passes its config's
savedownmanipulation and postreplay (defaulting as TorQ's wdb.q:78-79) to
di.dbwrite and calls its manipulate and postreplay. As legacy wdb.q:334, a
failing postreplay now propagates out of end of day after the move, leaving
currentpartition on the old date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d from .replay.* at init

The load-time .save.manipulate and root .save.savedownmanipulation /
.save.postreplay go; init reads .replay.savedownmanipulation and
.replay.postreplay (defaulting as TorQ's tickerlogreplay.q:40-41), passes
them to di.dbwrite, and the replay calls its manipulate and postreplay.
Hooks set after use and before init are now honoured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he standalone clear; postreplay unprotected, as TorQ's rdb

init passes the config's savedownmanipulation and postreplay (defaulting as
TorQ's rdb.q:42-43) to di.dbwrite, ahead of the tickerplant wait as legacy
reads its hooks at load. Standalone end of day captures the in-memory
attributes before the save, reapplies them after the clear, then calls
postreplay unprotected before the hdb reload, as legacy rdb.q:104-118.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… export single-file compress

With -s below 0, compressfromtable peaches one table to each worker
process, which compresses and verifies it there, as TorQ #732; the final
state is unchanged. compress is exported for single-file use, as legacy
housekeeping's kdbzip calls .cmp.compress.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… skips directories, as TorQ's housekeeping

The job csv is read as legacy housekeeping.q:44-51: function,path,match,
exclude,age,agemin,checkfordirectory, the last two named by position and
optional, rows with a null function or age skipped and logged. The actions
are TorQ's rm, zip and tardir. rm on a matched directory is skipped and
logged as an error, as legacy's rm -f fails on one. kdbzip stays out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bytype and the addprocscustom hook, as TorQ's trackservers

Ports trackservers.q:130-134 (addh), :255-258 (refreshattributes),
:97-107 (getserverbytype, gethpbytype, and root .servers.gethandlebytype,
which reopens dead handles first, unlike the module export), and the
addprocs hook .servers.addprocscustom (:244-247), kept if already defined.
serverselect.md is included for the note that its getserverbytype and
gethpbytype share these names but read its own server pool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s TorQ's .eodtime settings

getrolltimezone, getdatatimezone and getrolltimeoffset return the settings
init applied, which legacy callers read as .eodtime.rolltimezone,
.eodtime.datatimezone and .eodtime.rolltimeoffset (e.g. dataaccessutils.q:11).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rQ's .proc.getconfig

getconfig[builtinroot;approot;path;level] returns the config file(s) for
a path, app before builtin, at TorQ's levels 0/1/2 (torq.q:149-174);
getconfigfile is level 0. Pure: the roots are arguments, as cascade.
Legacy's $KDBSERVCONFIG tier has no port equivalent and is not searched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…de, as TorQ's torq.q

di.torq reads -parentproctype (torq.q:376-380) as a reserved flag and
stamps it into config as a symbol atom. cascade takes it before proctype,
so its settings tier sits between default and proctype (torq.q:593), and
loadappcode loads code/<parentproctype>/ between common and the proctype,
gated by loadprocesscode (torq.q:643). One commit for both modules, since
cascade's new argument would otherwise break di.torq's call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ys rejecting

.gw.getdata is now the gateway's own wrapper over di.dataaccess's getdata,
behind the same reload helper (ineod) as asyncexec/asyncexecjpt, so it is
rejected during an EOD reload instead of being dispatched to the rdb and
hdb mid-reload. The reloadstart log line says it rejects new queries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…as TorQ's checkeod

During a reload, ineod rejects only a query spanning more than one server
type, as legacy's checkeod (gateway.q:93); a single-type query runs. A
getdata's types are those of the partitions its range covers, from the
same table di.dataaccess routes with. The test fixture now uses
OS-assigned ports and checks each listener is the process it spawned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test-only. Ports a spawned peer binds are reserved by a q started with
-p 0W that writes its port and exits, instead of probing for a port with
no listener; each spawn logs to the per-run fixture dir and checks the
listener's .z.i is the pid it spawned. FIXDIR is per run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… as TorQ's tickerplant.q

As legacy tickerplant.q:50-51 (batched: the check sits in the branch that
stamps unstamped data) and :70 (immediate: ts .z.p on every upd), upd now
runs the roll check before logging. Before, only the 1s tpeodcheck job
rolled, so messages between the roll time and the next check were logged
into the old day (24 rows, up to 462ms late, in the TorqX-POC probe; none
after this change).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… wdb and rdb

upd, savedownmanipulation and postreplay are read from the config dict in
init, so a launched process can set them in its .q settings file. Legacy
reads them as .replay.upd / .replay.savedownmanipulation / .replay.postreplay
under \d .replay (TorQ tickerlogreplay.q:25,40-41); here they were read from
those root names at load, before any settings file could set them.

Breaking: root .replay.upd, .replay.savedownmanipulation and
.replay.postreplay are no longer read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… p# default

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…boolean

adcfg amended synccallsallowed into enlist[`log]!enlist deps`log, whose
values are a one-row table, so it arrived as `info`warn`error!111b and
asyncdispatch's syncexec check would throw 'type. Join it, log first, as
segmentedtp.q:29. From #128.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread di/timer/init.q Resolved
Comment thread di/compression/test.q Resolved
Comment thread di/torq/proc/rdb/rdb.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

0 critical | 3 warning(s) | 4 suggestion(s)

⚠️ Spec check skipped — tracker lookup failed (NO_REF_FOUND). Standards axis only.

Suggestions

  • di/timer/init.q:55 — The new first-run alignment block runs unconditionally on every addjob.custom call, even when a startattime is supplied, and it uses an early cp[] call before the row is inserted. The subsequent $[null (r:.z.M.jobs[id])startattime; upd.start[id]; ...]block also runs, meaning for modes 1-3 thenextstartis set twice: once by the alignment block and once byupd.start/the startattime branch. When a startattimeis in the future the alignment block setsnextstarttostartattime(becausest=startattimewhich is>=now, so st+0D=startattime), then the startattimebranch below correctly sets it again — so those agree. But for a *null*startattimethe alignment block setsnextstarttonow(thecp[]at the top of the block), and thenupd.start[id](modes 1-3:period + created) overwrites it with created + period— which is later thannow, defeating the "null start runs now" contract the tests assert. Fix: remove the upd.start/startattime branch that follows, or guard the alignment block so it only applies when the existing startattime/upd.start` path would not already handle it.
  • di/timer/init.q:64 — addjob.once sets nextstart by directly assigning to .z.m.jobs with an update statement (.z.m.jobs:update nextstart:runtime from jobs where id=jid), bypassing the keyed-table upsert path the rest of the module uses. If .z.M.jobs is the authoritative keyed table and .z.m.jobs is a local alias that writes back through .z.M, this is fine; but the module uses @[.z.M.jobs;id;:;r] everywhere else. A mismatch in which alias is canonical would silently leave nextstart unset in the real jobs table.
  • di/torq/proc/gateway/test.q:82 — The fixture writes both rdb1.q and hdb1.q with a trade table that includes date as its first column (date:2#.z.d-1 0). The gwgetdata helper queries starttime as `timestamp$.z.d-1 and endtime as .z.p. The gateway's getdata function filters .z.m.partitions where coverfrom<=endtime and coverto>=starttime to decide which server types to query. If .z.m.partitions is built by buildpartitions[] from .z.d (today's date) rather than from the trade table's actual data dates, the partition coverage may not match the fixture's date column values, causing gwgetdata during the reload (which expects exactly one error reply) to route zero shards instead and return an empty reply list, silently passing a wrong assertion.
  • di/torq/torq.q:282 — parentproctype is read from .Q.opt .z.x (lowercase), but the rest of the init function uses .Q.opt .z.X (uppercase) for the command-line override layer (clioverrideparams .Q.opt .z.x on line ~294 also uses lowercase). .z.x and .z.X are different: .z.x is the argument list without the script name, .z.X is the raw command line. cmdlinet (which reads -t) explicitly uses .z.X. If the convention in this codebase is .z.x for option parsing that is consistent, but cmdlinet using .z.X and parentproctype using .z.x means they parse from different sources. Verify both are intentional, or align them.

@DI-Dexter

Copy link
Copy Markdown
Collaborator

The changes looks good, i think there are just a few small outstanding items:

  1. di/torq/proc/gateway/test.q:64 — fixture stamps "today" at a fixed 10:00 UTC, so the suite fails on any run before then. Fix: time:.z.p-(1D;0D00:00:01)
  2. di/subscriptions/subscriptions.q:28 — missing totimespan, latent until an app sets the period in TOML.
  3. di/torq/proc/tickerplant/tickerplant.q:117 — rolltimeoffset is silently dropped unless it is already a timespan, so a TOML-configured roll time falls back to midnight with no error: "0D17:00:00.000" → 0D, roll at 2026.01.06D00:00:00 instead of 2026.01.05D17:00:00. Wrong day boundary and an EOD chain seven hours out. Same totimespan fix

alowrydi and others added 4 commits October 27, 2026 11:23
The fixture stamped today's row at 10:00 UTC, so a getdata over midnight..now
excluded it before 10:00 and the suite failed. Rows are now at midnight.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

0 critical | 1 warning(s) | 1 suggestion(s)

⚠️ Spec check skipped — tracker lookup failed (NO_REF_FOUND). Standards axis only.

Suggestions

  • di/subscriptions/subscriptions.q:33 — After init stores p into .z.m.checksubscriptionperiod, the if[checksubscriptionperiod>0;…] guard on the next line (line 33 in the new file) still references the bare local name checksubscriptionperiod, not the validated p or .z.m.checksubscriptionperiod. If config does not have a local binding named checksubscriptionperiod this resolves to the module-level variable (whose value before this init call may be stale or zero), so the timer may be skipped when it should be registered, or registered when it shouldn't be.

@alowrydi

Copy link
Copy Markdown
Collaborator Author

The changes looks good, i think there are just a few small outstanding items:

  1. di/torq/proc/gateway/test.q:64 — fixture stamps "today" at a fixed 10:00 UTC, so the suite fails on any run before then. Fix: time:.z.p-(1D;0D00:00:01)
  2. di/subscriptions/subscriptions.q:28 — missing totimespan, latent until an app sets the period in TOML.
  3. di/torq/proc/tickerplant/tickerplant.q:117 — rolltimeoffset is silently dropped unless it is already a timespan, so a TOML-configured roll time falls back to midnight with no error: "0D17:00:00.000" → 0D, roll at 2026.01.06D00:00:00 instead of 2026.01.05D17:00:00. Wrong day boundary and an EOD chain seven hours out. Same totimespan fix

Thanks, all three are fixed on the branch, plus one more of the same kind.

  1. gateway/test.q: 430fc1f. The fixture rows are now at midnight (`timestamp$.z.d-1 0). .z.p-(1D;0D00:00:01) would fail in the first second after midnight, because dataaccess filters on time within, so I used midnight rows instead. Checked with rows at 23:59 (38/39) and at midnight (39/39).
  2. subscriptions.q: 7b04806. checksubscriptionperiod goes through totimespan, so a string or number from TOML works. A value that can't be converted now errors with "checksubscriptionperiod must be a timespan".
  3. tickerplant.q: 36414a9. rolltimeoffset goes through totimespan. A value that can't be converted errors instead of falling back to midnight.
  4. segmentedtp.q: 0639b21. Its [eodtime] section was passed to di.eodtime raw, so a TOML timezone or offset had the same problem. It now converts the timezones to symbols and the offset to a timespan, and errors on a bad offset.

Each has failing-before tests. Counts on the tip: tickerplant 70/70, segmentedtp 85/85, di.subscriptions 49/49, gateway 39/39.

# Conflicts:
#	di/torq/proc/gateway/gateway.q
#	di/torq/proc/gateway/test.q
Comment thread di/torq/proc/gateway/gateway.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

0 critical | 2 warning(s) | 6 suggestion(s)

⚠️ Spec check skipped — tracker lookup failed (NO_REF_FOUND). Standards axis only.

Could not be posted inline

  • WARNING di/torq/torq.q:92 — buildtimerdep now takes a second argument logdep, but its projection addjob.default and all existing callers in other modules that call buildtimerdep[overrides] (one argument) will get a rank error at runtime. In this diff buildtimerdep is only called from init at line 355 as buildtimerdep[overrides;logdep] (correct), but if any other call site outside this diff still uses the one-argument form it will break. The function signature change is not backward-compatible.

Suggestions

  • di/timer/init.q:57 — The new startattime alignment logic runs and immediately overwrites the row that was just inserted via upsert. The upsert call on line 52 lands the row (with nextstart:0Np), then line 57 uses .[.z.M.jobs;(id;nextstart);:;…]to set the firstnextstart. But the code then falls through to the $[null (r:.z.M.jobs[id])startattime;upd.start[id];…] block at line 58, which calls upd.start[id] again (for a null startattime) — that calls nextstart[mode][id;r], which reads rprevstart(null at first run) and setsnextstarttorcreated + period, overwriting the alignment just computed on line 57. For modes 1-3 with no startattime, the alignment on line 57 is immediately undone. Fix: use an early return (:) after the alignment block on line 57 so the legacy upd.start path is skipped when the alignment has already set nextstart.
  • di/timer/init.q:75 — upd.status no longer checks maxtime: the if[(not null r[maxtime])&r[maxtime]<=rprevend;r[status]:0b] line was removed. The maxtime disable is now done in runandschedule after upd.start sets the next run, so a job whose very first prevend exceeds its maxtime is never disabled mid-run. However, the removed line was the guard that disabled the job when it ran at or past its end time (i.e., prevend >= maxtime). The replacement in runandschedule checks nextstart > maxtime (future run), which is a different condition. A job that runs exactly at maxtime now stays enabled one extra run beyond the intended cutoff, because nextstart after the last valid run equals maxtime + period > maxtime. The test at line 147 of test.csv (dt2 second run disabled) verifies nextstart falls after maxtime, so that specific case is caught, but a job configured with maxtime equal to its last prevend may behave differently. Verify the intended semantics match TorQ's original check.
  • di/timer/init.q:63 — addjob.once sets nextstart to runtime unconditionally via a direct update on the jobs table (line 65), but line 64 calls addjob.custom which for modes 1-3 already runs the alignment logic and sets nextstart (to cp[] when startattime is null, or to the aligned value for a past startattime). For a past runtime, addjob.custom will align it forward, and then line 65 overwrites that with the original past runtime — so the job fires immediately on the next tick, which matches the stated TorQ .timer.once behaviour. However, for a future runtime, addjob.custom passes startattime:runtime in opts, which sets nextstart:runtime via the startattime branch in addjob.custom — and then line 65 overwrites it again with the same value. This double-write is harmless but depends on addjob.custom's startattime path setting the identical value. The .z.m.jobs direct assignment on line 65 bypasses the 1!enlist keyed-upsert pattern used by addjob.custom; confirm .z.m.jobs and jobs resolve to the same keyed table in this module's namespace.
  • di/compression/compression.q:92 — The worker-process branch uses peach with {[x;y] compressfromtable select from x where table=y}[table;] peach distinct tabletable. Inside each worker, compressfromtablesetsstatstab::(a global assign with::) at the top — this means each worker's statstabis set independently in the worker process. However, the{statstabupdate[xfullpath;xcalgo;xcurrentsize;xcompressionvaluepre]} each tablecall after the$[…]dispatch runs on the **main** process with the full originaltable, not only the rows each worker processed. Since statstabon the main process was set by the lastpeachresult (or not at all if workers ran in separate processes),getstatstab[]on the main after a worker-processpeachmay return an empty or stale table. This is the existing behaviour carried over, but the test attest.csvline 103 asserts6=WRstats — if statstab is accumulated only on workers, this will fail unless getstatstab aggregates across workers.
  • di/torq/proc/rdb/rdb.q:68 — grabattrs is called before savefn saves the tables, but grabattrs is not defined in this diff. Ensure it captures in-memory attributes (e.g. `g# on sym) from each root table atom before savefn clears them — the comment says "capture before the clear wipes them" which is correct, but the implementation of grabattrs must run on the live in-memory table, not the on-disk path.
  • di/torq/config/config.q:106 — In getconfig, when level is 0 and the app config does not exist, appconf is set to () (empty). Then first appconf,conf returns conf (the builtin path), which is correct. But when level is 0 and appconf is non-empty (app file exists), first appconf,conf returns the app path — but appconf at this point is a symbol atom (`$approot,"/",path), not a list. Joining a symbol atom with a symbol atom via , gives a 2-item symbol list, and first of that is the app path. This works, but the return type is inconsistent: when appconf is () (empty general list) joined with conf (symbol atom), first gives a symbol atom, and the function is supposed to return a symbol list. enlist the result or ensure conf and appconf are always symbols so , gives a consistent symbol list. The test at test.csv line 79 wraps the expected result in enlist, confirming a list is expected.

…unset

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread di/torq/torq.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

0 critical | 1 warning(s) | 0 suggestion(s)

⚠️ Spec check skipped — tracker lookup failed (NO_REF_FOUND). Standards axis only.

…entries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread di/torq/torq.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

0 critical | 1 warning(s) | 0 suggestion(s)

⚠️ Spec check skipped — tracker lookup failed (NO_REF_FOUND). Standards axis only.

…set and names what it searched

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

✅ No new findings at 785d95f.

⚠️ Spec check skipped — tracker lookup failed (NO_REF_FOUND). Standards axis only.

@alowrydi
alowrydi requested a review from DI-Dexter October 28, 2026 11:21
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.

3 participants