mirror of
https://github.com/openai/codex.git
synced 2026-11-21 22:50:37 +00:00
## Why `codex-core` still had a `test-support` crate feature that was enabled by multiple consumers (`core_test_support`, `app_test_support`, and `codex-tui` dev-deps). That introduced a second feature-resolved shape of `codex-core`, which increases compile cost and cache fragmentation across the workspace. The same root issue previously affected `deterministic_process_ids`: we were using crate features as a test/runtime switch, and Cargo had to build extra variants of a very large crate. ## What Changed ### 1) Remove `test-support` as a crate feature - Deleted the feature declaration from `core/Cargo.toml`. - Removed `features = ["test-support"]` from: - `core/tests/common/Cargo.toml` - `app-server/tests/common/Cargo.toml` - `tui/Cargo.toml` (dev-dependency) - Removed Bazel `crate_features = ["test-support"]` from `core/BUILD.bazel`. ### 2) Keep test behavior without feature-gated crate variants - Converted test-only behavior toggles to **explicit runtime switches** backed by `AtomicBool`: - thread-manager test mode toggle - deterministic unified-exec process-id toggle - Enabled those toggles from `core_test_support` ctor so integration tests keep deterministic and test-friendly behavior. ### 3) Replace feature-gated helper APIs with always-compiled hidden helpers - APIs that were previously behind `#[cfg(feature = "test-support")]` are now available as `#[doc(hidden)]` test helpers, avoiding feature-split builds while preserving existing test call sites. ## Expected Benefits ### Concrete dependency-graph effect `cargo tree -p codex-core -e features` now shows only the default feature path for `codex-core`; there are no `test-support` or `deterministic_process_ids` feature edges remaining. ### Build-performance impact - Eliminates feature-driven duplicate `codex-core` compilation variants. - Improves cache reuse across test-support consumers that previously forced separate feature resolution. - Reduces rebuild churn when switching between targets that did and did not depend on the feature-enabled `codex-core` shape. ## Safety / behavior notes - Production behavior remains unchanged by default. - Test-only behavior is now explicit and opt-in via dedicated test toggles, with docstrings clarifying these must stay at default values in production. ## Validation - `just fmt` - `cargo test -p codex-core unified_exec::` - `cargo test -p codex-core --test all unified_exec -- --test-threads=1` - `cargo check -p app_test_support` - `cargo check -p codex-tui --tests` - `cargo check -p codex-core` - `cargo tree -p codex-core -e features`
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
load("//:defs.bzl", "codex_rust_crate")
|
|
|
|
codex_rust_crate(
|
|
name = "core",
|
|
crate_name = "codex_core",
|
|
compile_data = glob(
|
|
include = ["**"],
|
|
exclude = [
|
|
"**/* *",
|
|
"BUILD.bazel",
|
|
"Cargo.toml",
|
|
],
|
|
allow_empty = True,
|
|
),
|
|
integration_compile_data_extra = [
|
|
"//codex-rs/apply-patch:apply_patch_tool_instructions.md",
|
|
"models.json",
|
|
"prompt.md",
|
|
],
|
|
test_data_extra = [
|
|
"config.schema.json",
|
|
# This is a bit of a hack, but empirically, some of our integration tests
|
|
# are relying on the presence of this file as a repo root marker. When
|
|
# running tests locally, this "just works," but in remote execution,
|
|
# the working directory is different and so the file is not found unless it
|
|
# is explicitly added as test data.
|
|
#
|
|
# TODO(aibrahim): Update the tests so that `just bazel-remote-test`
|
|
# succeeds without this workaround.
|
|
"//:AGENTS.md",
|
|
],
|
|
integration_deps_extra = ["//codex-rs/core/tests/common:common"],
|
|
test_tags = ["no-sandbox"],
|
|
extra_binaries = [
|
|
"//codex-rs/linux-sandbox:codex-linux-sandbox",
|
|
"//codex-rs/rmcp-client:test_stdio_server",
|
|
"//codex-rs/rmcp-client:test_streamable_http_server",
|
|
"//codex-rs/cli:codex",
|
|
],
|
|
)
|