Repository navigation
Feature chainedtp - #139
Merged
Merged
Conversation
di.torq.proc.discovery 0.1.0 repackages TorQ code/processes/discovery.q line for line (register, getservices, subs, the startup addw pass and autodiscovery push, .z.pc prune), publishing register/getservices at their legacy root names. di.torq.servers 0.3.0 -> 0.4.0 ports the client half of the protocol from code/handlers/trackservers.q at its legacy root names (.servers.*, .dotz.liveh*): addw, removerows, cleanup, retrydiscovery, autodiscovery, querydiscovery, registerfromdiscovery, addprocs, procupdate, startup and friends, with SERVERS (now carrying attributes) and the trackservers settings as root .servers.* globals. Exported API unchanged. servers.md lists each ported line, the conversions, what was not ported, and the behaviour changes. di.torq: discovery registered as a built-in; legacy STARTUP ported (torq.q l.673) so the hdb registers with discovery as legacy's does; settings/default.q carries legacy default.q's .servers values, settings/discovery.q legacy's discovery settings, settings/hdb.q startup:1b. Note: legacy defaults route every process's connections through discovery - a stack with no discovery process no longer dials process.csv peers directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legacy TorQ timer modes 0/1/2 schedule the next run from the scheduled start, the actual start and the finish (code/common/timer.q l.8-11); di.timer's 1h/2h/3h mean the same, so legacy mode n is di.timer mode n+1. d04d8d4 ported legacy's .timer.repeat (default mode 2, from finish) as di mode 2 (from actual start) for the discoveryretry and serversretry jobs. Both now use mode 3. The servers suite gains a row asserting mode 3 for both jobs; it fails against d04d8d4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… up during the wait With connections taken from discovery (the builtin default), a process started before discovery registers only a dead discovery row. waitfortype polled retry[], which skips discovery rows and never re-queries, so the rdb, wdb and feed each waited out tpwaittimeout (30s) and aborted init, left running but uninitialised. Reproduced on TorqX-POC with discovery1 last in process.csv. Each poll now calls startup ()!() (reconnect discovery, register, take the rows it names) and keeps retry[]. The servers suite gains a discovery stub that comes up after startup; the waitfortype row fails against 3c67d3c and passes here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
servers.q: the header, registered, init, opencon, timer, startup and waitfortype comments cut to one line each. servers.md: intro and init prose condensed; the .z.pc registration and conventions sections dropped (the conversions list covers the first); tests section listed. Test helper headers cut to one line. Comment and doc changes only; the servers (43), discovery (30) and di.torq (56) suites pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
discoveryregister and connectionsfromdiscovery default to 0b, so a process dials its process.csv peers directly unless the app turns discovery on. debug defaults to 0b. default.q regrouped into discovery, connections and server-record blocks with aligned one-line comments. servers.md updated to match. The di.torq suite gains a row asserting the cascaded defaults for a non-discovery proctype; it fails on the previous default.q. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DIReview Summary0 critical | 6 warning(s) | 3 suggestion(s)
Suggestions
|
DI-Dexter
reviewed
Oct 1, 2026
DI-Dexter
reviewed
Oct 1, 2026
- settings gains `enabled` -> .servers.enabled (1b), gating the discoveryretry and serversretry timer jobs (trackservers.q l.12, l.387). Lines are byte-identical to di.torq.servers 0.5.0, so feature-chainedtp inherits them. - test.csv: enabled defaults to 1b. - test.q: spawnpeer runs QBIN (the running q binary) instead of $QHOME/bin/q; QBIN is defined once in the fixture block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
di.torq.servers converts retry and discoveryretry from a timespan, a "0D00:00:10" string or a number of seconds. TOML has no timespan type, so these settings can now live in .toml files. New test rows fail on the previous code. The di.torq.servers half of c95ce2f from feature-torqx-poc-demo; the chainedtp half lives on feature-chainedtp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alowrydi
force-pushed
the
feature-chainedtp
branch
from
October 1, 2026 11:23
0c0f80c to
2f77396
Compare
DIReview Summary1 critical | 3 warning(s) | 2 suggestion(s)
Suggestions
|
This reverts commit f6788a9. Nothing in this repo sets retry or discoveryretry as a string or number, and it is outside this PR's scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chainedtp call At their legacy root names, as trackservers.q's own text in a \d .servers section: attributematch and the legacy 5-arg .servers.getservers (l.64-89), connectcustom (l.198, called from retryrows as l.184-185 does), reqprocsnotconn/reqprocnamesnotconn and startupdepcyclestypename/startupdepnamecycles (l.348-379). The exported 1-arg getservers is unchanged. enabled (l.12, default.q l.60) gates the discoveryretry/serversretry timer jobs as l.387 does. Conversions in startupdepcyclestypename: .servers.startup[] -> .servers.startup ()!(), .lg.e -> .z.m.logerr, .proc.procname -> init's identity, .os.sleep -> system "sleep ". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ackservers.q l.218) d04d8d4 inlined the result of getservers[`proctype;`discovery;()!();0b;0b] because the 5-arg function did not exist yet; 1a4ecfd ported it, so querydiscovery now makes legacy's own call (qualified as .servers.getservers - the bare name in the module is the exported 1-arg getservers). The matching deviation is dropped from servers.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Legacy TorQ code/common/pubsub.q, as its own text in a \d .stpps section at the end of pubsub.q, at its root names: .stpps state, suball/subfiltered/add/errparse/addfiltered/selfiltered/pub, delhandle/delhandlef/closesub/extractschema/init (l.9-124), root .u.sub (l.134-141) and .ps.loaded/publish/subscribe/init/initialise (l.147-151). It keeps its own state; the existing di.pubsub API and behaviour are unchanged. init takes an optional deps carrying log, used for legacy's .lg.e calls; init[] is unchanged. l.129's .z.pc binding is left to the consumer (closesub via handlers), as for di.pubsub's own. Not ported: .stpps.endp/end/pubclear/attrstrip, .u.pub, .ps.subtable*, .ds.*. Processes that load di.pubsub now carry root .stpps/.ps and a legacy .u.sub until they set their own; the tickerplant and segmentedtp set theirs after use. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…work di.subscriptions: TorQ code/common/subscriptions.q (l.5-166) as its own text in a \d .sub section at the end of subscriptions.q: SUBSCRIPTIONS, getsubscriptionhandles, updatesubscriptions, reducesubs, createtables, replay, subscribe (tptype handshake), replayupd, checksubscriptions, retrysubscription, autoreconnect, pc. The existing API is unchanged. init now requires timer and handlers, applies the autoreconnect/checksubscriptionperiod settings (default.q 0b / 0D00:00:10), and registers once per process, in every di.subscriptions user: .sub.pc on .z.pc and the checksubscriptions timer job. Deviations from TorQ's text: - .lg.o/.lg.e -> .z.m.log; .proc.cp[] -> .z.p. - .z.pc via handlers as the projection .sub.pc[::;] (an observer receives only the handle). - checksubscriptions: timespan period converted to seconds; TorQ mode 0 = di.timer mode 1. - the "timer not enabled" error branch is dropped (the timer is always injected). - once-only guard: a second init registers nothing, where TorQ's dupcheck throws. - deps.toml pins di.torq.servers 0.5.0 (.servers.getservers/enabled/connectcustom). Tests: a live check with a separate idle client and real handlers shows a peer's close marks the subscription inactive at once, with no checksubscriptions run; it fails if .sub.pc is registered bare. Comments: across servers, pubsub, discovery, settings and torq.q, comments are one line and no longer refer to TorQ sources or line numbers; test descriptions likewise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
torq.q runs .ps.initialise[] when .ps.loaded is set, directly before the STARTUP line, as TorQ's torq.q l.670-673 does. Processes that load di.pubsub (tickerplant, segmentedtp) now fill the .stpps state at startup; nothing in them reads it. settings/chainedtp.q: TorQ's config/settings/chainedtp.q as flat keys (tickerplantname, pubinterval, tpconnsleep, createlogfile, logdir, subscribeto, subscribesyms, replay, schema, clearlogonsubscription, tpcheckcycles, connections, startup). Its .hb/.usage lines are not carried: di has no heartbeat reader, and [querylog] is already off unless enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module is rebuilt from TorQ's code/processes/chainedtp.q, as its own text in TorQ's order: root tptype/tablelist/subdetails; the .ctp settings and state; clearlog, openlog, subscribe, writetolog, tickpub, batchpub, publishalltables, tableschemas, cleartables, createlogfilename, refreshtp, notpconnected, sub; and .u.end. init runs TorQ's load-time statements in order (l.155 .z.pc, l.160 .ctp.upd, l.194 root upd, l.197 .ps.initialise, l.200 startupdepnamecycles, l.203 subscribe, l.206 tableschemas, l.209 batch timer), after wiring di.pubsub, di.subscriptions and .stpps.closesub as TorQ's common-code loading does. The previous module and its integration tests are removed. Deviations from TorQ's text: - .lg.o/.lg.e -> .z.m.log; .proc.procname -> config's procname. - l.155 .dotz.set on .z.pc -> a handlers observer taking only the handle (logs, then exit 0). - l.194 root upd:.ctp.upd -> set[`upd;.ctp.upd]. - l.209 .timer.rep -> timer addjob, period in seconds, TorQ mode 1h = di.timer mode 2. TorQ's timer runs sub-second; di.timer's period is whole seconds, so a pubinterval that is not a whole number of seconds fails init rather than rounding. - the .ctp setting guards stay as written; init applies config values over them. Kept as TorQ has it: a corrupt own log is reported and opened anyway; upd is set only if absent; tpcheckcycles 0W waits for the upstream indefinitely; only .u.end is defined, so a segmented upstream (which sends endofday) never ends the day here; .u.icounts values are one-item lists after an all-syms subscribe. Tests: a real upstream (segmented surface, found through di.torq.servers) and a real downstream: subscribe and schema, tick-by-tick delivery, subdetails, tablelist, .u.end, the own log, batch publish, clearlogonsubscription, a corrupt log, and pubinterval validation. Live: discovery -> segmentedtp -> chainedtp -> a .sub subscriber; data reached the subscriber; .u.end, invoked by hand on the chainedtp (the segmented upstream never sends it), reached the subscriber and rolled the date; stopping the upstream made the chainedtp log and exit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…protocol layer End of day follows the rdb/wdb convention: .u.end sends (`endofday;d) to subscribers rather than (`.u.end;d), and root endofday[d] calls .u.end d. This is the one change to the ported legacy text, made on request: there are no legacy subscribers, and the di rdb/wdb only answer endofday (their .u.end alias, @[`.;`.u.end;:;endofday], does not resolve once a .u namespace exists). Temporary compatibility block (between / compat begin and / compat end), so chainedtp sits between the di tickerplant and di rdb/wdb, which speak di.subscriptions' .u.subdetails protocol: - upstream: init calls .ctp.subscribedi[] instead of .ctp.subscribe[] (the only other changed line). Same handle lookup and refreshtp, then di.subscriptions subscribe, then .u.d from the reply. - downstream: root .u.subdetails[tabs;syms] subscribes the caller through .ctp.sub and returns tables/schemas/logfile/rowcount/date. It handles the single-table pair shape. Limits: logfile is ` and rowcount 0 (no replay from chainedtp); .u.icounts starts empty; .sub.SUBSCRIPTIONS is not filled on this path; unknown-table error pairs pass through. chainedtp.md lists the removal steps. Tests: a compat: group with a real di.subscriptions subscriber peer, and a fixture upstream that also answers .u.subdetails. The legacy .sub path is still exercised by an explicit .ctp.subscribe[] row. Test peers answer endofday. 63/63; di.torq 56/56. Verified live on a scratch POC: feed -> tickerplant1 -> chainedtp1 -> rdb1/wdb1 -> hdb/gateway. Counts matched at each hop, and the gateway count equalled rdb plus hdb. A forced endofday on the tickerplant saved the partition into the hdb and reloaded the hdb and rdb. This needs hdb and gateway started before wdb. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With createlogfile on, subscribers replay chainedtp's log on connect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h QBIN - di.pubsub init errors unless deps is a dict with log, so .stpps errparse/init/sub always have a logger (a missing log no longer surfaces as a .z.m.log error). - di.torq.proc.tickerplant passes its log to di.pubsub init. - pubsub tests: init with a no-op log; init[] must error. - servers test.csv: the enabled:0b check runs QBIN, not $QHOME/bin/q. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The di.subscriptions subscribe and root .u.subdetails are now the only path, so the tests check them in place of .sub and the old subdetails, the test upstream drops its segmented-tickerplant surface, and the compat labels and the temporary-layer section in chainedtp.md go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alowrydi
force-pushed
the
feature-chainedtp
branch
from
October 1, 2026 11:44
2f77396 to
0c95f36
Compare
DIReview Summary1 critical | 5 warning(s) | 2 suggestion(s)
Could not be posted inline
Suggestions
|
DI-Dexter
previously approved these changes
Oct 2, 2026
DIReview Summary1 critical | 4 warning(s) | 4 suggestion(s)
Suggestions
|
DI-Dexter
approved these changes
Oct 2, 2026
alowrydi
added a commit
that referenced
this pull request
Oct 2, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Adds di.torq.proc.chainedtp (0.2.1), a one-to-one port of TorQ's chainedtp.q, plus the legacy surface it depends on that didn't exist yet: di.torq.servers (→ 0.5.0, the 5-argument getservers and related client-side pieces), di.pubsub (→ 0.2.0, a .stpps/.ps legacy section appended alongside its existing API, unused by anything else), di.subscriptions (→ 0.2.0, a .sub legacy section, same pattern).
Includes a temporary, clearly marked compat layer (/ compat begin … / compat end in chainedtp.q) letting chainedtp bridge to the current di-native tickerplant/rdb/wdb, which don't yet speak legacy's own handshake. Both real legacy functions (subscribe, subdetails) are left untouched alongside it — the compat block is additive and removable without touching ported code. Removal is blocked on the tickerplant gaining real legacy surface and rdb/wdb moving to .sub, tracked separately.
NOTE: contains an early commit from feature-rediscovery, so review that PR first before this one.