Skip to content

Trimming down comments across the repo - #148

Merged
alowrydi merged 48 commits into
mainfrom
feature-comment-trim
Oct 30, 2026
Merged

alowrydi merged 48 commits into
mainfrom
feature-comment-trim

Conversation

@alowrydi

Copy link
Copy Markdown
Collaborator

Summary

Trims comments across the di/ modules to a concise standard: a comment states what the code does, in a line or two. Removed:

  • explanations of why the code is written a certain way
  • history (PR numbers, sprint references, "previously…" notes)
  • TorQ source line references (gateway.q:93 and the like)
  • duplicated prose and notes about other modules

No code changes. Every changed .q and .csv line is a comment, or the comment column of a test row.

109 files across 25 modules: 77 .q, 31 test.csv, plus style.md. +795 / −1941 lines.

style.md

  • Comments rule: now says a comment states what the code does, not why or how it came to be. This is the standard the trim applies.
  • New "kdb-x gotchas" section: general q and KDB-X behaviour that used to be repeated in comments across many files now lives in one place. Each entry was tested in KDB-X before being added:
    • a use-loaded module's names don't reach root without @[`.;…] or set
    • locals can't shadow built-ins (sv, ss, log, …)
    • dot-syntax on a module handle in the same frame as its use fails
    • like throws 'nyi with three or more *
    • enlist of a dict is a table, so start mixed dicts from ()!()
    • not a or b parses as not[a or b]
    • and and or evaluate both sides
    • ("1";"2") is the string "12"
    • system inside peach with -s throws 'sys

Two warnings that the trim deleted turned out to be false in KDB-X today, so they are not carried over:

  • Forward references: "a forward reference inside a module throws 'type" (dataaccess.q). In practice it resolves when called.
  • Shell: "system runs commands without a shell" (logroll.q). In practice &&, || and pipes work.

Verification

  • Comment-only, checked mechanically:
    • For every changed .q file, the lines left after stripping comments are identical to main.
    • For every changed test.csv, every column except the comment is identical to main.
    • No new bare / or \ lines.
    • 108 of 108 files pass.
  • Test suites: run on this exact di/ tree with TORQXHOME unset:
Suite Result
di.torq 93/93
di.torq.proc.gateway 43/43
di.permissions 57/57
di.torq.servers 80/80
di.subscriptions 49/49
di.torq.proc.tickerplant 70/70
di.torq.proc.segmentedtp 85/85

Review notes

alowrydi and others added 30 commits October 29, 2026 10:36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alowrydi and others added 18 commits October 29, 2026 10:36
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DI-Software-Engineering

Copy link
Copy Markdown

The diff is too large to review automatically (estimated 110,767 tokens, limit 90,000).

@DI-Dexter DI-Dexter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@alowrydi
alowrydi merged commit 489726d into main Oct 30, 2026
@alowrydi
alowrydi deleted the feature-comment-trim branch October 30, 2026 09:40
DI-Dexter added a commit to DI-Dexter/kdbx-modules that referenced this pull request Nov 2, 2026
1. Trim comments to concise what-only, matching DataIntellectTech#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>
DI-Dexter added a commit that referenced this pull request Nov 4, 2026
* 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.
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