Skip to content

feat(anolisa): add scoped installed state view#1412

Merged
kongche-jbw merged 1 commit into
alibaba:mainfrom
ikunkun-sys:scoped-installed-state-view
Jul 9, 2026
Merged

feat(anolisa): add scoped installed state view#1412
kongche-jbw merged 1 commit into
alibaba:mainfrom
ikunkun-sys:scoped-installed-state-view

Conversation

@ikunkun-sys

@ikunkun-sys ikunkun-sys commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Add a shared CLI StateView for scoped installed-state reads. User-mode read
views now load the current user state plus readable system state, while system
mode reads only system state. The list command uses this projection so a
normal user can discover system-provided components without implying ownership.

List rows now expose:

  • scope: user, system, or none
  • active: whether the row is the selected visible lifecycle record
  • mutable_by_current_invocation: whether the current command may mutate it
  • state_path: the physical installed.toml backing active rows

This 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 source
health, orphaned adapter receipts, and lifecycle wrong-scope guards are left to
later PRs.

Related Issue

N/A

Ship Note

anolisa list --installed in user mode can now show system-provided installed
components. 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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Performance improvement
  • CI/CD or build changes

Scope

  • anolisa (anolisa-cli)

Testing

  • cargo fmt --all -- --check
  • cargo check
  • cargo clippy --workspace --all-targets --locked -- -D warnings
  • cargo 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-deps
  • Local CLI QA: temp user/system installed.toml files, verifying system mode
    does not read user state, user mode shows system rows as immutable, and
    malformed visible system state returns a warning.
  • Remote QA on Alinux 4: root/system mode sees only the system row;
    nobody/user mode sees both the system row and the user row with correct
    scope, mutability, and state_path fields.

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>
@ikunkun-sys ikunkun-sys force-pushed the scoped-installed-state-view branch from 52d7f6c to 62e9d7c Compare July 9, 2026 05:57
@ikunkun-sys ikunkun-sys removed the scope:documentation ./docs/|./*.md|./NOTICE label Jul 9, 2026
@ikunkun-sys ikunkun-sys removed the request for review from casparant July 9, 2026 06:08

@kongche-jbw kongche-jbw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kongche-jbw kongche-jbw merged commit 794486f into alibaba:main Jul 9, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants