Repository navigation
TorqX consolidation: orchestration, process and query tier - #128
Merged
Merged
Conversation
Merges the TorqX framework tier into kdbx-modules as the consolidation base,
per RFC-0001 (docs/rfc-0001-torqx-kdbx-consolidation.md).
Adds:
- di.torq - the orchestrator replacing torq.q, plus its children
di.torq.{servers,logroll} and the launcher at di/torq/bin (torqx.sh,
torqx_init.q)
- di.proc.{hdb,rdb,wdb,tickerplant,gateway} - the process types
- di.subscriptions, di.dataaccess, di.tplogmgr - library tier
- di.asyncdispatch, di.serverselect - tracked from their feature branches
- CLAUDE.md, plus framework/DI sections appended to consistency.md and style.md
- docs/reconciliation/*.md - per-module decision records
Moves five modules into the agreed namespace hierarchy (RFC-0001 D1):
di.toml -> di.util.toml
di.config -> di.torq.config
di.log -> di.util.log
di.handlers -> di.torq.handlers + a `transform` phase (result-rewriting,
pre -> exec -> transform -> post; existing phases untouched)
di.depcheck -> di.torq.depcheck + hierarchy-aware namespace resolution, a
pre-load on-disk VERSION manifest graph, and the di.timer
contract aligned to the five keys di.torq consumes
Each is the upstream implementation plus the additions recorded in
docs/reconciliation/. References updated repo-wide.
di.dbwrite, di.eodtime and di.pubsub gain a VERSION file and a `version`
export: consumer manifests declare them, and di.torq.depcheck validates both a
pre-load VERSION graph and a post-load session audit.
Verified: 20 k4unit suites, 1327 checks, 0 failures, each in its own process;
and the full stack boots and runs end to end - tickerplant -> rdb/wdb
streaming, EOD writedown/sort/move into the hdb with rdb reload, and gateway
scatter-gather plus getdata map-reduce across rdb and hdb.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
The diff is too large to review automatically (estimated 167,450 tokens, limit 90,000). |
jonnypress
approved these changes
Sep 9, 2026
Merged
alowrydi
added a commit
that referenced
this pull request
Oct 23, 2026
…ach di.eodtime intact eoddeps amended keys into enlist[`log]!enlist logdep, whose values are a one-row table, so each added value became a row of the log dict and di.eodtime's init threw 'type: any timezone or roll-offset setting stopped the tickerplant starting. Build the extra keys with joins and join log first, as segmentedtp.q:29. From #128. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alowrydi
added a commit
that referenced
this pull request
Oct 23, 2026
…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>
alowrydi
added a commit
that referenced
this pull request
Oct 29, 2026
* di.eodtime: read the clock once in getdailyadjustment
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>
* di.pubsub: read the filters column TorQ sends in filtered subscriptions
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>
* di.merge: restore TorQ merge.q failure and attribute behaviour
- 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>
* di.timer: log failed jobs through the injected logger; jobs reschedule 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>
* di.timer: store params as a list, disable at maxtime and rescan as TorQ'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>
* di.timer: add addjob.once and removefunc, as TorQ's .timer.once and .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>
* di.torq.servers: add startupdepcycles and startupdependent, as TorQ's trackservers.q
reqproctypesnotconn and the two root projections on startupdepcyclestypename,
alongside the existing startupdepnamecycles.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq.config: run its test fixtures under a per-run directory
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>
* di.timer: timespan periods, mode and dupcheck checks, legacy first-run 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>
* di.torq: stamp q's -t interval into config as timerms
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>
* di.torq.proc.segmentedtp: batch every -t ms, as TorQ's .z.ts
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>
* di.torq.proc.chainedtp: accept a sub-second pubinterval, as TorQ's chainedtp
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>
* di.torq.proc.tickerplant: -t decides batched or immediate, as TorQ's 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>
* di.dbwrite: savedown hooks and TorQ's default sort, as dbwriteutils.q
- 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>
* di.torq.proc.wdb: save down hooks through di.dbwrite; postreplay unprotected, 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>
* di.torq.proc.tickerlogreplay: save down hooks through di.dbwrite, read 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>
* di.torq.proc.rdb: save down hooks through di.dbwrite; keep g# after the 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>
* di.compression: worker processes compress a table each, as TorQ #732; 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>
* di.torq.proc.housekeeping: TorQ's job csv format and action names; rm 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>
* di.torq.servers: addh, refreshattributes, gethpbytype, root gethandlebytype 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>
* di.eodtime: readers for the roll and data timezone and roll offset, as 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>
* di.torq.config: getconfig and getconfigfile over the two roots, as TorQ'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>
* di.torq, di.torq.config: -parentproctype tier for settings and app code, 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>
* di.torq.proc.gateway: getdata behind the eod reload gate; log line says 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>
* di.torq.proc.gateway: single-type queries run during the eod reload, 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>
* di.torq.servers: test fixture on OS-assigned ports with a listener check
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>
* di.torq.proc.tickerplant: upd rolls the day first when past the roll, 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>
* di.torq.proc.tickerlogreplay: upd and save down hooks from config, as 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>
* di.torq.proc.wdb: doc, sortcsv fallback is di.dbwrite's sym-then-time p# default
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.dbwrite: doc, built-in default sort is p# on sym, sorted by sym then time
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq.proc.tickerplant: rolltimezone/datatimezone/rolltimeoffset reach di.eodtime intact
eoddeps amended keys into enlist[`log]!enlist logdep, whose values are a
one-row table, so each added value became a row of the log dict and
di.eodtime's init threw 'type: any timezone or roll-offset setting stopped
the tickerplant starting. Build the extra keys with joins and join log
first, as segmentedtp.q:29. From #128.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq.proc.gateway: synccallsallowed reaches di.asyncdispatch as a 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>
* di.torq.proc.gateway: fixture rows no longer depend on the time of day
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>
* di.subscriptions: checksubscriptionperiod accepts TOML values
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq.proc.tickerplant: rolltimeoffset accepts TOML values
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq.proc.segmentedtp: [eodtime] section accepts TOML values
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq: find the framework checkout through QPATH when TORQXHOME is unset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq: frameworkhome searches where use does, skipping empty QPATH entries
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* di.torq: frameworkhome skips the $QHOME/mod fallback when QHOME is unset and names what it searched
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merges the TorqX framework tier into kdbx-modules as the consolidation base, per RFC-0001 (docs/rfc-0001-torqx-kdbx-consolidation.md).
Adds:
Moves five modules into the agreed namespace hierarchy (RFC-0001 D1):
di.toml -> di.util.toml
di.config -> di.torq.config
di.log -> di.util.log
di.handlers -> di.torq.handlers + a
transformphase (result-rewriting,pre -> exec -> transform -> post; existing phases untouched)
di.depcheck -> di.torq.depcheck + hierarchy-aware namespace resolution, a
pre-load on-disk VERSION manifest graph, and the di.timer
contract aligned to the five keys di.torq consumes
Each is the upstream implementation plus the additions recorded in docs/reconciliation/. References updated repo-wide.
di.dbwrite, di.eodtime and di.pubsub gain a VERSION file and a
versionexport: consumer manifests declare them, and di.torq.depcheck validates both a pre-load VERSION graph and a post-load session audit.Verified: 20 k4unit suites, 1327 checks, 0 failures, each in its own process; and the full stack boots and runs end to end - tickerplant -> rdb/wdb streaming, EOD writedown/sort/move into the hdb with rdb reload, and gateway scatter-gather plus getdata map-reduce across rdb and hdb.