@@ -26,6 +26,8 @@ enum UISmokeRunner {
2626 try await testEmptyState ( )
2727 try await testSettingsLayout ( )
2828 try await testRegisterWizardValidation ( )
29+ try testCLIShimInstallerEnvironment ( )
30+ try testCLIShimStatusPresentation ( )
2931 try testManagementEditorValidation ( )
3032 try testPasteboardCopy ( )
3133 try testCommandPolicyDraft ( )
@@ -200,6 +202,45 @@ enum UISmokeRunner {
200202 ] ) . isEmpty, " whitespace-only secret values are omitted from registration payload " )
201203 }
202204
205+ private static func testCLIShimInstallerEnvironment( ) throws {
206+ let prefix = URL ( fileURLWithPath: " /tmp/agentic-secrets-custom-prefix " , isDirectory: true )
207+ let environment = CLIShimInstaller . subprocessEnvironment (
208+ base: [ " PATH " : " /usr/bin " ] ,
209+ installPrefix: prefix
210+ )
211+ try expect ( environment [ " AGENTIC_SECRETS_INSTALL_PREFIX " ] == prefix. path, " shim installer subprocess receives the app install prefix " )
212+ try expect ( environment [ " AGENTIC_SECRETS_SHIM_DIR " ] == prefix. appendingPathComponent ( " shims " , isDirectory: true ) . path, " shim installer subprocess uses the matching prefix shims directory " )
213+ try expect ( environment [ " AGENTIC_SECRETS_SHIM_BINARY " ] == prefix. appendingPathComponent ( " bin/agentic-secrets-shim " ) . path, " shim installer subprocess uses the matching prefix shim helper " )
214+ try expect ( environment [ " PATH " ] == " /usr/bin " , " shim installer subprocess preserves unrelated environment " )
215+ }
216+
217+ private static func testCLIShimStatusPresentation( ) throws {
218+ let installed = CLIShimStatusPresentation ( rawValue: " installed " )
219+ try expect ( installed. label == " Installed " , " installed shim status has a human label " )
220+ try expect ( installed. canInstall, " installed shim can be repaired " )
221+ try expect ( installed. canRemove, " installed shim can be removed " )
222+
223+ let missing = CLIShimStatusPresentation ( rawValue: " not installed " )
224+ try expect ( missing. label == " Not Installed " , " missing shim status has a human label " )
225+ try expect ( missing. canInstall, " missing shim can be installed " )
226+ try expect ( !missing. canRemove, " missing shim cannot be removed " )
227+
228+ let blocked = CLIShimStatusPresentation ( rawValue: " blocked " )
229+ try expect ( blocked. label == " Blocked " , " blocked shim status has a human label " )
230+ try expect ( !blocked. canInstall, " blocked shim install action is disabled until the path is reviewed " )
231+ try expect ( !blocked. canRemove, " blocked shim remove action is disabled because the path is not verified as managed " )
232+
233+ let helperUnavailable = CLIShimStatusPresentation ( rawValue: " helper unavailable " )
234+ try expect ( helperUnavailable. label == " Helper Unavailable " , " helper-unavailable shim status has a human label " )
235+ try expect ( !helperUnavailable. canInstall, " helper-unavailable shim cannot be repaired through per-CLI install " )
236+ try expect ( !helperUnavailable. canRemove, " helper-unavailable shim cannot be removed as a verified managed shim " )
237+
238+ let unknown = CLIShimStatusPresentation ( rawValue: " unexpected " )
239+ try expect ( unknown. label == " Unknown " , " unexpected shim status falls back to Unknown " )
240+ try expect ( !unknown. canInstall, " unknown shim status does not enable install " )
241+ try expect ( !unknown. canRemove, " unknown shim status does not enable remove " )
242+ }
243+
203244 private static func testManagementEditorValidation( ) throws {
204245 try expect ( APISessionProfileEditorDefaults . pathPrefixes == " /v1/ " , " proxy add flow has a safe default path prefix " )
205246 try expect ( APISessionProfileEditorDefaults . methods == " GET, POST " , " proxy add flow has default HTTP methods " )
@@ -397,6 +438,9 @@ enum UISmokeRunner {
397438 store. brokerInstallPlan = plan
398439 store. brokerStatus. message = " Open the installed copy so the authenticated IPC manifest matches the running UI. "
399440 try expect ( store. bestDaemonAction == . openInstalledApp, " wrong app copy state highlights opening the installed copy " )
441+ store. brokerStatus. message = " Local daemon is installed but not running. "
442+ try expect ( store. bestDaemonAction != . openInstalledApp, " daemon-down state does not over-prioritize opening the installed copy " )
443+ store. brokerStatus. message = " Open the installed copy so the authenticated IPC manifest matches the running UI. "
400444 try verifyHostingLayout (
401445 LocalStateUnavailableView ( store: store) ,
402446 width: 680 ,
@@ -734,6 +778,13 @@ enum UISmokeRunner {
734778 *) export PATH= " \( binDir) :$PATH " ;;
735779 esac
736780
781+ # AgenticSecrets CLI shims
782+ agentic_secrets_path_dir=' \( shimDir) '
783+ case " :$PATH: " in
784+ * " :$agentic_secrets_path_dir: " *) ;;
785+ *) export PATH= " $agentic_secrets_path_dir:$PATH " ;;
786+ esac
787+
737788 # AgenticSecrets CLI shims
738789 case " :$PATH: " in
739790 * " : \( shimDir) : " *) ;;
0 commit comments