§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:
2026-07-18 02:48:46 -04:00
parent 86e3724310
commit 6f31415ed6
1056 changed files with 8410 additions and 18307 deletions
@@ -1,12 +1,12 @@
//! Vendor-compatibility end-to-end tests.
//!
//! Each test builds a fake `$HOME` containing skills/rules/AGENTS.md under the
//! `.kigi`, `.cursor`, and `.claude` vendor dirs, spawns a real `grok agent
//! `.kigi`, `.cursor`, and `.claude` vendor dirs, spawns a real `kigi agent
//! stdio` process against the mock inference server (toggling the
//! `GROK_<VENDOR>_<SURFACE>_ENABLED` env vars via `cmd.env`), sends one prompt,
//! `KIGI_<VENDOR>_<SURFACE>_ENABLED` env vars via `cmd.env`), sends one prompt,
//! and asserts on the full inference request bodies:
//!
//! - the Grok-native skill is always present regardless of toggles
//! - the Kigi-native skill is always present regardless of toggles
//! - each of the 6 (vendor x surface) cells toggles independently
//! - a vendor-shipped default skill (`shell`) under `~/.cursor` is always
//! dropped by the denylist
@@ -33,7 +33,7 @@ where
/// Unique markers placed in skill descriptions / file contents so assertions
/// can't be fooled by incidental occurrences of a bare word like "shell".
const MARKER_GROK_SKILL: &str = "ZZ_GROK_SKILL_MARKER";
const MARKER_KIGI_SKILL: &str = "ZZ_KIGI_SKILL_MARKER";
const MARKER_CURSOR_SKILL: &str = "ZZ_CURSOR_SKILL_MARKER";
const MARKER_CURSOR_SHELL: &str = "ZZ_CURSOR_SHELL_DENYLISTED_MARKER";
const MARKER_CLAUDE_SKILL: &str = "ZZ_CLAUDE_SKILL_MARKER";
@@ -63,7 +63,7 @@ fn write_skill(home: &Path, vendor_dir: &str, name: &str, marker: &str) {
/// Populate a fake `$HOME` + repo cwd with the full vendor-compat fixture set.
fn seed_fixtures(home: &Path, cwd: &Path) {
// Skills (User scope, home-based).
write_skill(home, ".kigi", "grok-skill", MARKER_GROK_SKILL);
write_skill(home, ".kigi", "kigi-skill", MARKER_KIGI_SKILL);
write_skill(home, ".cursor", "my-cursor-skill", MARKER_CURSOR_SKILL);
// `shell` is a Cursor vendor-default → must be denylisted under ~/.cursor.
write_skill(home, ".cursor", "shell", MARKER_CURSOR_SHELL);
@@ -102,7 +102,7 @@ async fn run_scenario(env: &[(&str, &str)]) -> String {
let home = tempfile::TempDir::new().expect("create temp home");
seed_fixtures(home.path(), workdir.path());
let client = GrokStdioClient::spawn_with_home_and_env(&server, workdir.path(), home, env).await;
let client = KigiStdioClient::spawn_with_home_and_env(&server, workdir.path(), home, env).await;
client.initialize_with_timeout().await;
let session_id = client.create_session_with_timeout(workdir.path()).await;
let _ = client.prompt_with_timeout(&session_id, "hello").await;
@@ -122,7 +122,7 @@ async fn run_scenario(env: &[(&str, &str)]) -> String {
// ── Skills ──────────────────────────────────────────────────────────────────
/// Defaults (all vendors on): grok + cursor-vendor + claude-vendor skills present; the
/// Defaults (all vendors on): kigi + cursor-vendor + claude-vendor skills present; the
/// denylisted vendor builtin `shell` is dropped.
#[tokio::test]
#[ignore] // requires pre-built binary
@@ -130,8 +130,8 @@ async fn vendor_compat_defaults_include_vendor_skills_but_drop_denylisted() {
with_local_set(|| async {
let body = run_scenario(&[]).await;
assert!(
body.contains(MARKER_GROK_SKILL),
"grok-skill must always be present"
body.contains(MARKER_KIGI_SKILL),
"kigi-skill must always be present"
);
assert!(
body.contains(MARKER_CURSOR_SKILL),
@@ -149,15 +149,15 @@ async fn vendor_compat_defaults_include_vendor_skills_but_drop_denylisted() {
.await;
}
/// `KIGI_CURSOR_SKILLS_ENABLED=false` drops the cursor-vendor skill; grok stays.
/// `KIGI_CURSOR_SKILLS_ENABLED=false` drops the cursor-vendor skill; kigi stays.
#[tokio::test]
#[ignore] // requires pre-built binary
async fn vendor_compat_cursor_skills_disabled() {
with_local_set(|| async {
let body = run_scenario(&[("KIGI_CURSOR_SKILLS_ENABLED", "false")]).await;
assert!(
body.contains(MARKER_GROK_SKILL),
"grok-skill always present"
body.contains(MARKER_KIGI_SKILL),
"kigi-skill always present"
);
assert!(
!body.contains(MARKER_CURSOR_SKILL),
@@ -169,15 +169,15 @@ async fn vendor_compat_cursor_skills_disabled() {
.await;
}
/// `KIGI_CLAUDE_SKILLS_ENABLED=false` drops the claude-vendor skill; grok stays.
/// `KIGI_CLAUDE_SKILLS_ENABLED=false` drops the claude-vendor skill; kigi stays.
#[tokio::test]
#[ignore] // requires pre-built binary
async fn vendor_compat_claude_skills_disabled() {
with_local_set(|| async {
let body = run_scenario(&[("KIGI_CLAUDE_SKILLS_ENABLED", "false")]).await;
assert!(
body.contains(MARKER_GROK_SKILL),
"grok-skill always present"
body.contains(MARKER_KIGI_SKILL),
"kigi-skill always present"
);
assert!(
!body.contains(MARKER_CLAUDE_SKILL),
@@ -307,7 +307,7 @@ async fn vendor_compat_all_cursor_disabled() {
assert!(!body.contains(MARKER_CURSOR_SHELL));
assert!(!body.contains(MARKER_CURSOR_RULE));
assert!(!body.contains(MARKER_CURSOR_AGENTS));
assert!(body.contains(MARKER_GROK_SKILL), "grok always present");
assert!(body.contains(MARKER_KIGI_SKILL), "kigi always present");
assert!(body.contains(MARKER_CLAUDE_SKILL), "claude unaffected");
assert!(body.contains(MARKER_CLAUDE_RULE), "claude unaffected");
assert!(body.contains(MARKER_CLAUDE_AGENTS), "claude unaffected");
@@ -330,7 +330,7 @@ async fn vendor_compat_all_claude_disabled() {
assert!(!body.contains(MARKER_CLAUDE_SKILL));
assert!(!body.contains(MARKER_CLAUDE_RULE));
assert!(!body.contains(MARKER_CLAUDE_AGENTS));
assert!(body.contains(MARKER_GROK_SKILL), "grok always present");
assert!(body.contains(MARKER_KIGI_SKILL), "kigi always present");
assert!(body.contains(MARKER_CURSOR_SKILL), "cursor unaffected");
assert!(body.contains(MARKER_CURSOR_RULE), "cursor unaffected");
assert!(body.contains(MARKER_CURSOR_AGENTS), "cursor unaffected");
@@ -339,7 +339,7 @@ async fn vendor_compat_all_claude_disabled() {
.await;
}
/// All vendor compat OFF: only grok-native skill survives.
/// All vendor compat OFF: only kigi-native skill survives.
#[tokio::test]
#[ignore] // requires pre-built binary
async fn vendor_compat_all_vendors_disabled() {
@@ -353,7 +353,7 @@ async fn vendor_compat_all_vendors_disabled() {
("KIGI_CLAUDE_AGENTS_ENABLED", "false"),
])
.await;
assert!(body.contains(MARKER_GROK_SKILL), "grok always present");
assert!(body.contains(MARKER_KIGI_SKILL), "kigi always present");
assert!(!body.contains(MARKER_CURSOR_SKILL));
assert!(!body.contains(MARKER_CURSOR_SHELL));
assert!(!body.contains(MARKER_CURSOR_RULE));