| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ad of hardcoding TEXT
There was a problem hiding this comment.
Reviewer: Pre-PR Code Analyzer
Date: 2026-08-08
Verdict: REQUEST_CHANGES
This PR improves generate_schema to infer primitive column types (INTEGER, DOUBLE, etc.) instead of hardcoding TEXT for primitive arrays. The change is well-tested with 3 new regression tests covering int/float/bool arrays across PostgreSQL, MySQL, and SQLite dialects.
1. Edge case: mixed-type primitive arrays
The inference uses sql_type_for(data[0], ...) — it only looks at the first element. If the array is [1, "hello", 3], the schema would declare INTEGER but the second value would fail to insert. Consider:
2. Empty array handling
col_type = sql_type_for(data[0], ...) if isinstance(data, list) and data else "TEXT" — the else "TEXT" covers empty arrays correctly, but the conditional is dense. A comment would help.
3. Age/contributor gate
This PR is less than 6 hours old and has only 1 commit from 1 contributor. Per the review policy, PRs need either 6+ hours of age or 3+ distinct contributors before approval. This will be re-evaluated on the next rotation.
Sorry, something went wrong.
There was a problem hiding this comment.
Date: 2026-08-10
Verdict: BLOCKED (merge gates not met)
| Gate | Required | Current | Status |
|---|---|---|---|
| PR Age | 6+ hours | ~3 days | ✅ |
| Distinct Contributors | 3+ | 1 | ❌ |
| Reviewer Approvals | 3+ | 0 (1 REQUEST_CHANGES) | ❌ |
| CI Passing | All green | ensure-pr SUCCESS | ✅ |
| Security | No issues | Clean | ✅ |
| Substantive commit post-review | Yes | None since Aug 8 review | ❌ |
This PR will be re-evaluated on future rotations as gates are satisfied.
Sorry, something went wrong.
There was a problem hiding this comment.
Code quality: GOOD — the primitive type inference fix for generate_schema is correct and well-tested. The ruff formatting cleanup is clean.
Merge gate status: BLOCKED
| Gate | Required | Current | Status |
|---|---|---|---|
| PR age | >6 hours | ~5.5 days | ✅ |
| CI passing | all green | action_required (awaiting approval) | ❌ |
| Distinct contributors | ≥3 | 1 (github-actions bot) | ❌ |
| Reviewer approvals | ≥3 | 0 | ❌ |
Action needed:
No security concerns. No logic errors detected. Will re-review when gates clear.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
Pre-PR Code Review: REQUEST_CHANGES ⚠️Gate Violation: IMPROVE-BEFORE-MERGE This PR currently contains only its opening commit. Per the hard gate policy, PRs must have at least one substantive post-opening improvement or fix before approval for merge. Required Actions:
Current Status:
Review by: Pre-PR Code Analyzer (automated) |
Sorry, something went wrong.
Previously, primitive arrays sampled only the first element to determine column type. This caused [1, 'hello', 3] to be declared INTEGER and fail on INSERT. Now scans all elements with merge logic matching object-column inference, collapsing to TEXT when types are incompatible. Adds 5 regression tests for mixed-type primitive arrays.
🤖 Automated Code Review✅ Ruff Lint — No issues⚠️ Ruff Format — Formatting neededunformatted: File would be reformatted
--> tests/test_remaining_coverage.py:88:16
|
87 | assert result.exit_code != 0
- assert (
- "click_to_mcp" in result.output.lower()
- or "pip install" in result.output.lower()
- )
88 + assert "click_to_mcp" in result.output.lower() or "pip install" in result.output.lower()
|
unformatted: File would be reformatted
--> tests/test_type_inference.py:35:55
|
34 | """A string followed by an int must become TEXT, not a numeric type."""
- out = JSONToSQLConverter(dialect=dialect).convert(
- json.dumps([{"k": "hello"}, {"k": 100}])
- )
35 + out = JSONToSQLConverter(dialect=dialect).convert(json.dumps([{"k": "hello"}, {"k": 100}]))
36 | assert column_type(out, "k", dialect) == "TEXT"
--------------------------------------------------------------------------------
42 | """An int followed by a string must also become TEXT (order independence)."""
- out = JSONToSQLConverter(dialect=dialect).convert(
- json.dumps([{"k": 1}, {"k": "hello"}])
- )
43 + out = JSONToSQLConverter(dialect=dialect).convert(json.dumps([{"k": 1}, {"k": "hello"}]))
44 | assert column_type(out, "k", dialect) == "TEXT"
--------------------------------------------------------------------------------
55 | """A NULL first does not pin the column to TEXT; a later int wins."""
- out = JSONToSQLConverter(dialect=dialect).convert(
✅ Secret Detection — Clean✅ Large Files — Within limits📊 Diff Stats — 7 file(s) changed.github/workflows/cowork-auto-pr.yml | 2 +- conftest.py | 1 + src/json2sql/cli.py | 19 +++------- src/json2sql/converter.py | 61 ++++++++++++++---------------- src/json2sql/dialects.py | 12 +----- tests/test_cli.py | 22 +++-------- tests/test_converter.py | 73 ++++++++++++++++++++++++++++++++++++ 7 files changed, 116 insertions(+), 74 deletions(-) Verdict: ⚠️ Warnings — Lint/format issues found. Recommend fixing before merge. Automated by Coding-Dev-Tools/.github reusable workflow. |
Sorry, something went wrong.
Address automated code review bot formatting warnings on PR #38: - conftest.py: add blank line after module docstring - cli.py: collapse short string literals and expressions to single lines per ruff format preferences
…SERT branches The insert_sql function had byte-for-byte identical code blocks for Postgres (lines 109-116) and MySQL (lines 117-124). Consolidated into a single branch using 'dialect in (POSTGRES, MYSQL)' check, reducing 8 duplicated lines while preserving identical behavior. All 167 tests pass.
Address formatting issues flagged by automated code review bot on PR #38: - Collapse multi-line runner.invoke() calls that fit within line width - Remove unnecessary line wrapping in assertion expressions - All 167 tests pass
| Back | FazBrowse Home | New Git URL |
Automated improvement PR from the Cowork repo-improver rotation (one coherent senior-dev improvement per run; see individual commit messages). Subsequent runs push additional commits to this PR rather than opening new ones.