Repository navigation
di.util.cfg: one implementation of the shared config helpers - #150
Conversation
apphome, datahome and resolvedir were copied byte-for-byte into di.torq.proc.rdb, .tickerplant, .wdb and .housekeeping (which named its copy resolvepath). asbool and aslong are duplicated the same way. Raised in review on DataIntellectTech#149. Adds di.util.cfg holding one copy of each, and binds it in the four modules at load time so call sites are unchanged: cfg:use`di.util.cfg; apphome:cfg`apphome; datahome:cfg`datahome; resolvedir:cfg`resolvedir; Two things found while consolidating: - resolvedir signalled 'type on a single-character relative path. "x" is a char ATOM, so `like` was applied to an atom rather than a string. All five copies had it. Fixed with (), and covered by a test. - asbool read only "1" as true, so a quoted setting of "true" meant false. It now takes true/false/1/0 in any case and errors otherwise. NOT folded in here: di.permissions and di.torq.proc.compression also carry copies, but both are changed on the DataIntellectTech#149 branch and would conflict. They follow once that merges. di.torq.proc.hdb has its own single-argument resolvedir with different semantics - left alone deliberately. Seven suites green; the POC stack starts clean with data flowing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
| asbool:{[x] | ||
| if[-1h=type x;:x]; | ||
| if[-7h=type x;:0<>x]; | ||
| if[10h<>abs type x;:0b]; |
There was a problem hiding this comment.
When x is not a boolean, long, or string (e.g. it is a symbol atom like `true), the guard if[10h<>abs type x;:0b] silently returns 0b instead of erroring. The doc says "anything else is an error", but a symbol or other non-string type falls through this guard and returns a silent false. The guard should signal an error for any unrecognised type, not return 0b.
DIReview Summary0 critical | 1 warning(s) | 0 suggestion(s)
|
DIReview on DataIntellectTech#150 noted a symbol fell through the type guard to a silent 0b, contradicting the doc. Correct, and the symbol is not the worst case: asbool 1i -> 0b an int 1 read as FALSE asbool 1h -> 0b asbool 1f -> 0b asbool `true -> 0b asbool (::) -> 0b So a .q settings tier writing enabled:1i disabled the thing it was enabling, silently - the same class of bug as the quoted "true" already fixed here, and likelier to be hit. Numeric atoms (short/int/long/float) are now accepted, nonzero being true. Every other type errors, naming the type. Tested across all of them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DIReview Summary0 critical | 0 warning(s) | 1 suggestion(s)
Suggestions
|
Carries the same fix made on DataIntellectTech#150 into the two copies this branch still owns, so DataIntellectTech#149 does not ship a known silent-false. DIReview raised it against di.util.cfg: a value that is not a boolean, long or string fell through the type guard to 0b. The symbol case it named is not the worst one: asbool 1i -> 0b an int 1 read as FALSE asbool 1h -> 0b asbool `true -> 0b asbool (::) -> 0b In di.permissions that meant a .q settings tier writing enabled:1i left access control off with no warning. Numeric atoms are now accepted, nonzero being true; every other type errors, naming the type. Both copies are superseded by di.util.cfg once DataIntellectTech#150 and this merge. Three suites green; the POC stack starts clean and still enforces. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DIReview on DataIntellectTech#150: the type list included float (-9h) but not real (-8h), which is an arbitrary gap, and type[x] was inconsistent with the (type x) form used elsewhere in the file. Both fixed - the list is now -4h..-9h, every numeric atom, with nonzero true. The review's premise is not right, for the record: the original did NOT accept any numeric via 0<>x. Measured, it took long alone - orig 1 -> 1b orig 1i -> 0b orig 1h -> 0b orig 1f -> 0b orig 1e -> 0b so int, short, float and real were all silent falses. This widens acceptance rather than narrowing it; the only values that now error are ones that previously returned a silent 0b. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Carries the DataIntellectTech#150 follow-up into the two copies this branch owns: the type list now covers -4h..-9h rather than omitting real (-8h) while accepting float, and uses (type x) to match the form used elsewhere. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DIReview Summary0 critical | 0 warning(s) | 1 suggestion(s)
Suggestions
|
DIReview on DataIntellectTech#150: -4h is in the numeric guard and the doc says "byte through float", but no test exercised a byte. Keeping -4h deliberately - excluding it would reintroduce the arbitrary gap this list was widened to remove - so the test is what was missing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DIReview Summary✅ No new findings at
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DIReview Summary0 critical | 0 warning(s) | 1 suggestion(s)
Suggestions
|
alowrydi
left a comment
There was a problem hiding this comment.
Thanks Dexter - one copy of these is the right call. Approving.
Verified
- Suites green on this branch: di.util.cfg 31/31, rdb 11/11, wdb 83/83, tickerplant 70/70, housekeeping 102/102.
- Merged with #149 on current main: no conflicts, and those plus compression, permissions, di.torq, di.compression and depcheck all green.
- Started the TorqX-POC stack (POC #8) on #149 + #150: every process up, depcheck 0 failures everywhere, so the transitive check covers
di.util.cfgwithout the POC declaring it. - The four call sites bind at load time with the same behaviour. The
(),added inresolvedironly makes a one-char string work. Leaving hdb's and logroll's one-argumentresolvediralone is right - different semantics.
Independent of #149 - either can merge first.
* di.compression: stamp a VERSION The module shipped without one, so depcheck reports any module declaring a dependency on it as "has no VERSION file" and fails the pre-load version graph. di.torq.proc.compression needs to declare that dependency. 0.1.0 - a first stamp for the module as it stands, not a behaviour change. * di.torq.proc.compression: one-shot hdb compression process type Ports TorQ's code/processes/compression.q and config/settings/compression.q. The compression engine itself was already ported as di.compression; this is the process wrapper around it - config resolution, hdb path validation and the one-shot lifecycle - plus the framework settings tier and an entry in di.torq's built-in proctype registry, without which the proctype cannot start at all. The pass runs from di.torq's runhook as .compression.run[], not from init: init must not exit, since torqx.sh owns the process lifecycle. Keeping the pass in its own .compression.compressnow[] leaves it re-triggerable over IPC without terminating the process - the same split di.torq's sample loader uses. A hdbpath that does not exist is refused at init. Without that the partition traverse returns nothing and the run reports success having compressed zero columns, which reads exactly like a correct no-op. Documents one inherited divergence, not changed here: di.compression's loadcsv traps its own checkcsv, so an invalid algorithm is logged and the run continues, where TorQ lets it throw and abort. The suite asserts the current behaviour so that changing it fails deliberately. Tests build a real two-partition hdb and assert with -21! that the configured column is compressed and an unconfigured one is not. * di.torq.proc.compression: address review on #149 1. Trim comments to concise what-only, matching #148's repo-wide pass. 47 comment lines -> 13. The rationale already lives in compression.md. 2. Derive the test fixture's partitions from .z.D. They were fixed at 2026.01.01/02, so from 2027.01.02 they fall outside the maxage window and the compression assertions would have started failing. 3. Ship maxage 30, not 365. TorQ's code default is 365 but its config/settings/compression.q sets 30, so a stock TorQ process scans 30 days - 365 was a parity miss. Recorded in "Migrating from TorQ". 4. Actually assert the code defaults. The comments claimed the tests checked them; nothing did. Both are now asserted from the init log after an init that supplies neither. Also: - add a partition outside the maxage window and assert it is left alone - csvpath's unreachable code default used TORQXAPPCONFIG while the shipped setting resolves under TORQXAPPHOME; both now use TORQXAPPHOME - compression.md's process.csv example had startwithall=1, which would rewrite the hdb on every stack start - torq.md's two proctype lists did not mention compression - the toml test rows recompressed already-compressed files and passed native types, so the string branches never ran; the fixture is rebuilt first and maxage/exitonfinish are passed as text Four suites green; the process still boots and exits on the POC stack. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * address the remaining review items on #149 6. Ship a default compression csv (di/torq/compressionconfig.csv, the same default,10,default,1,16,0 TorQ ships) and fall back to it when the app has none. Previously an app without its own csv failed. 8. asbool read only "1" as true, so a quoted exitonfinish = "true" in a toml silently meant false. It now accepts true/false/1/0 in any case and throws on anything else rather than guessing. Fixed in di.permissions too, where the same copy meant a quoted enabled = "true" would have left access control off with no warning. 10. init resolved and assigned module state before validating the hdb path, so a failed init left initialised[] true and compressnow died on an unset .z.m.cmp. Everything is resolved into locals and validated first. 12. A pass that logged errors exited 0, which for a scheduled batch job reads as success. The injected error logger is now counted and run exits 1 if the pass logged any. errorcount is exported. 14. di/torq VERSION 0.5.0 -> 0.6.0, since the built-in registry gained a proctype. di.permissions 0.1.0 -> 0.2.0 for the asbool change. Tests cover the framework-csv fallback, the bad-boolean refusal, the error count, and the toml path now passes "true"/"false" as text rather than native types, so the string branches actually run. Six suites green; the POC stack starts clean and still enforces permissions. * error on any type asbool cannot read Carries the same fix made on #150 into the two copies this branch still owns, so #149 does not ship a known silent-false. DIReview raised it against di.util.cfg: a value that is not a boolean, long or string fell through the type guard to 0b. The symbol case it named is not the worst one: asbool 1i -> 0b an int 1 read as FALSE asbool 1h -> 0b asbool `true -> 0b asbool (::) -> 0b In di.permissions that meant a .q settings tier writing enabled:1i left access control off with no warning. Numeric atoms are now accepted, nonzero being true; every other type errors, naming the type. Both copies are superseded by di.util.cfg once #150 and this merge. Three suites green; the POC stack starts clean and still enforces. * accept every numeric atom, not an arbitrary five Carries the #150 follow-up into the two copies this branch owns: the type list now covers -4h..-9h rather than omitting real (-8h) while accepting float, and uses (type x) to match the form used elsewhere. * aslong: error on unparseable values; tidy comments A malformed maxage compressed nothing and exited 0; a malformed maxsize refused every query. aslong now errors, as wdb's tolong does.
Raised in review on #149, item 13.
apphome,datahomeandresolvedirare copied byte-for-byte into four process modules (di.torq.proc.rdb,.tickerplant,.wdb, and.housekeeping, which names its copyresolvepath).asbool/aslongare duplicated the same way.This adds
di.util.cfgwith one copy of each, and binds it at load time so call sites are unchanged:Three lines per module instead of rewriting every call — which keeps the diff reviewable and the behaviour identical.
Deliberately not in scope
di.permissionsanddi.torq.proc.compressionalso carry copies, but both are modified on the di.torq.proc.compression: one-shot hdb compression process type #149 branch and would conflict. They fold in once that merges.di.torq.proc.hdbhas its own single-argumentresolvedirwith different semantics (returns a symbol, always resolves underdatahome). Not a duplicate — left alone.Testing
Seven suites green:
di.util.cfg,di.torq.proc.rdb,.tickerplant,.wdb,.housekeeping,di.torq,di.torq.depcheck.Verified end to end on the TorqX-POC stack — all ten processes init, and data flows through the wdb into the idb (
wdb trade: 411 idb trade: 964844).VERSION bumps and
deps.tomlentries for all four consumers.