Repository navigation
Report invalid config section types without tracebacks (#126) - #144
Conversation
laaielichter
left a comment
There was a problem hiding this comment.
Thank you @amritkang165, this is a clean fix for #126. One small table_section helper replaces all the unchecked data.get(...) or {} reads, and treating 0, false, "" and [] as wrong types (instead of silently "missing") is exactly the right call.
I merged 18cf60d onto current main (2bdae73) and checked:
ruff check .passes;pytest -qgives 929 passed, 10 skipped. Your new tests fail on main (44 failed) and pass with your change (46 passed).- By hand through the real CLI:
budget = 3,connections = "x",[connections] x = 1,lint = 5(SQL string, a folder, and with--dialect),review = 3,approval = "cli". Each gives a one-line error naming the section and "must be a table ... not int/str",status: "error",next_step: "Fix gulliver.toml or the flags.", exit 1, no traceback.reviewprints its usual markdown error. The same holds via--dsn,GULLIVER_DSN,GULLIVER_CONFIGand agulliver.tomlin the working directory. - Valid files are unchanged:
gulliver.example.toml, an empty file, empty/inline tables and[budget]/[connections.x]overrides all load as before. - The diff touches no workflows, packages, network or exec code and has no personal data. The CHANGELOG line sits under
## Unreleasedabove## 0.4.0, and the docs/skill notes match what the CLI prints.
One behaviour to be aware of, not a blocker: gulliver --config missing.toml lint "SELECT 1" now reports "Config file not found" because the SQL-string path loads [lint]; before it quietly linted. That matches how file linting already behaves and seems right to me.
Our CI needs a maintainer to approve the workflow run for a fork PR, so it has not run yet. Once it is green this is good to merge, and we will add your credit to the release notes. Since you have #137 and #139 in flight too, a good next one is any open good first issue; I would suggest picking another config-validation one if you want to stay in this area.
Generated by Claude Code
|
@amritkang165 a heads-up: #147 landed today and added its line to Generated by Claude Code |
|
Good news: you no longer need to resolve the CHANGELOG conflict. We changed the rule so contributors don't edit CHANGELOG.md any more; we add your entry with credit when we merge. Easiest fix: drop your CHANGELOG.md change (or merge main and take main's version of the file) and push; the rest of the PR is unchanged. Generated by Claude Code |
laaielichter
left a comment
There was a problem hiding this comment.
Checked the head locally: full suite 1047 passed, 10 skipped; ruff check . clean. The #126 config from the issue crashed on main with a TypeError; on this head it returns status: error with "[connections.x] must be a table ..." and no traceback. The new tests fail on main (44 failures), so they cover the change.
Thanks @amritkang165 for the thorough section checks and tests.
Generated by Claude Code
What and why
A plain value where a config table belongs can crash Gulliver or silently fall back to defaults. This checks the types of
budget,connections, named connection entries,approval,lintandreviewbefore reading their keys. Invalid sections raiseConfigError, naming the section and the expected table type.The check also rejects empty strings, arrays, zero and false instead of treating them as missing sections. Missing sections and valid tables keep their defaults and overrides. SQL-string linting now validates its lint config as file linting already does.
Fixes #126. Includes regression tests and configuration guidance.
How it was tested
pytest -q: 1047 passed, 10 skipped (no live PostgreSQL test database configured)ruff check .: passedgit diff --check: passedThe initial regression run against the original code had 43 failures and two passing compatibility cases. The final tests cover all six affected sections, invalid scalar and array values, valid empty/inline tables, overrides, file linting and SQL-string linting with an explicit dialect.
Also ran all six issue examples through the real CLI. Each returns
status: "error", exit code 1 andnext_step: "Fix gulliver.toml or the flags.", without a traceback. For example,budget = 3now reports:Merged current main on 2026-11-15 and kept its CHANGELOG.md unchanged, following the updated contribution guide. The security self-test also passes all 151 corpus cases and all sandbox checks.