Add cwd-relative turn diff paths (#39625)

## What changed

- Add the opt-in `cwd_relative_turn_diffs` feature.
- When enabled, render turn diff paths relative to each selected environment's
  working directory instead of the detected Git root.
- Preserve repository-root-relative paths when the feature is disabled.

## Testing

- Cover enabled and disabled behavior for nested working directories across
  supported originators.

GitOrigin-RevId: 8b4908706a82b01f33ccd035b0945f9a29fce26f
This commit is contained in:
philn-oai
2026-08-19 22:24:33 +00:00
committed by copyberry
parent 52e387daca
commit e396ef3fc1
5 changed files with 154 additions and 1 deletions

View File

@@ -146,6 +146,8 @@ pub enum Feature {
ShellSnapshot,
/// Allow turns to start while selected executors are still starting.
DeferredExecutor,
/// Use the current working directory for turn diff display paths.
CwdRelativeTurnDiffs,
/// Enable runtime metrics snapshots via a manual reader.
RuntimeMetrics,
/// Enable startup memory extraction and file-backed memory consolidation.
@@ -874,6 +876,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::CwdRelativeTurnDiffs,
key: "cwd_relative_turn_diffs",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::JsRepl,
key: "js_repl",

View File

@@ -59,6 +59,26 @@ fn executor_capability_discovery_is_an_opt_in_map_feature() {
assert!(features.enabled(Feature::ExecutorCapabilityDiscovery));
}
#[test]
fn cwd_relative_turn_diffs_is_an_opt_in_map_feature() {
let mut features = Features::with_defaults();
assert!(!features.enabled(Feature::CwdRelativeTurnDiffs));
features.apply_map(&BTreeMap::from([(
"cwd_relative_turn_diffs".to_string(),
true,
)]));
assert!(features.enabled(Feature::CwdRelativeTurnDiffs));
features.apply_map(&BTreeMap::from([(
"cwd_relative_turn_diffs".to_string(),
false,
)]));
assert!(!features.enabled(Feature::CwdRelativeTurnDiffs));
}
#[test]
fn default_enabled_features_are_stable() {
for spec in crate::FEATURES {