fix: harden PR 221-227 follow-up issues#231
Merged
Merged
Conversation
Refs #221, #222, #224, #225, #226, #227. Align config path active discovery with the implicit loader's first-existing-candidate semantics, correct record output help and resolver docs against the binary default, and make the swap-color regression test derive crossterm's current Red SGR sequence instead of hard-coding older encodings.
2c6630f to
51b8d26
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.
Summary
Follow-up hardening for the already-merged PRs #221, #222, #224, #225, #226, and #227 after reading each PR body and the linked original issue bodies. This PR fixes the remaining gaps found during that review and was rebased after #230 so record-path documentation and tests now match the platform-aware cache-directory behavior from #229/#230.
Target PRs Reviewed
config pathsubcommandLinked Original Issues Reviewed
config pathlookup) #213 Surface active TOML config file location in help and add read-onlyconfig pathReview Findings
default_config_path()for help andconfig pathactive output, while the loader uses the first existing implicit candidate before falling back to the canonical default. On macOS this could show the Apple-canonical path as “not found” even when the loader would actually read~/.config/all-smi/config.toml.paths::cache_dir(). The follow-up risk was drift betweenrecord --help,RecorderOptionsdocs, compiledSettings::default().record, and resolver tests. This PR keeps those surfaces aligned with the platform-aware cache helper and final CWD fallback only when no home-like cache directory is resolvable.cargo testexposed that the test was brittle even though the renderer still usesColor::Red.Fixes
paths::active_config_path()and reused it in top-level help plusall-smi config pathtext/JSON output so the displayed active path matches implicit loader semantics.RecorderOptionsdocumentation and regression coverage proving the real CLI default, represented by compiledSettings::default().record, delegates topaths::cache_dir().join("records")and falls back toDEFAULT_BASENAMEonly when cache-dir discovery returnsNone.Color::RedSGR sequence rather than hard-coding specific terminal encodings.Security Review
No authentication, authorization, SQL, shell execution, deserialization, SSRF, or network surface was changed by this follow-up. The
config pathchange remains read-only and only calls bounded path discovery plusPath::exists(). The record-path change is documentation/test alignment around existing resolver behavior; it does not relax writer symlink refusal or file-mode hardening. No sensitive config values are printed or newly exposed.Performance And Reliability Review
The new active-path helper performs the same bounded candidate path scan the config loader already performs and is only used in help/config-path discovery surfaces. There is no hot-path TUI, API, parser, or hardware reader overhead. The swap test update improves CI reliability across crossterm versions without changing rendering behavior.
Validation
rustup update stableto Rust 1.95.0 so local validation matches the post-update: bump dependencies to latest versions #228 dependency MSRV.libdrm-dev; because sudo was unavailable, validation usedtarget/local-libsymlinks to the installed runtimelibdrm.so.2andlibdrm_amdgpu.so.1viaLIBRARY_PATHfor linking only.cargo fmt --checkgit diff --checkLIBRARY_PATH=/home/inureyes/Development/backend.ai/all-smi/target/local-lib cargo test --bin all-smi record::tests::resolve_outputLIBRARY_PATH=/home/inureyes/Development/backend.ai/all-smi/target/local-lib cargo test --test config_path_help_testLIBRARY_PATH=/home/inureyes/Development/backend.ai/all-smi/target/local-lib cargo test --lib ui::renderers::memory_renderer::tests::test_swap_row_active_uses_red_colorLIBRARY_PATH=/home/inureyes/Development/backend.ai/all-smi/target/local-lib cargo clippy -- -D warningsLIBRARY_PATH=/home/inureyes/Development/backend.ai/all-smi/target/local-lib cargo testRefs #221, #222, #224, #225, #226, #227, #211, #212, #213, #214, #220, #223.