Skip to content

feat: 21 - profile command#21

Merged
joefrost01 merged 2 commits into
mainfrom
feat/21-profile-command
Apr 11, 2026
Merged

feat: 21 - profile command#21
joefrost01 merged 2 commits into
mainfrom
feat/21-profile-command

Conversation

@joefrost01
Copy link
Copy Markdown
Contributor

What problem are you trying to solve?

dtoo profile existed in the CLI but did nothing (Commands::Profile(_args) => Ok(())), so users could not run standalone profiling on a file as described by specs/21-profile-command.md. The user experience was a silent no-op command with no profile output.

What does this PR change?

Implements the standalone dtoo profile command path. It now resolves the input file, loads it into DuckDB (_profile_data and temp_results), and reuses the existing profiler module to emit JSON/CSV/HTML output to --output or stdout.

Does this change align with DESIGN.md?

Yes.

  • It keeps CLI conventions: profile output goes to stdout when --output is omitted.
  • It uses existing error handling (DtooError) and standard exit code mapping.
  • It does not alter query pipeline ordering; this is a standalone subcommand path.
  • No licensing boundary changes.

What alternatives did you consider?

  1. Re-implement profiling logic directly in a new profile command module. Rejected because it duplicates spec 10 behavior and increases maintenance risk.
  2. Call into full query pipeline with synthetic args. Rejected because feature 21 explicitly calls for a simpler standalone path without query pipeline overhead.
  3. Chosen: load input into temp tables then invoke existing Profiler module.

Does this PR contain multiple unrelated changes?

No. This PR only implements feature 21 (dtoo profile standalone command) and adds focused tests for it.

Existing PRs

  • I have reviewed all open AND closed PRs for duplicates or prior art
  • Related PRs: none found

Testing

  • cargo test passes
  • cargo clippy passes with no warnings
  • cargo fmt has been run
  • New tests added: Added profile_command::tests::profiles_csv_input_to_json_file and profile_command::tests::profiles_empty_csv_with_zero_rows to verify standalone profile generation for populated and empty CSV inputs.

Evaluation

  • What was the specific scenario you tested?
    • dtoo profile flow via unit tests using a temp CSV with rows.
    • dtoo profile flow via unit tests using a temp CSV header-only file (zero rows).
  • What was the output before and after the change?
    • Before: profile command returned success without producing a profile report.
    • After: profile command writes a JSON report (or stdout) with expected fields, including correct row_count.
  • Did you test error cases (bad input, missing files, invalid SQL)?
    • Yes: existing resolver/engine error paths are exercised by command wiring; missing input now propagates resolver errors instead of silently succeeding.

Human review

  • A human has reviewed the COMPLETE proposed diff before submission

@joefrost01 joefrost01 merged commit e2a9972 into main Apr 11, 2026
6 checks passed
@joefrost01 joefrost01 deleted the feat/21-profile-command branch April 11, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant