Repository navigation
di.torq.proc.gateway - syncexec syncexecj calls added to gateway - #170
DanielPyper wants to merge 2 commits into
Conversation
| asyncexec:{[query;servertype] asyncexecjpt[query;servertype;raze;();0Wn]} | ||
|
|
||
| / client entry point .gw.syncexecj: deferred-sync reply; rejections are signalled as errors | ||
| syncexecj:{[query;servertype;join] |
There was a problem hiding this comment.
The permissioned guard references .z.m.permissioned and calls permitted[u;query], but neither of these symbols appear to be set up anywhere in the diff. syncexecj is a new entry point added in this diff, and if the permission infrastructure is not initialised in the module's init path (which is not shown as changed here), .z.m.permissioned will be undefined and the guard will throw at runtime. Verify that .z.m.permissioned is populated during init (the same way asyncexecjpt guards it, if it does).
There was a problem hiding this comment.
permissioned and permitted "not set up" (not valid)
- Both exist. permitted is defined at the top of gateway.q, outside the diff, and init sets .z.m.permissioned (.z.m.permissioned:$[permissioned in key config;boolean$configpermissioned;0b]`). The bot only saw the diff.
- syncexecj uses them exactly as asyncexecjpt does, so it's no riskier than the existing async path.
- It was also exercised live: the POC gateway runs with permissioned = true, and syncexec returned correct results as torqx.
| true,0,0,q,0 0~S3`sent,1,,and nothing is sent | ||
| run,0,0,q,S4:gwsync(`.gw.syncexec;"count trade";`hdb),1,,syncexec to the hdb alone during the reload | ||
| true,0,0,q,(enlist 2)~S4`res,1,,a single-type syncexec runs during the reload | ||
| true,0,0,q,0 1~S4`sent,1,,and is sent to the hdb only |
There was a problem hiding this comment.
The test at line 70 (S5) expects the error message "syncexec: synchronous calls are not allowed" when synccallsallowed is off, but syncexec delegates directly to syncexecj via syncexecj[;;raze], and syncexecj itself calls (.z.m.adexecquery)which isdi.asyncdispatch's execquery. The error text "syncexec: synchronous calls are not allowed"would be produced insidedi.asyncdispatch— if that module's error text differs, the test will fail. Additionally, the test manually sets.m.di.0asyncdispatch.synccallsallowed:0b` directly in the gateway's private namespace (line 69); if the asyncdispatch module reads this flag under a different internal path the override silently has no effect.
There was a problem hiding this comment.
S5 error text and the private-namespace override (not valid)
- Error text: the text is produced in di.asyncdispatch's execquery (asyncdispatch.q line 254) and matches the test's literal string exactly. The test passed, so it's not a mismatch.
- Namespace override: the path .m.di.0asyncdispatch.synccallsallowed is already used by existing gateway rows, and init rows 16–18 of test.csv read it back. The override also demonstrably worked: the same syncexec call succeeded earlier in the run, then errored after the flag was set to 0b, and the S5 row also asserts 0 0~S5sent``.
- Fair point: the test is coupled to another module's error wording. If that wording changes, the test fails loudly, which is arguably what you'd want.
DIReview Summary0 critical | 2 warning(s) | 1 suggestion(s)
Suggestions
|
Addition of syncexec & syncexecj to gateway
di.torq.proc.gateway: publish .gw.syncexec and .gw.syncexecj
Summary
The gateway published only
.gw.asyncexecand.gw.asyncexecjpt. This adds TorQ's synchronous entry points on top ofdi.asyncdispatch's existing deferred-reply support (-30!):.gw.syncexec[query;servertypes]– results razed.gw.syncexecj[query;servertypes;join]– custom join functionBoth are additive:
asyncexec,asyncexecjpt,getdataandineodare unchanged. The calls are deferred, not blocking a sync call does not hold the gateway for other clients. They are gated bysynccallsallowed(defaultfalse).Rejections (EOD reload, permissions) are signalled as errors to the caller, as legacy's
formatresponsedoes for sync. The async path'sneg .z.wreply would leave a sync caller waiting. EOD reload to be looked at after this as presents a bigger lift and need to discuss prior to beginningAlso: removes
di.dataaccessfrom the Deferred bullet as this has been created ingateway.md(it is already in use via.gw.getdata), and bumps the moduleVERSION0.3.0 → 0.4.0.Changes
gateway.q,init.q:syncexecj,syncexec, published at root and exportedtest.csv,test.q: real-process fixture runs withsynccallsallowedon; new sync rowsgateway.md: client API, EOD list, config comment, Deferred bulletVERSION: 0.4.0Testing
k4unit.moduletestpasses fordi.torq.proc.gatewayanddi.asyncdispatch. New rows cover:syncexecrazing across rdb+hdb,syncexecjwith a join, EOD reload (multi-type rejected and nothing sent, single-type runs), and the "not allowed" error whensynccallsallowedis off.Rerunning the


di.anydsipatchunit tests & the gateway unit testsgateway1(screenshots attached):syncexecandsyncexecjreturn correct results and matchasyncexecwhensynccallsallowed=truewhen we setsynccallsallowed=falsein the secodn screenshots we can see it still rejects sync but accepts async.