feat(anolisa): add scoped installed state view#1412
Merged
Conversation
Add a shared StateView that keeps the writable state root separate from read-only visible roots for CLI projections. The list command now renders component scope, mutability, and state path so user mode can discover system-provided components without implying ownership. This keeps the first implementation slice narrow: lifecycle mutations continue to use the current install mode paths, while status, doctor, adapter source health, and lifecycle wrong-scope guards remain deferred to later PRs. Malformed writable state stays fatal; malformed non-writable visible system state is reported as a warning for read-only list output. Assisted-by: Codex:0.143.0 Signed-off-by: 爱鲲 <jiawa.syx@alibaba-inc.com>
52d7f6c to
62e9d7c
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.
Description
Add a shared CLI
StateViewfor scoped installed-state reads. User-mode readviews now load the current user state plus readable system state, while system
mode reads only system state. The
listcommand uses this projection so anormal user can discover system-provided components without implying ownership.
List rows now expose:
scope:user,system, ornoneactive: whether the row is the selected visible lifecycle recordmutable_by_current_invocation: whether the current command may mutate itstate_path: the physicalinstalled.tomlbacking active rowsThis is the first PR in the dual-scope installed-state plan. It intentionally
keeps mutation behavior unchanged: lifecycle writes still go only to the
current install mode's physical state file.
status,doctor, adapter sourcehealth, orphaned adapter receipts, and lifecycle wrong-scope guards are left to
later PRs.
Related Issue
N/A
Ship Note
anolisa list --installedin user mode can now show system-provided installedcomponents. System rows are marked as system scope and immutable for the user
invocation, while user rows remain user-scoped and mutable. Malformed writable
state remains fatal; malformed visible system state is surfaced as a warning for
read-only list output.
Type of Change
Scope
anolisa(anolisa-cli)Testing
cargo fmt --all -- --checkcargo checkcargo clippy --workspace --all-targets --locked -- -D warningscargo test -p anolisa-cli state_view(6 tests)cargo test -p anolisa-cli list(40 tests)cargo test -p anolisa-cli(423 tests)cargo doc --no-depsinstalled.tomlfiles, verifying system modedoes not read user state, user mode shows system rows as immutable, and
malformed visible system state returns a warning.
Alinux 4: root/system mode sees only the system row;nobody/user mode sees both the system row and the user row with correctscope, mutability, and
state_pathfields.