Skip to content

refactor: code quality improvements and documentation#53

Merged
genezhang merged 3 commits intomainfrom
refactor/code-quality-audit-jan27
Jan 28, 2026
Merged

refactor: code quality improvements and documentation#53
genezhang merged 3 commits intomainfrom
refactor/code-quality-audit-jan27

Conversation

@genezhang
Copy link
Copy Markdown
Owner

Changes

Documentation Improvements

  • Add module-level documentation to 7 analyzer files:

    • graph_join_inference.rs: Document JOIN generation architecture
    • filter_tagging.rs: Document filter optimization pass
    • projection_tagging.rs: Document RETURN clause processing
    • schema_inference.rs: Document type inference logic
    • graph_traversal_planning.rs: Document traversal patterns
    • duplicate_scans_removing.rs: Document scan deduplication
    • mod.rs: Document analyzer pass pipeline
  • Add 7 section markers to filter_tagging.rs for code organization

Code Quality Fixes

  • Add Default trait derivation for SqlDialect and ReplanOption enums
  • Add proper Default impl for QueryPerformanceMetrics
  • Fix redundant closure in parameter_substitution.rs
  • Fix unwrap_or_else(HashMap::new) → unwrap_or_default() (2 locations)
  • Fix format! in println! args in server/mod.rs

Technical Debt Documentation

  • plan_builder_utils.rs (47 dead functions - refactoring artifacts)
  • expression_utils.rs (9 dead items)
  • filter_pipeline.rs (5 dead items)
  • feature_flags.rs (refactoring scaffold)

Metrics

  • Clippy warnings: 570 → 503 (12% reduction)
  • All 832 unit tests passing
  • No functional changes

## Changes

### Documentation Improvements
- Add module-level documentation to 7 analyzer files:
  - graph_join_inference.rs: Document JOIN generation architecture
  - filter_tagging.rs: Document filter optimization pass
  - projection_tagging.rs: Document RETURN clause processing
  - schema_inference.rs: Document type inference logic
  - graph_traversal_planning.rs: Document traversal patterns
  - duplicate_scans_removing.rs: Document scan deduplication
  - mod.rs: Document analyzer pass pipeline

- Add 7 section markers to filter_tagging.rs for code organization

### Code Quality Fixes
- Add Default trait derivation for SqlDialect and ReplanOption enums
- Add proper Default impl for QueryPerformanceMetrics
- Fix redundant closure in parameter_substitution.rs
- Fix unwrap_or_else(HashMap::new) → unwrap_or_default() (2 locations)
- Fix format! in println! args in server/mod.rs

### Technical Debt Documentation
  - plan_builder_utils.rs (47 dead functions - refactoring artifacts)
  - expression_utils.rs (9 dead items)
  - filter_pipeline.rs (5 dead items)
  - feature_flags.rs (refactoring scaffold)

## Metrics
- Clippy warnings: 570 → 503 (12% reduction)
- All 832 unit tests passing
- No functional changes
@genezhang genezhang requested a review from Copilot January 28, 2026 01:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on improving code quality and documentation across the codebase without any functional changes. It reduces Clippy warnings by 12% (from 570 to 503) through idiomatic Rust improvements and adds comprehensive module-level documentation to help developers understand complex analyzer logic.

Changes:

  • Refactored Default trait implementations to use derive macros for enums and proper Default trait for structs
  • Fixed redundant closures and simplified format! usage in println! calls
  • Added comprehensive module documentation to 7 analyzer files explaining their architecture and responsibilities
  • Documented technical debt with explanations for dead code allowances

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/server/query_cache.rs Replaced manual Default impl with derive macro for ReplanOption enum
src/server/models.rs Replaced manual Default impl with derive macro for SqlDialect enum
src/server/handlers.rs Added proper Default impl for QueryPerformanceMetrics with new() delegating to default()
src/server/parameter_substitution.rs Fixed redundant closure by using direct function reference
src/server/mod.rs Simplified println! by removing unnecessary format! wrapper
src/server/bolt_protocol/handler.rs Replaced unwrap_or_else(HashMap::new) with unwrap_or_default() (2 instances)
src/render_plan/plan_builder_utils.rs Added technical debt documentation explaining 47 dead functions
src/render_plan/filter_pipeline.rs Added module documentation and explanation for dead code allowance
src/render_plan/feature_flags.rs Added status documentation for feature flags
src/render_plan/expression_utils.rs Added technical debt documentation
src/query_planner/analyzer/schema_inference.rs Added comprehensive 42-line module documentation
src/query_planner/analyzer/projection_tagging.rs Added comprehensive 37-line module documentation
src/query_planner/analyzer/mod.rs Added comprehensive 42-line pipeline overview documentation
src/query_planner/analyzer/graph_traversal_planning.rs Added comprehensive 39-line module documentation
src/query_planner/analyzer/graph_join_inference.rs Added comprehensive 29-line module documentation
src/query_planner/analyzer/filter_tagging.rs Added comprehensive 19-line module documentation and 7 section markers
src/query_planner/analyzer/duplicate_scans_removing.rs Added comprehensive 30-line module documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/render_plan/plan_builder_utils.rs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@genezhang genezhang merged commit 83dd4db into main Jan 28, 2026
1 check passed
@genezhang genezhang deleted the refactor/code-quality-audit-jan27 branch January 28, 2026 01:57
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.

2 participants