§9 acceptance: grep-zero sweep — every internal x.ai/grok identifier renamed
The PRD's first acceptance gate now holds: grep -RinE '\bx\.ai\b|grok' crates/ --include='*.rs' → 0 matches (exempt: NOTICE and third-party license archives, README provenance, and the required 'Based on Grok Build Open Source' attribution, now sourced from version_attribution.txt). Wire-visible renames (both sides in this repo, changed in lockstep): - Auth method id 'grok.com' → 'kimi-code' (AuthMethodKind::KimiCode). - Every x.ai/* and _x.ai/* ACP ext method and meta key → kigi/* / _kigi/* (~200 names; grokShell → kigiShell). Session-file replay keeps a read-side alias for the legacy '_x.ai/session/update' method so existing updates.jsonl histories load; writes emit only the new name (both directions test-pinned). - Agent types grok-build* → kigi* with a documented legacy-prefix alias at resolution time so persisted sessions keep resolving. - ToolNamespace/BuiltinAgentName GrokBuild* → Kigi* (wire snake_case kigi/kigi_concise/kigi_hashline; schema regenerated); grok_build implementation dirs renamed to kigi*. - x-grok-* headers → x-kigi-*, __GROK_* sentinels → __KIGI_*, themes grokday/groknight → kigiday/kiginight (old persisted values fall back to the default theme), web_fetch allowlist xAI hosts → kimi.com + moonshot platforms, changelog CDN → this repo, grok-build changelog archives deleted. - BYOK default endpoint removed: [endpoints] api_base_url is now truly optional with NO default — consumers fail fast with the flag name when unset (no silent x.ai egress). Mock harnesses inject it explicitly. - System-prompt identity fixed: 'released by xAI' → 'an unofficial community CLI for Kimi' (template + regenerated encrypted form). Also repaired pre-existing grok-era test debt found by the sweep: the stale trace_classify default-model pin, the grok-pager UA label test, pty-harness stale-binary reuse and non-hermetic moonshot routing (a PTY test could previously reach the real api.moonshot.cn), and the outdated oauth fixture scope key. Gates: §9 grep 0; fmt clean; workspace check/clippy 0/0 (-D warnings); FULL cargo test --workspace: 234 suites, 21,961 passed, 0 failed; deny advisories ok.
This commit is contained in:
@@ -28,15 +28,15 @@ use kigi_config::kigi_home;
|
||||
/// Which env var requested a single-file debug log (drives filter and diagnostics).
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum DebugSource {
|
||||
GrokLogFile,
|
||||
GrokDebugLog,
|
||||
KigiLogFile,
|
||||
KigiDebugLog,
|
||||
}
|
||||
|
||||
impl DebugSource {
|
||||
fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::GrokLogFile => "KIGI_LOG_FILE",
|
||||
Self::GrokDebugLog => "KIGI_DEBUG_LOG",
|
||||
Self::KigiLogFile => "KIGI_LOG_FILE",
|
||||
Self::KigiDebugLog => "KIGI_DEBUG_LOG",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ pub const RMCP_SSE_NOISE_TARGET: &str = "rmcp::transport::common::client_side_ss
|
||||
|
||||
// Broad firehose filter for the routing/KIGI_DEBUG_LOG sources: capture our
|
||||
// crates at debug regardless of a narrowing RUST_LOG, with deps at info so they
|
||||
// don't flood. Curated first-party allowlist: new grok crates default to `info`
|
||||
// don't flood. Curated first-party allowlist: new kigi crates default to `info`
|
||||
// until added here.
|
||||
const FIREHOSE_BASE_DIRECTIVES: &str = "info,kigi_tui=debug,kigi_shell=debug,kigi_tools=debug,kigi_log=debug,kigi_agent=debug,kigi_mcp=debug,kigi_acp_lib=debug,sampling_log=off";
|
||||
|
||||
@@ -382,8 +382,8 @@ where
|
||||
}
|
||||
Some(DebugTarget::SingleFile { path, src }) => {
|
||||
let filter = match src {
|
||||
DebugSource::GrokLogFile => default_file_filter(),
|
||||
DebugSource::GrokDebugLog => firehose_filter(),
|
||||
DebugSource::KigiLogFile => default_file_filter(),
|
||||
DebugSource::KigiDebugLog => firehose_filter(),
|
||||
};
|
||||
match build_file_layer::<S>(&path, filter) {
|
||||
Ok(layer) => registry.with(layer).init(),
|
||||
@@ -417,11 +417,11 @@ pub(crate) enum DebugTarget {
|
||||
///
|
||||
/// Read via `var_os` (not `var`) so a non-UTF-8 path isn't silently dropped.
|
||||
pub(crate) fn resolve_debug_target() -> Option<DebugTarget> {
|
||||
let grok_log_file = std::env::var_os("KIGI_LOG_FILE");
|
||||
let grok_debug_log = std::env::var_os("KIGI_DEBUG_LOG");
|
||||
let kigi_log_file = std::env::var_os("KIGI_LOG_FILE");
|
||||
let kigi_debug_log = std::env::var_os("KIGI_DEBUG_LOG");
|
||||
resolve_debug_target_inner(
|
||||
grok_log_file.as_deref(),
|
||||
grok_debug_log.as_deref(),
|
||||
kigi_log_file.as_deref(),
|
||||
kigi_debug_log.as_deref(),
|
||||
&kigi_home().join("debug"),
|
||||
)
|
||||
}
|
||||
@@ -447,19 +447,19 @@ fn os_path(v: &OsStr) -> PathBuf {
|
||||
// `OsStr` so non-UTF-8 paths round-trip; only the bool-vs-path discrimination
|
||||
// needs UTF-8 (a non-UTF-8 value can't be a bool keyword, so it's a path).
|
||||
fn resolve_debug_target_inner(
|
||||
grok_log_file: Option<&OsStr>,
|
||||
grok_debug_log: Option<&OsStr>,
|
||||
kigi_log_file: Option<&OsStr>,
|
||||
kigi_debug_log: Option<&OsStr>,
|
||||
debug_dir: &Path,
|
||||
) -> Option<DebugTarget> {
|
||||
if let Some(raw) = grok_log_file
|
||||
if let Some(raw) = kigi_log_file
|
||||
&& !is_blank(raw)
|
||||
{
|
||||
return Some(DebugTarget::SingleFile {
|
||||
path: os_path(raw),
|
||||
src: DebugSource::GrokLogFile,
|
||||
src: DebugSource::KigiLogFile,
|
||||
});
|
||||
}
|
||||
let raw = grok_debug_log?;
|
||||
let raw = kigi_debug_log?;
|
||||
match raw.to_str().map(str::trim) {
|
||||
Some("" | "0" | "false" | "off" | "no") => None,
|
||||
Some("1" | "true" | "on" | "yes") => Some(DebugTarget::PerSession {
|
||||
@@ -468,7 +468,7 @@ fn resolve_debug_target_inner(
|
||||
// Any other UTF-8 value, or a non-UTF-8 value (`None`), is an explicit path.
|
||||
_ => Some(DebugTarget::SingleFile {
|
||||
path: os_path(raw),
|
||||
src: DebugSource::GrokDebugLog,
|
||||
src: DebugSource::KigiDebugLog,
|
||||
}),
|
||||
}
|
||||
}
|
||||
@@ -596,7 +596,7 @@ mod tests {
|
||||
target,
|
||||
DebugTarget::SingleFile {
|
||||
path: PathBuf::from("/tmp/custom.log"),
|
||||
src: DebugSource::GrokDebugLog,
|
||||
src: DebugSource::KigiDebugLog,
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -613,7 +613,7 @@ mod tests {
|
||||
target,
|
||||
DebugTarget::SingleFile {
|
||||
path: PathBuf::from("/tmp/explicit.log"),
|
||||
src: DebugSource::GrokLogFile,
|
||||
src: DebugSource::KigiLogFile,
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -651,7 +651,7 @@ mod tests {
|
||||
let target = resolve_debug_target_inner(None, Some(raw), Path::new("/debug")).unwrap();
|
||||
match target {
|
||||
DebugTarget::SingleFile { path, src } => {
|
||||
assert_eq!(src, DebugSource::GrokDebugLog);
|
||||
assert_eq!(src, DebugSource::KigiDebugLog);
|
||||
assert_eq!(path.as_os_str(), raw);
|
||||
}
|
||||
other => panic!("expected SingleFile for non-UTF-8 path, got {other:?}"),
|
||||
@@ -954,7 +954,7 @@ mod tests {
|
||||
fn prune_old_logs_missing_dir_is_noop() {
|
||||
// Best-effort: a nonexistent debug dir must not panic.
|
||||
prune_old_logs(
|
||||
Path::new("/no/such/grok/debug/dir"),
|
||||
Path::new("/no/such/kigi/debug/dir"),
|
||||
std::time::Duration::from_secs(1),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user