Skip to content

fix: handle null userT, unreadable software directories, and non-JSON files in usage - #38

Merged
HaoZeke merged 1 commit into
mainfrom
fix/usage-json-robustness
Nov 18, 2026
Merged

HaoZeke merged 1 commit into
mainfrom
fix/usage-json-robustness

Conversation

@HaoZeke

@HaoZeke HaoZeke commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

eb-keep-logs usage previously dropped link hits when userT was null, skipped unreadable software subdirectories silently, and treated non-JSON files as empty logs.

When an XALT record carried "userT": null beside a resultT object, processObject in src/used.zig returned early instead of continuing to resultT and linkA. In src/usage.zig, inventory also discarded permission errors on software subdirectories, and parseHits ignored non-JSON lines when no { token appeared. Those three gaps hid real usage hits and input errors.

I updated processObject in src/used.zig to ignore non-object userT values, and updated parseHits to return error.BadJson for non-empty inputs with neither JSON objects nor Lmod records. In src/usage.zig, inventory now prints warnings on stderr for unreadable software subdirectories, and cmdUsage reports malformed inputs clearly. docs/orgmode/reference/cli.org and tests/test_usage.sh update the file refusal contract and cover all three cases.

… files in usage

`processObject` in `src/used.zig` returned early when `userT` was `null`, dropping `resultT` and `linkA` hits. Two other gaps hid real errors. `inventory` in `src/usage.zig` skipped unreadable `software` subdirectories without warning, and `parseHits` accepted non-JSON text as empty input.

`processObject` now skips non-object `userT` values so `resultT` hits count, and `inventory` warns on stderr when a package directory fails. `parseHits` rejects non-empty inputs with neither JSON objects nor Lmod records. `docs/orgmode/reference/cli.org` and `tests/test_usage.sh` document and test these fixes.
@HaoZeke
HaoZeke force-pushed the fix/usage-json-robustness branch from a14fc07 to 6c082dc Compare November 18, 2026 06:10
@HaoZeke
HaoZeke merged commit a5f01dc into main Nov 18, 2026
8 checks passed
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.

1 participant