From ead796890bb2536ebbfc54ce351f4ab1ab62f650 Mon Sep 17 00:00:00 2001 From: Edward Langley Date: Tue, 22 Sep 2026 21:43:19 -0700 Subject: [PATCH] The aggregate paste decline no longer sends the user into a drill (improvise-48jd) Inside a drill p declines too, so 'drill in to paste' led to a second refusal. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze --- context/test-evidence/command.md | 13 +++++++++ .../improvise-command/src/command/cmd/cell.rs | 28 +++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/context/test-evidence/command.md b/context/test-evidence/command.md index a00efc3a..6d36571e 100644 --- a/context/test-evidence/command.md +++ b/context/test-evidence/command.md @@ -5074,3 +5074,16 @@ Pins that "aggregate" is asked of the key, not of the view. It passes at reads only whether the view has a regular category on None, which fails it — that rival would silently turn every scripted `paste` with full coordinates into a no-op on an aggregating view. + +### the_aggregate_decline_does_not_send_the_user_where_paste_also_declines + +improvise-48jd, from the #184 review. The aggregate decline said "drill in to +paste into a record", and inside the drill `p` answers `PASTE_INSIDE_DRILL`, so +the advice led to a second refusal. The test follows the advice literally: `p` +on the West aggregate, `>` into its drill, cursor onto the `Revenue` column, `p` +again. It asserts that the drilled paste really is the decline, so the setup +cannot pass by landing on "no cell at cursor". A first version of the test did +exactly that, because West had no record to drill into. It then asserts that +the first message does not mention drilling. At `0ed2e41` it failed with the +old text. The rival is restoring that text. Real drill paste, which means +staging a typed `CellValue`, is still open as improvise-48jd. diff --git a/crates/improvise-command/src/command/cmd/cell.rs b/crates/improvise-command/src/command/cmd/cell.rs index e8677f8c..a68c30b8 100644 --- a/crates/improvise-command/src/command/cmd/cell.rs +++ b/crates/improvise-command/src/command/cmd/cell.rs @@ -317,6 +317,31 @@ mod tests { ); } + #[test] + fn the_aggregate_decline_does_not_send_the_user_where_paste_also_declines() { + let mut app = aggregated_app(crate::view::Axis::None); + app.model_state.workbook.model.set_cell( + record("West", "Revenue").with("Product", "Gadget"), + CellValue::Number(3.0), + ); + app.rebuild_layout(); + press(&mut app, 'p'); + let advice = app.view_state.status_msg.clone(); + press(&mut app, '>'); + assert!(app.drill_state.is_some(), "setup: the aggregate drills"); + app.cursor_mut().selected = (0, col_of(&app, "Revenue")); + press(&mut app, 'p'); + let in_drill = app.view_state.status_msg.clone(); + assert_eq!( + in_drill, PASTE_INSIDE_DRILL, + "setup: the drilled paste declines" + ); + assert!( + !advice.to_lowercase().contains("drill"), + "{advice:?} sends the user into a drill, where p answers {in_drill:?}" + ); + } + #[test] fn paste_with_an_explicit_full_key_writes_even_where_the_view_aggregates() { let app = aggregated_app(crate::view::Axis::None); @@ -454,8 +479,7 @@ fn aggregates(ctx: &CmdContext, key: &CellKey) -> bool { }) } -const PASTE_ONTO_AGGREGATE: &str = - "Cannot paste onto an aggregate — drill in to paste into a record"; +const PASTE_ONTO_AGGREGATE: &str = "Cannot paste onto an aggregate — it combines several records, so there is no one cell to write"; const PASTE_ONTO_NO_VALUE: &str = "Paste lands only on a measure column"; const PASTE_INSIDE_DRILL: &str = "Paste is not staged inside a drill — edit the cell instead";