Files
codex/prs/bolinfest/study/PR-2435-study.md
2025-09-02 15:17:45 -07:00

83 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
**DOs**
- **Sync Docs With Enums**: When changing `ReasoningEffort` (e.g., removing `None`), update `config.md` to match supported values.
```rust
// protocol/src/config_types.rs
#[derive(Debug, Serialize, Deserialize, Default, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum ReasoningEffort {
Minimal,
Low,
#[default]
Medium,
High,
}
```
```md
<!-- config.md -->
Supported: "minimal", "low", "medium" (default), "high".
Note: to minimize reasoning, choose "minimal".
```
- **Make Esc Cancel**: Bind `Esc` to cancel/close popups; reserve `Enter` for accept.
```rust
match key_event {
KeyEvent { code: KeyCode::Esc, .. } => self.cancel(),
KeyEvent { code: KeyCode::Enter, modifiers: KeyModifiers::NONE, .. } => self.accept(),
KeyEvent { code: KeyCode::Up, .. } => self.move_up(),
KeyEvent { code: KeyCode::Down, .. } => self.move_down(),
_ => {}
}
```
- **Add Clear Titles To Popups**: Provide a title (and optional subtitle/footer hint) for selection views.
```rust
// bottom_pane/mod.rs
bottom_pane.show_selection_view(
"Select model and reasoning level".to_string(),
Some("Affects this and future Codex CLI session".to_string()),
Some("Enter: confirm • Esc: cancel".to_string()),
items,
);
```
```rust
// In the view's render()
let title_para = Paragraph::new(Line::from(vec![
Span::styled("▌ ", Style::default().add_modifier(Modifier::DIM)),
Span::styled(self.title.clone(), Style::default().add_modifier(Modifier::BOLD)),
]));
title_para.render(title_area, buf);
```
**DONTs**
- **Dont Document Removed Values**: Avoid referencing `"none"` in docs once the enum no longer supports it.
```md
<!-- Bad -->
model_reasoning_effort = "none" # disable reasoning
<!-- Good -->
# Use "minimal" to minimize reasoning.
```
- **Dont Bind Esc To Accept**: Esc should never trigger selection actions.
```rust
// Bad
KeyEvent { code: KeyCode::Esc, .. } => self.accept(),
// Good
KeyEvent { code: KeyCode::Esc, .. } => self.cancel(),
```
- **Dont Ship Untitled Popups**: Avoid selection popups without a visible, descriptive title.
```rust
// Bad: missing title/subtitle/footer
ListSelectionView::new(items, app_event_tx);
// Good: clear, guided UI
ListSelectionView::new(
"Choose preset".to_string(),
Some("Applies model and reasoning effort".to_string()),
Some("Enter to confirm, Esc to cancel".to_string()),
items,
app_event_tx,
);
```