Skip to content

revert: import.rs#1480

Merged
TinyKitten merged 1 commit intodevfrom
fix/revert-import-rs
Apr 11, 2026
Merged

revert: import.rs#1480
TinyKitten merged 1 commit intodevfrom
fix/revert-import-rs

Conversation

@TinyKitten
Copy link
Copy Markdown
Member

@TinyKitten TinyKitten commented Apr 11, 2026

概要

実際は必要のなかったインポートコードの巻き戻し

変更の種類

  • バグ修正
  • 新機能
  • データの修正・追加
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

テスト

  • cargo fmt --all -- --check が通ること
  • cargo clippy -- -D warnings が通ること
  • cargo testSQLX_OFFLINE=true)が通ること

関連Issue

スクリーンショット(任意)

Summary by CodeRabbit

Bug Fixes

  • CSV インポート処理を簡素化しました。スキーマベースの列選択ロジックを削除し、CSVファイルの位置に基づいて列をマッピングするように変更しました。# で始まるカラムヘッダーはコメント列として自動的に除外されます。

@TinyKitten TinyKitten self-assigned this Apr 11, 2026
@github-actions github-actions bot added the fix 直した label Apr 11, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

📝 Walkthrough

ウォークスルー

CSV インポートの動的スキーマベース列選択が削除されました。既存の情報スキーマ列の取得、列マッピングの構築、および関連する警告・テストが除去され、INSERT 文生成がシンプル化されました。# で始まるヘッダー列がコメントとして除外され、空フィールドが NULL に、その他のフィールドが SQL エスケープされた文字列リテラルとして挿入されます。

変更内容

コホート / ファイル(s) 概要
CSV インポート簡素化
stationapi/src/import.rs
スキーマ検証とカラムマッピング処理の削除。# プレフィックスコメント判定によるフィルタリング、デフォルト値の直接挿入、SQL エスケープ処理の統一。fetch_table_columnsbuild_insert_columnsimport_tests コードパスを削除。

見積りコードレビュー工数

🎯 3 (中程度) | ⏱️ ~20 分

うさぎが歌う CSV の歌 🐰
スキーマ検査はもう不要
シンプルな流れ、素直な道

マークで comment をふるい落とし

デフォルト値も NULL も優しく
インポートの道、今はまっすぐに 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive タイトル「revert: import.rs」は変更内容と関連していますが、何を巻き戻したのかという具体性に欠けています。 より具体的なタイトルに変更してください。例:「revert: remove dynamic schema-based column selection in import.rs」
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description check ✅ Passed 説明テンプレートのほとんどのセクションが記入されていますが、「変更内容」と「関連Issue」のセクションが空白のままです。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/revert-import-rs

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@stationapi/src/import.rs`:
- Around line 115-137: Build a column-name list from headers (skipping headers
whose name starts with '#') and use that list in the INSERT statement instead of
relying on VALUES-only; specifically, where sql_lines_inner.push(format!("INSERT
INTO public.{table_name} VALUES ")); is produced, construct a comma-separated
string of the non-excluded header names in the same order you generate values
(the same filter logic used on headers inside the csv_data loop), then change
the INSERT to sql_lines_inner.push(format!("INSERT INTO public.{table_name}
({cols}) VALUES ")); ensure the cols string is derived from the same
headers/indices used when producing each row (so
csv_data.iter().enumerate()/headers filter_map remains aligned) and keep using
escape_sql_string for values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b4401e8b-c970-4603-910e-31dadbcf1257

📥 Commits

Reviewing files that changed from the base of the PR and between 07c56a5 and b82d223.

📒 Files selected for processing (1)
  • stationapi/src/import.rs

@TinyKitten TinyKitten merged commit 530c3b5 into dev Apr 11, 2026
11 checks passed
@TinyKitten TinyKitten deleted the fix/revert-import-rs branch April 11, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 直した

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant