Repository navigation
fix: handle null userT, unreadable software directories, and non-JSON files in usage - #38
Merged
Merged
Conversation
… 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
force-pushed
the
fix/usage-json-robustness
branch
from
November 18, 2026 06:10
a14fc07 to
6c082dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
eb-keep-logs usagepreviously dropped link hits whenuserTwasnull, skipped unreadablesoftwaresubdirectories silently, and treated non-JSON files as empty logs.When an XALT record carried
"userT": nullbeside aresultTobject,processObjectinsrc/used.zigreturned early instead of continuing toresultTandlinkA. Insrc/usage.zig,inventoryalso discarded permission errors onsoftwaresubdirectories, andparseHitsignored non-JSON lines when no{token appeared. Those three gaps hid real usage hits and input errors.I updated
processObjectinsrc/used.zigto ignore non-objectuserTvalues, and updatedparseHitsto returnerror.BadJsonfor non-empty inputs with neither JSON objects nor Lmod records. Insrc/usage.zig,inventorynow prints warnings on stderr for unreadablesoftwaresubdirectories, andcmdUsagereports malformed inputs clearly.docs/orgmode/reference/cli.organdtests/test_usage.shupdate the file refusal contract and cover all three cases.