Repository navigation
Check log inventory eligibility inside the captured reader - #1226
Merged
Merged
Conversation
Inventory-created readers capture the configured root and validate the selected file's layout, entries and filename at each read, before writer observation and draining. The Console log stream no longer reloads the whole inventory before each batch, and exact-file CLI reads share the check. Closes #1222
Address review: catalog owns still_listed and the shared refusal message, the reader only calls it, and tests show command-selected readers stay unconstrained.
…lows it APFS rejects file names that are not UTF-8 with EILSEQ, so the macOS gate could not create the fixture directory. Linux runs keep the coverage.
Merged
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.
Summary
An exact Command log or Session trace selected from the log inventory now checks its own eligibility inside each read. The Console's log stream no longer rebuilds the whole inventory before every batch.
catalog::loadattaches the configured root to each reader it creates (Reader::within). Command-selected readers (logs widgets#7) get no root and are unchanged.catalog::still_listedsits beside the enumeration it mirrors and shares its filename predicate (listed_name). The root and the literalcommandspath may be aliases; the owner, repository and kind folders and the file must be real entries, not symlinks.findper request), listing, IDs, offsets and completion.logs --file <id> --followuses the same reader, so it now stops with an error when its file leaves the inventory. Previously it stopped only when the file was removed. The guide says so, anddocs/code-navigation.mdpoints at the new owner.Evidence
These reader-interface tests in
src/logs/reading/reader_tests.rsuse real temporary files and native process identities:main's exact-file reader,cargo test --bin thirdshift logs::reading::tests::reader_testsfails:removing_or_symlinking_an_enumerated_entry_ends_inventory_readsFAILED andremoving_a_finished_listed_file_ends_its_inventory_readsFAILED.After:
logs::reading::tests: 19 passed.cargo test --test show_logs: 16 passed, 1 ignored. This covers exact-file raw follow through writer exit.cargo test --test console: 82 passed, 1 ignored. This covers the inventory, HTML, JSON polling and SSE wiring.main:npm test --prefix sitepassed 49/49.cargo test --no-fail-fast: 60 targets passed; the binary target had 1286 passed and 3 failed.worktree::synchronization_tests::*shadowing_branch_and_tag_names, which fail withgit tag … fatal: no tag message?because this machine's global git config setstag.gpgsign = true. They pass withGIT_CONFIG_GLOBAL=/dev/nulland are unrelated to this change.origin/maingained only a version bump (Cargo.toml/Cargo.lock, release 0.14.9). It was merged and the reader tests were re-run.Merge Danger
Door: two-way
The only change on disk is the code; reverting restores the per-batch inventory lookup.
Blast Radius: log-reading
Exact-file CLI follows now end with an error when a selected file's owner, repository or kind folder, or the file itself, is replaced by a symlink. The Console already ended in that case.
Unaddressed findings
Addressed, Standards:
catalog.rs(still_listed).listedwas renamed:listed_namefor the filename predicate,findfor the test helper, and the boolean-flag closure is gone.UNLISTEDconstant.Addressed, Spec:
Standards
reader.rsnow covers "inventory eligibility" alongside writer lifetime and draining (src/logs/reading/reader.rs:124-126). Declined. Plan decision 1 has the reader own the check: "Inventory-created readers will own membership validation as well as captured-writer observation and byte draining". The layout rules themselves moved tocatalog.rs; the reader only enforces them before observing the writer.inventory_reads_unowned_files_by_path_bytes_and_refuses_excluded_storageexercises catalog selection rather thanReader. Declined. The acceptance criteria ask for "reader-interface coverage for … excluded storage/suffixes". An inventory-created reader can only come fromcatalog::find, so that is the interface a refused file reaches. Decision 9 says to assert "bytes, offsets, completion and refusal, not private membership state".Spec
commands == "commands"and filename-predicate conjuncts of the per-read check can't be reached by an inventory-created reader (src/logs/reading/catalog.rs:97-103). Declined. Decision 4 says to "validate the captured relative layout … sharing the existing filename predicate with listing", so the check states the full rule. Testing those conjuncts directly would mean asserting private membership state, which decision 9 rules out. The excluded names are refused at selection in the test above.Security
catalog::still_listed) only narrows a path thatcatalog::loadhas already selected under the configured root. Its alias and symlink rules match enumeration:DirEntry::file_typeversussymlink_metadata, with the root andcommandsfollowed. Console account re-authorization still runs before each read. The check-then-open window was already there betweenfindand the open onmain, and plan decision 6 leaves it out of scope; using it requires write access to the trusted logs folder.cargo test --bin thirdshift reader_tests: 11 passed.Security review outcome
No unaddressed introduced findings.
Review coverage
Both reviewers read every changed file at b003b04.
site/docs/index.htmlis generated fromdocs/guide.md:node generate-docs.mjs --checkpassed, and both reviewers also read its one-line hunk. The review fixes in 96e67c9 changesrc/logs/reading/catalog.rs,src/logs/reading/reader.rs,src/logs/reading/reader_tests.rsanddocs/code-navigation.md. Neither reviewer re-read those revisions.Closes #1222
Built with claude · claude-opus-5-5 · high