chore: address Andre's feedback on --save-results and CLI preview#335
Merged
johnnygreco merged 8 commits intomainfrom Feb 19, 2026
Merged
Conversation
Console(record=True) still prints to stdout by default. Use file=io.StringIO() to redirect output so save-path calls only write to disk.
When --save-results is used, records and the analysis report are no longer printed to the terminal. Extracted save logic into a dedicated _save_preview_results method and updated option help text accordingly.
Prev/next buttons and arrow keys now cycle back to the beginning/end instead of clamping at boundaries.
The pager shell was hardcoded dark, so --theme light produced light records inside a dark frame. Extract CSS variables into dark/light constants and pass the theme from the controller.
The module-level Console() had no width limit, so tables with expand=True stretched to the full terminal width. Cap terminal output at min(terminal_width, display_width) and thread the display_width parameter through the controller's display methods.
Remove "Only applies when --save-results is used" from --display-width since it now also affects terminal output.
Contributor
Greptile SummaryThis PR improves the Key Changes
|
| Filename | Overview |
|---|---|
| packages/data-designer/src/data_designer/cli/controllers/generation_controller.py | Refactored --save-results to skip terminal display, extracted save logic into _save_preview_results, and threaded display_width through all display methods |
| packages/data-designer-config/src/data_designer/config/utils/visualization.py | Prevented spurious stdout when saving by using io.StringIO(), and capped terminal display width at min(terminal_width, display_width) |
| packages/data-designer-config/src/data_designer/config/analysis/utils/reporting.py | Fixed spurious stdout by using io.StringIO() when recording console output for file saves |
| packages/data-designer/src/data_designer/cli/utils/sample_records_pager.py | Added light theme support and wrap-around navigation (modulo arithmetic) for the HTML pager browser |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[run_preview called] --> B{save_results flag?}
B -->|True| C[_save_preview_results]
B -->|False| D{interactive mode?}
C --> C1[Create timestamped directory]
C1 --> C2[Save analysis report HTML]
C2 --> C3[Save dataset parquet]
C3 --> C4[Loop: Save each record HTML]
C4 --> C5[create_sample_records_pager with theme]
C5 --> C6[Log paths only, no terminal display]
D -->|Yes| E[_browse_records_interactively]
D -->|No| F[_display_all_records]
E --> E1[Display record with header]
E1 --> E2[wait_for_navigation_key]
E2 -->|n/enter| E3[index = index + 1 mod total]
E2 -->|p| E4[index = index - 1 + total mod total]
E2 -->|q| E5[Exit loop]
E3 --> E1
E4 --> E1
E5 --> G[Display analysis to console]
F --> F1[Loop through all records]
F1 --> F2[_display_record_with_header]
F2 --> G
C6 --> H[Complete]
G --> H
I[display_sample_record] --> J{save_path provided?}
J -->|Yes| K[Create Console with io.StringIO]
J -->|No| L[Create Console with capped width]
K --> M[Record output]
L --> N[Display to terminal]
M --> O[Save as HTML/SVG with theme]
style C fill:#e1f5ff
style E fill:#fff4e1
style F fill:#fff4e1
style K fill:#e8f5e9
style L fill:#e8f5e9
Last reviewed commit: d9232f5
…ve_results behavior
johnnygreco
commented
Feb 18, 2026
Comment on lines
148
to
151
| if save_path is not None: | ||
| recording_console = Console(record=True, file=io.StringIO()) | ||
| recording_console.print(Group(*render_list), markup=False) | ||
| save_path = str(save_path) |
Contributor
Author
There was a problem hiding this comment.
don't print to the terminal when --save-results is passed
johnnygreco
commented
Feb 18, 2026
Comment on lines
-56
to
-62
| """Generate a preview dataset for fast iteration on your configuration. | ||
|
|
||
| Preview results are displayed in the terminal. Use this to quickly validate | ||
| your configuration before running a full dataset creation. | ||
|
|
||
| By default, records are displayed one at a time in interactive mode. Use | ||
| --non-interactive to display all records at once (also used automatically |
Contributor
Author
There was a problem hiding this comment.
didn't realize the entire docstring prints on --help
johnnygreco
commented
Feb 18, 2026
Comment on lines
+258
to
+272
| _LIGHT_CSS_VARS = """\ | ||
| color-scheme: light; | ||
| --panel: rgba(255, 255, 255, 0.92); | ||
| --border: rgba(0, 0, 0, 0.12); | ||
| --text: #1a1a2e; | ||
| --muted: #5a6078; | ||
| --shadow: 0 16px 44px rgba(0, 0, 0, 0.08); | ||
| --body-bg: linear-gradient(180deg, #f0f2f8 0%, #e8eaf0 45%, #f5f6fa 100%); | ||
| --topbar-bg: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, rgba(248,249,252,0.98) 100%); | ||
| --btn-bg: linear-gradient(180deg, rgba(255,255,255,0.9) 0%, rgba(240,242,248,0.95) 100%); | ||
| --btn-hover-border: rgba(59, 130, 246, 0.6); | ||
| --btn-hover-glow: 0 0 0 3px rgba(59, 130, 246, 0.12); | ||
| --frame-bg: rgba(255, 255, 255, 0.95);""" | ||
|
|
||
|
|
Contributor
Author
There was a problem hiding this comment.
makes the full browser light
andreatgretel
approved these changes
Feb 19, 2026
Contributor
andreatgretel
left a comment
There was a problem hiding this comment.
thanks, looks pretty good!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Summary
Addresses Andre's feedback on the
--save-resultsCLI feature and preview UX. Key changes include making--save-resultsskip terminal display (write-only), suppressing spurious stdout when saving to file, capping terminal display width, threading--themethrough to the pager shell, adding wrap-around navigation, and removing theallow_resizefeature from the batch pipeline.🔄 Changes
✨ Added
--themenow applies to the pager shell, not just individual record HTML filestest_sample_records_pager.py)🔧 Changed
--save-resultsnow writes artifacts to disk without displaying sample records in the terminal (previously did both)--display-widthviamin(terminal_width, display_width)instead of usingdisplay_widthunconditionallydisplay_sample_recordandgenerate_analysis_reportuseio.StringIO()as the console file when recording, preventing spurious stdout--display-widthand--themehelp text updated to be clearerDatasetBatchManager.replace_buffersplit intoupdate_records(strict 1:1) andreplace_buffer(allows resize for processors)_save_preview_resultsinto its own method onGenerationControllerrecord_seriesfixture across visualization tests🗑️ Removed
allow_resizefeature — removedallow_resizefield fromSingleColumnConfig, all resize logic fromCustomColumnGenerator,ColumnWiseDatasetBuilder, andDatasetBatchManager(~590 lines removed)example_allow_resize.pydemo scriptcustom_columns.mdandexample.mdtest_custom.py,test_column_wise_builder.py,test_dataset_batch_manager.py)🔍 Attention Areas
generation_controller.py— Core logic change:--save-resultsnow skips terminal display entirely; the save vs display paths are now mutually exclusivedataset_batch_manager.py—replace_buffer/update_recordssplit — verify the processor pipeline still usesreplace_buffercorrectlycolumn_wise_builder.py— Significant simplification from removing all resize bookkeeping🤖 Generated with AI