[Repo Assist] test(exec): add tilde-expansion edge-case tests for ExecApprovalsStore#750
Conversation
Add two tests that cover previously-untested branches of ExpandHomePrefix:
1. ResolveAsync_TildeOnlyStateDir_ResolvesToEffectiveHome
- stateDirOverride == "~" (tilde alone, no trailing separator) must
resolve to the effectiveHome directory. This exercises the
`path == "~"` branch of ExpandHomePrefix that is distinct from the
`path.StartsWith("~/")` branch covered by existing tests.
2. ResolveAsync_TildePrefixedOpenClawHome_ExpandsRelativeToOsHome
- openClawHomeOverride == "~/subdir" is itself tilde-prefixed and must
be expanded relative to osHomeOverride before it is used as the base
for further tilde expansion in stateDirOverride.
Both tests also verify that file migration from the legacy data path to
the resolved state path succeeds and that the migrated file content is
preserved.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Codex review: needs maintainer review before merge. Reviewed June 12, 2026, 9:59 AM ET / 13:59 UTC. Summary Reproducibility: not applicable. This PR adds regression coverage for source-confirmed branches rather than reporting a failing user workflow. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused regression tests after the required full build and test gates confirm the exact PR head. Do we have a high-confidence way to reproduce the issue? Not applicable; this PR adds regression coverage for source-confirmed branches rather than reporting a failing user workflow. Is this the best way to solve the issue? Yes. Focused tests are the narrowest maintainable way to protect the existing bare-tilde and chained home-expansion contracts without modifying production behavior. AGENTS.md: found, but no applicable review policy affected this item. Codex review notes: model internal, reasoning high; reviewed against 913ba4e8f504. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds two unit tests for
ExecApprovalsStorethat cover previously-untested branches ofExpandHomePrefix, complementing the path-expansion coverage added in #744.Motivation
ExpandHomePrefixhas three distinct branches:path == "~"— returnshomedirectly (the tilde-only branch)path.StartsWith("~/")— strips prefix and joins withhomepathunchangedThe existing tests exercise branch 2 (via
ResolveAsync_HomeRelativeStateDir_UsesOpenClawHome) but leave branches 1 and the interaction between a tilde-prefixedopenClawHomeOverrideandstateDirOverrideuncovered. A future refactor ofExpandHomePrefix(e.g. collapsing the three-way conditional) could silently break branch 1 without a failing test.New Tests
ResolveAsync_TildeOnlyStateDir_ResolvesToEffectiveHomestateDirOverride = "~"(bare tilde) resolves toeffectiveHomeand the file is migrated thereResolveAsync_TildePrefixedOpenClawHome_ExpandsRelativeToOsHomeopenClawHomeOverride = "~/.openclaw"is expanded relative toosHomeOverridebefore being used as the base for further tilde expansion instateDirOverrideTest Status
OpenClaw.Shared.Tests: 2216 passed, 8 failed (pre-existing, unrelated to this PR)MxcPolicyBuilderTests,MxcConfigBuilderTests,McpHttpServerTests,ExecApprovalV2NormalizationTests— all fail due to Windows-specific behaviour in the Linux CI environment; not caused by this change.OpenClaw.Tray.Tests: 1038 passed, 0 failed, 2 skippedAdd this agentic workflows to your repo
To install this agentic workflow, run