Expand description
cargo xtask codex-schema drift [--dir <dump-dir>] [--json] [--strict] -
diffs the vendored schema/methods.json + schema/CODEX_VERSION.txt
against a fresh codex app-server generate-json-schema dump (or an
existing dump directory passed via --dir), so an upstream codex
version bump that adds, removes, or renames a method can’t silently slip
past the version-string-only staleness check in
crates/shared/codex-app-server-client/build.rs.
Reuses regen’s exact schema-load + manifest-build code path
(load_combined_defs + merge::build_methods_manifest) to build the
“installed” manifest in memory - this module never reimplements schema
parsing or method extraction, it only diffs two already-built manifests.
See crates/shared/codex-app-server-client/README.md’s “Regenerating the
schema” section, build.rs’s non-fatal staleness warning, and
codex_app_server_client::compat::CompatibilityReport (schema-version +
method-count only) for the prior art this check sharpens into a real diff.
Structs§
- Changed
Method 🔒 - Drift
Options 🔒 - Drift
Report 🔒 - Method
Entry 🔒 - Method
Signature 🔒 - One method’s diffable signature: everything about it other than its name
that
regenderives from the schema. Notification entries never carry aresponse_typekey in the manifest JSON, soresponse_typeisNonefor every notification-section entry - correctly comparing “no key” in both vendored and installed as equal, rather than a spurious “changed”. - Section
Diff 🔒 - Version
Delta 🔒
Enums§
- Outcome 🔒
Constants§
- SECTIONS 🔒
- Section names in the vendored/installed
methods.jsonshape, in the fixed order the report is always rendered in. - USAGE 🔒
Functions§
- build_
installed_ 🔒manifest - Builds the “installed” manifest via the exact same code path
regenuses to writemethods.json(load_combined_defs+build_methods_manifest), then converts it to aValueso it can be diffed with the same section-shaped logic as the vendored JSON file - no separate parsing path to drift out of sync with the real one. - build_
report 🔒 - codex_
version_ 🔒or_ skip - Runs
codex --versionand distinguishes “codex is not on PATH at all” (the one condition this check must never hard-fail on) from every other failure mode (codex present but broken), which are real errors. - compute_
outcome 🔒 - Builds the diff outcome: either a skip reason (no
codexon PATH and no--dir) or a fullDriftReport. Keeps the temp dump directory (when one is created) alive for the duration of the manifest build via the returnedTempDirguard’s drop timing. - diff_
section 🔒 - Diffs one section (
client_requests,server_requests,server_notifications, orclient_notifications) between the vendored and installed manifests.added/removed/changedare each sorted by method name for stable, scannable output regardless of the underlyingBTreeMapiteration order (which is already method-name order, but the explicit sort documents the intent and survives a future change to how the maps are built). - generate_
fresh_ 🔒dump - Shells out to the exact command documented in this crate’s
regenworkflow (codex_schema.rs’sprint_help) to produce a fresh dump. - installed_
version_ 🔒best_ effort - Best-effort installed-version lookup for
--dirmode:codexis purely informational there (the dump already exists), so any failure is silently treated as “unknown” rather than blocking the diff - mirrorsbuild.rs’scheck_codex_staleness. - load_
vendored_ 🔒manifest - load_
vendored_ 🔒version - parse_
args 🔒 - print_
human_ 🔒report - run
- section_
map 🔒 - Parses one manifest’s section array (
client_requests, etc.) into amethod -> signaturemap. Shared by both the vendored JSON file and the installed manifest (also serialized toValue), so both sides go through identical extraction logic - a field name typo here would otherwise show up as one specific, hard-to-diagnose false “changed” or “added”/“removed” pair instead of a loud, obvious error.