Synced from monorepo
Changes: - grok-shell: request workspaces:read/write OAuth2 scopes - security: fix SSRF bypass via HTTP redirect in hook runner - fix(grok-build): enterprise STT WSS URL + API-key voice bearer - Harden identity-change purge and sync-marker invariants - sandbox + workspace-server: delete the legacy ready-file arm - Show billing URL when browser cannot open - fix(pager): show folder-trust UI in minimal mode - fix(pager): drain task_backgrounded before no-wait headless exit - grok-agent-sdk: stop SDK-spawned agents from staging self-updates they can never adopt - Split settings_modal into directory module - Delegate VS Code SSH file links - grok-shell: release the workspace session binding when a session is removed - keep skills reachable when their name collides with a client builtin - Preserve semantic link targets
This commit is contained in:
parent
c68e39f604
commit
8adf9013a0
117 changed files with 16998 additions and 14540 deletions
|
|
@ -6,8 +6,10 @@ edition.workspace = true
|
|||
description = "Backend environment presets for the Grok CLI crate family: endpoint URL defaults and env-var test support."
|
||||
|
||||
[features]
|
||||
# single shared rlib per crate, so downstream Bazel test targets need the
|
||||
default-bazel = []
|
||||
# Exposes `EnvVarGuard` (and its process-wide env lock) to downstream
|
||||
# crates' test targets.
|
||||
test-support = []
|
||||
default-bazel = ["test-support"]
|
||||
|
||||
[dependencies]
|
||||
tracing = { workspace = true }
|
||||
|
|
|
|||
|
|
@ -97,21 +97,21 @@ impl std::fmt::Display for GrokBuildEnvironment {
|
|||
}
|
||||
}
|
||||
/// Serializes env-var mutation across tests; `std::env` is process-global.
|
||||
#[cfg(test)]
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
static ENV_LOCK: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||
#[cfg(test)]
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
fn env_lock() -> std::sync::MutexGuard<'static, ()> {
|
||||
ENV_LOCK.lock().unwrap_or_else(|p| p.into_inner())
|
||||
}
|
||||
/// RAII env-var override for tests: constructors snapshot the prior value
|
||||
/// under [`ENV_LOCK`], `Drop` restores it, panics included.
|
||||
#[cfg(test)]
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub struct EnvVarGuard {
|
||||
key: &'static str,
|
||||
prev: Option<String>,
|
||||
_lock: std::sync::MutexGuard<'static, ()>,
|
||||
}
|
||||
#[cfg(test)]
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
impl EnvVarGuard {
|
||||
pub fn set(key: &'static str, value: &str) -> Self {
|
||||
let lock = env_lock();
|
||||
|
|
@ -138,7 +138,7 @@ impl EnvVarGuard {
|
|||
unsafe { std::env::set_var(self.key, value) };
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
impl Drop for EnvVarGuard {
|
||||
fn drop(&mut self) {
|
||||
match self.prev.take() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue