fix(cosh-ng): [platform,cli] honor svc dry-run#1426
Open
samchu-zsl wants to merge 2 commits into
Open
Conversation
6b1df09 to
651217e
Compare
Return the preview result before querying systemd so dry-run stays independent of service existence and host capabilities. Preserve validation and real execution paths. Reuse the existing Unknown state to avoid a public API change. Assisted-by: Codex:0.144.0-alpha.4 Signed-off-by: Shenglong Zhu <samchu.zsl@alibaba-inc.com>
Rust 1.97 rejects the explicit formatting borrow under the workspace warnings gate. Rely on format_args to borrow tc.id implicitly, preserving output and ownership. Assisted-by: Codex:0.144.0-alpha.4 Signed-off-by: Shenglong Zhu <samchu.zsl@alibaba-inc.com>
651217e to
f49cfc5
Compare
Collaborator
|
PR number: #1426 Findings
Structure / API review
Remaining risk / validation not run
|
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
Make service action dry-runs return before querying systemd, matching the package dry-run contract and keeping previews independent of service existence. Preserve action and service-name validation, all real service execution paths, and the existing public response types. Strengthen platform and CLI regression coverage across start, stop, restart, enable, and disable. A second atomic commit removes an unchanged-main redundant formatting borrow exposed by Rust 1.97 so the required cosh-ng CI gate can proceed without changing runtime behavior.
Related Issue
closes #1361
Type of Change
Scope
cosh(copilot-shell)cosh-ng(cosh-ng)sec-core(agent-sec-core)skill(os-skills)sight(agentsight)tokenless(tokenless)ckpt(ws-ckpt)memory(agent-memory)anolisa(anolisa-cli)skillfs(SkillFS)Checklist
cosh: Lint passes, type check passes, and tests passcosh-ng:cargo clippy --workspace --all-targets -- -D warningsandcargo fmt --all -- --checkpasssec-core(Rust):cargo clippy -- -D warningsandcargo fmt --checkpasssec-core(Python): Ruff format and pytest passskill: Skill directory structure is valid and shell scripts pass syntax checksight:cargo clippy -- -D warningsandcargo fmt --checkpasstokenless:cargo clippy -- -D warningsandcargo fmt --checkpassmemory(Linux only):cargo clippy --all-targets --locked -- -D warnings,cargo fmt --check, andcargo testpassanolisa:cargo clippy --all-targets --locked -- -D warnings,cargo fmt --all --check, andcargo test --lockedpassskillfs:cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings, andcargo test --workspacepasspackage-lock.json/Cargo.lock)Testing
Passed after rebasing onto
origin/main:cargo fmt --all -- --checkcargo test --package cosh-core(275 passed; 0 failedacross unit and integration targets)cargo test --package cosh-platform svc::tests::test_svc_action_dry_run_skips_status_query_for_all_actions -- --exact(1 passed)cargo test --package cosh-cli --test cli_integration test_svc_actions_dry_run_nonexistent_service_succeed -- --exact(1 passed)cargo clippy --workspace --all-targets -- -D warningscargo build --workspace --release0 problems; 0 warnings)Test cosh-ng: Rust 1.97 formatting, all-targets Clippy, andcargo test --workspacepassedEarlier focused and manual validation also passed:
cargo test --package cosh-platform -- --skip test_parse_installed_version_bash(175 passed; 0 failed; 1 filtered out)cargo test --package cosh-cli --test cli_integration -- --skip test_pkg_search_bash_shows_installed(53 passed; 0 failed; 1 filtered out)cargo run --quiet --package cosh-cli -- svc start cosh-nonexistent-test-svc-1361 --dry-runcargo run --quiet --package cosh-cli -- pkg install cosh-nonexistent-test-pkg-1361 --dry-runThe local toolchain is Rust/Clippy 1.91. The previous Linux CI RED on Rust 1.97 was
clippy::useless_borrows_in_formattingin unchanged main code; the second commit applies Clippy's exact one-line suggestion. The refreshed LinuxTest cosh-ngjob passed in 8m51s, providing the final Rust 1.97 and complete workspace gate.The unskipped package baseline and broader workspace checks are not green on this macOS host. Two pre-existing Nix/Homebrew package-manager baseline tests fail:
pkg::tests::test_parse_installed_version_bashandtest_pkg_search_bash_shows_installed. With both package tests skipped, two broad workspace runs exposed seven unrelatedcosh-shellPTY timing failures; every failure passed an isolated exact rerun. No package-manager orcosh-shellcode was changed for this fix.Additional Notes
The manual dry-run comparison was performed on macOS, where the regression previously surfaced as a failed
systemctlspawn. The automated test uses a guaranteed nonexistent service and covers all five service actions without executing host mutations. Both dry-run state fields use the existingUnknown("(dry-run)")representation, avoiding a public API change. The Rust 1.97 cleanup is isolated in its own[core]commit and preserves the generated bypass id and later uses oftc.id.