Skip to content

Feature chainedtp - #139

Merged
alowrydi merged 20 commits into
mainfrom
feature-chainedtp
Oct 2, 2026
Merged

alowrydi merged 20 commits into
mainfrom
feature-chainedtp

Conversation

@alowrydi

Copy link
Copy Markdown
Collaborator

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.

alowrydi and others added 5 commits September 25, 2026 14:34
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>
Comment thread di/pubsub/pubsub.q Resolved
Comment thread di/pubsub/pubsub.q Resolved
Comment thread di/torq/servers/servers.q Resolved
Comment thread di/torq/servers/servers.q Resolved
Comment thread di/torq/settings/default.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

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

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

Suggestions

  • di/subscriptions/subscriptions.q:30 — .sub.checksubscriptionperiod is compared with >0 (a long integer), but it is typed as a timespan (0D00:00:10 default). In q, comparing a timespan to a long integer (0) may produce a type error at runtime. The comparison should use a timespan zero: >0D00:00:00 or convert explicitly with `long$. The same pattern appears at the .sub namespace initialisation line (checksubscriptionperiod:(not …)*@[…]) where a boolean multiplied by a timespan yields a long, changing the type.
  • di/torq/proc/chainedtp/chainedtp.q:57 — .ctp.subscribe (line ~57 in the new .ctp section) calls .sub.getsubscriptionhandles and on success assigns .ctp.tph:subprocw, then calls refreshtp @[tph;…]. The @[tph;…]is a remote synchronous call using the handle symbol.ctp.tph, not the integer handle subprocw. If .ctp.tph is the integer handle, @[tph;…] resolves the name tph in the local namespace rather than using the global .ctp.tph. This will either use a stale value (the prior .ctp.tph) or fail if tph is not defined locally. Fix: use the explicit path @[.ctp.tph;…] or bind a local h:.ctp.tph first.
  • di/torq/proc/chainedtp/chainedtp.q:103 — In .ctp.openlog, after counting existing messages with -11!, the result is assigned to .u.i:.u.j:@[-11!;lgfile;-11!(-2;lgfile)]. The fallback -11!(-2;lgfile) is the byte-count form, not the message-count form, so on a corrupt log it returns a 2-item list (goodcount;goodbytes) rather than a message count integer. This means .u.i would be set to a 2-item list on corruption, breaking all subsequent +:1 increments. The error log says "is corrupt" but still calls hopen lgfile — opening a corrupt log without recovering its good prefix means subsequent appends will corrupt it further. Fix: use first on the -11!(-2;…) fallback result, and do not open a corrupt log for writing without recovery.

Comment thread di/torq/servers/servers.q Resolved
Comment thread di/torq/settings/default.q Resolved
alowrydi and others added 2 commits October 1, 2026 11:27
- 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>
Comment thread di/subscriptions/subscriptions.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

1 critical | 3 warning(s) | 2 suggestion(s)

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

Suggestions

  • di/subscriptions/subscriptions.q:33 — The lowpowermode guard multiplies the config value by a boolean: (not @[value;.proc.lowpowermode;0b])*configchecksubscriptionperiod. If lowpowermode is true this yields 0*timespan which is 0D (a zero timespan), and the subsequent if[.sub.checksubscriptionperiod>0;...] in init then skips registering the timer job — that is the intended behaviour. However 0b*0D00:00:10 is type-mixing a boolean with a timespan; the result type depends on q's promotion rules for boolean × timespan which are UNVERIFIED. If the multiplication is not defined, this will throw at runtime when lowpowermode is 1b.
  • di/torq/proc/chainedtp/chainedtp.q:49 — .ctp.pubinterval is validated with 0<>(long$.ctp.pubinterval) mod 1000000000— buttotimespancan return0Nn(null timespan) when none of its type branches match. A null timespan cast to long is0Nj, and 0Nj mod 1000000000is0Nj, which is not equal to 0, so the guard passes silently on an unrecognised pubintervalvalue and0Nnpropagates into the timeraddjob` call at line 56.

alowrydi and others added 8 commits October 1, 2026 12:43
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>
alowrydi and others added 4 commits October 1, 2026 12:43
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>
Comment thread di/pubsub/pubsub.q Resolved
Comment thread di/torq/servers/servers.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

1 critical | 5 warning(s) | 2 suggestion(s)

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

Could not be posted inline

  • WARNING di/subscriptions/subscriptions.q:37 — .sub.AUTORECONNECT default is set at load time from @[value;AUTORECONNECT;1b](line 88), defaulting to1b. The initfunction only updates it whenautoreconnect in key config(line 30). Thedi/torq/settings/default.qsetsautoreconnect:0bas the framework default, but the.subnamespace default at load time is1b. If initis called with a config that does not containautoreconnect(e.g. the empty dict in tests),.sub.AUTORECONNECTretains1b. The test at line 34 of test.csvasserts.sub.AUTORECONNECTis1bafterinit[()!();deps[]], confirming this is the current load-time default — but it contradicts default.q's autoreconnect:0b. When the framework cascade runs and passes autoreconnect:0bin config,initwill override it correctly; the conflict only matters in bare/test scenarios, but the test asserting1b` may mask a real discrepancy.

Suggestions

  • di/torq/proc/chainedtp/chainedtp.q:100 — .ctp.openlog counts existing messages by calling -11! on the log file (effectively executing it via the fallback path). The code sets a temporary root upd that only updates .u.icounts, then restores the old upd after calling -11!. However, the count path on line 100 is @[-11!;lgfile;-11!(-2;lgfile)]: the first branch tries -11!(lgfile) (execute), and only on failure falls back to -11!(-2;lgfile) (count without execute). This means on a non-corrupt log, -11!lgfile will execute every message through the temporary upd that only updates .u.icounts, not the real upd. Any side effects of replay (e.g. inserting into root tables) are skipped, but the log IS executed. If the real upd is expected not to fire during this counting pass, the logic is inverted: the counting branch should be tried first (with -11!(-2;file)) and execution only as a fallback, not the other way around.
  • di/torq/proc/chainedtp/chainedtp.q:127 — .ctp.refreshtp calls @[value;.u.l;0]to check if the log handle is open, then usesif[0<=type .u.i;...]to detect a corrupt/atom.u.i. The condition 0<=type .u.iis true for every non-negative type including 0h (mixed list) and table types — it only excludes negative types (atoms). Since.u.iis assigned from-11!(-2;lgfile)which returns a count (a long atom, type -7h) on success, a successful open produces a negative type and0<=type .u.iwould be0b, meaning the error branch is NOT taken. On a corrupt file, -11!may return a pair (type 0h or 7h), so0<=typewould be1b. This logic appears correct but is fragile and unintuitive: the existing comment says "is corrupt" but the condition 0<=typeon the result of-11!(-2;file)tests the pair-vs-atom shape, not directly a corruption flag. More critically, after a corrupt log is "opened anyway",.u.lis set tohopen lgfile` which opens the corrupt file for append — future writes will append after the corrupt bytes rather than starting from the good prefix.

DI-Dexter
DI-Dexter previously approved these changes Oct 2, 2026
Comment thread di/pubsub/pubsub.q Resolved
Comment thread di/subscriptions/subscriptions.q Resolved
Comment thread di/torq/servers/servers.q Resolved
@DI-Software-Engineering

Copy link
Copy Markdown

DIReview Summary

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

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

Suggestions

  • di/pubsub/pubsub.q:178 — .stpps.subrequestfiltered upsert inside addfiltered is issued from within the \.d .stpps block, but a use-loaded module runs in a private namespace. The upsert target is the symbol `.stpps.subrequestfiltered, which is an explicit root path and should land at root — however the eval two lines above evaluates the filter query against .stpps.schemas[x], which is a root symbol. If .stpps.schemas is not yet populated at the call site, the eval will fail silently or use a wrong value. More critically, selfiltered (line 183) also does `.stpps.subrequestfiltered upsert but the filts it builds uses enlist enlist (in;`sym;enlist y) where y is already a sym list — wrapping in enlist twice before passing to the functional select means filts is a 1-element list of a 1-element list, which is the correct shape for where clauses. However, if y is a single symbol atom (not a list), enlist y produces a 1-element list, which is correct. But .stpps.subfiltered dispatches to selfiltered when type y is 11h (symbol list) but to addfiltered when type y is 99h (dict); a plain symbol atom has type -11h, which is neither 11 nor 99, so it falls to addfiltered. In addfiltered, y[x;filters]indexes a symbol atom with[sym;filters] — a sym atom is not a dict, so this throws a type error. The dispatch [11 99h;...] does not cover a plain sym atom (-11h), leaving that case unhandled.
  • di/pubsub/pubsub.q:196 — pub sends to all-data subscribers with -25! (async broadcast): -25!(h;(upd;t;x))wherehis a list of handles. If any handle inhis dead (process gone without.z.pcfiring),-25!will throw, dropping the message for all remaining handles in that batch. This is a pre-existing issue in the module but is now explicitly part of the new.stppsAPI surface. The per-subscriber filtered publish on lines 199-201 usesneg[selshandle] (single async send), which isolates failures per-subscriber. The all-data path has no equivalent isolation.
  • di/torq/proc/chainedtp/chainedtp.q:163 — In .u.end, the expression union[@[value;(.stpps.allsubhandles;);()]; @[{union/[(value x)[;;0]]};.u.w;()]]attempts to get all subscriber handles. The second branch@[{union/[(value x)[;;0]]};.u.w;()] indexes (value .u.w)[;;0] — value of a dict returns its values, and [;;0] takes the first element of each value. .u.w is a dict keyed by table symbol where each value is a list of handles. So (value .u.w)[;;0] would give the first handle for each table, not all handles. The correct idiom to get all handles from .u.w is distinct raze value .u.w. Using [;;0] on a list of handle lists would index each list at position 0, giving only the first subscriber per table.
  • di/torq/proc/chainedtp/chainedtp.q:68 — (usedi.subscriptions)[subscribe][tph;subscribeto;subscribesyms;replay] is called inside .ctp.subscribe[] (line 128), but the use call here re-loads or re-fetches the module. Inside a module loaded with use, calling use again on a dependency from within a function body is the correct pattern. However, .ctp.subscribe is called during init at line 66 after (usedi.subscriptions)[init][config;deps] — these are two separate use calls and may or may not return the same module object depending on the framework. If they return different objects, the second used module's state (including the registered subscriptions table) will be separate from the first. The test on line 31 of test.csv asserts 1=count (usedi.subscriptions)[getsubscriptions][] — a third use call — which would only pass if all three resolve to the same stateful module object. This is a framework assumption that is not documented here as safe.

@alowrydi
alowrydi merged commit 69d94d8 into main 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>
@DI-Dexter DI-Dexter mentioned this pull request Oct 15, 2026
@alowrydi
alowrydi deleted the feature-chainedtp branch October 16, 2026 13:16
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