refactor!: remove build-kg --table-config and require explicit validate --schema - #64
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThe CLI now accepts only graph YAML files for ChangesCLI contract update
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant build_kg
participant build_pipeline
participant validate
participant ValidationPipeline
User->>build_kg: provide graph configuration
build_kg->>build_pipeline: forward configuration and build flags
build_pipeline->>build_pipeline: load Graph YAML
User->>validate: provide configuration and schema
validate->>ValidationPipeline: dispatch graph or table validation
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
tests/test_cover_cli.py (1)
204-224: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert rejection of removed build options.
Add parser assertions that
--table-config/-tcand--fullmap/-fmfail forbuild-kg. The current test locks supported configuration-file forms but does not lock removal of the deprecated options.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_cover_cli.py` around lines 204 - 224, Extend test_build_kg_configuration_file_flag_parses to assert cli.APP.parse_args rejects build-kg invocations using the removed --table-config/-tc and --fullmap/-fm options, while preserving the existing positional and configuration-file flag assertions.tests/test_cli_validation.py (1)
66-80: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTest the required CLI option through the parser.
These direct
validate()calls bypass Cyclopts parsing. Addcli.APP.parse_args()coverage forvalidatewith-sor--schema, and assert that omission of the option fails. This protects the required CLI contract.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_cli_validation.py` around lines 66 - 80, The test_validate_command_selects_schema_explicitly test currently bypasses CLI parsing by calling validate directly. Add coverage using cli.APP.parse_args() for the validate command with both -s/--schema usage as appropriate, and assert parsing fails when --schema is omitted, while preserving the existing valid table and graph validation checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/cli.md`:
- Around line 135-138: Update the validation examples in the CLI documentation
to avoid the shell brace expression `{graph,table}`. Show separate concrete
commands using `--schema graph` and `--schema table`, preserving both
configuration-file invocation forms with and without `-f`.
In `@tests/test_agent_storage.py`:
- Around line 361-365: Update the workflow description near the test using
build_and_audit() to describe direct reuse of the best table configuration
through that Python API, rather than claiming it reads builds/<pmc>/graph.yaml
or invokes tablassert build-kg. Keep the stated requirements about referencing
the persisted absolute download path and supporting reuse from any cwd only if
they apply to this direct API flow.
---
Nitpick comments:
In `@tests/test_cli_validation.py`:
- Around line 66-80: The test_validate_command_selects_schema_explicitly test
currently bypasses CLI parsing by calling validate directly. Add coverage using
cli.APP.parse_args() for the validate command with both -s/--schema usage as
appropriate, and assert parsing fails when --schema is omitted, while preserving
the existing valid table and graph validation checks.
In `@tests/test_cover_cli.py`:
- Around line 204-224: Extend test_build_kg_configuration_file_flag_parses to
assert cli.APP.parse_args rejects build-kg invocations using the removed
--table-config/-tc and --fullmap/-fm options, while preserving the existing
positional and configuration-file flag assertions.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f056edb5-06f4-4683-bb13-d4153fe6940d
📒 Files selected for processing (9)
CHANGELOG.mddocs/agent.mddocs/cli.mddocs/configuration/graph.mdsrc/tablassert/cli.pytests/test_agent_storage.pytests/test_cli_validation.pytests/test_cover_cli.pytests/test_e2e_smoke.py
…te --schema
BREAKING CHANGE: slim the build-kg and validate CLI surface around explicit,
graph-only inputs.
- build-kg: remove the --table-config/-tc flag and its throwaway TEMP_KG wrapper
(and the --fullmap/-fm flag that existed solely to feed it). build-kg now always
takes a graph YAML; wrap a single table config in a graph config to build it (the
agent already writes a ready graph.yaml under builds/<pmc_id>/).
- build-kg: rename the configuration_file parameter to graph_configuration_file
(CLI flags --configuration-file/-f and positional usage unchanged; only the
positional metavar GRAPH-CONFIGURATION-FILE and the bound-argument name change).
- validate: remove YAML auto-detection; require an explicit --schema {graph,table}/-s
flag selecting which schema to validate against.
Docs (cli.md, agent.md, configuration/graph.md) and the SSOT CLI-coverage tests
updated to match; CHANGELOG Unreleased entry added. Gate: ruff + ruff-format +
pyright clean; pytest 621 passed / 27 skipped, cli.py at 100% coverage.
… docs)
- docs/cli.md: replace the shell-unsafe `--schema {graph,table}` brace expansion
in the validate usage block with concrete `--schema graph` / `--schema table`
commands (brace expansion passed a stray positional argument).
- tests/test_cover_cli.py: assert parse_args rejects the removed
--table-config/-tc and --fullmap options for build-kg (locks the removal).
- tests/test_cli_validation.py: add parse_args coverage proving validate binds
--schema/-s and fails when it is omitted (required-option contract).
- tests/test_agent_storage.py: correct the reuse-contract docstring — the test
passes the bare best config straight to build_and_audit() (Python API), not
`tablassert build-kg` / builds/<pmc>/graph.yaml.
Gate: ruff + ruff-format + pyright clean; pytest 622 passed / 27 skipped, cli.py
at 100% coverage.
29d6436 to
e2a4265
Compare
Slams the
build-kgandvalidateCLI surface shut around explicit, graph-only inputs: drops thebuild-kg --table-configthrowaway-graph wrapper and replacesvalidate's YAML-sniffing auto-detection with a required--schemaflag, so a config is always interpreted as exactly what the caller declares.build-kg--table-config/-tc: the throwawayTEMP_KGwrapper for building a bare table (Section) config is gone —build-kgnow always takes a graph YAML. Also removed--fullmap/-fm, which existed solely to feed that wrapper (the real fullmap comes from the graph's ownfullmapfield).configuration_file→graph_configuration_fileto reflect the graph-only input. The CLI flags (--configuration-file/-f) and positional usage are unchanged; only the positional metavar (GRAPH-CONFIGURATION-FILE) and the cyclopts bound-argument name change.validatetables-key heuristic (graph vs table) is gone, fixing the mis-classification errors that motivated this.--schema {graph,table}/-s:graphvalidates theGraphmodel and every referenced table;tablevalidates section syntax only.tablassert validate foo.yamlnow fails without--schema.Design
--schema) and matches theLiteralstyle already used byagent --backend.tablassert validate <file>andbuild-kg <table.yaml> --table-configno longer work. To build a single table config, wrap it in a graph config —tablassert agentalready writes a readygraph.yamlunderbuilds/<pmc_id>/, andvalidate --schema tablestill checks a bare table config on its own.build_pipeline/validate_pipelinedirectly (Python API), never the removed flags.Docs
docs/cli.md:build-kgtable loses the-tc/-fmrows and uses theGRAPH-CONFIGURATION-FILEmetavar;validategains the required--schema/-srow; workflow example updated.docs/agent.md: the reuse example now builds the agent-writtenbuilds/<pmc_id>/graph.yamlinstead of--table-config.docs/configuration/graph.md: points single-table checks atvalidate --schema table.CHANGELOG.md:Unreleased→Breaking Changesentry covering all three changes.Testing
uv run ruff check .→All checks passed!uv run ruff format --check .→63 files already formatteduv run pyright(afteruv sync --group dev --extra qc, as in CI) →0 errors, 0 warningsuv run pytest -q→621 passed, 27 skipped(agent tests skip without theagentextra, as in CI);src/tablassert/cli.pyat100%coverage.Questions for the reviewer
build-kgflag-rename scope. I renamed only the Python parameter (configuration_file→graph_configuration_file), keeping the CLI flags--configuration-file/-fto preserve the cross-command convention from fix: add a consistent -f/--configuration-file flag to build-kg #58 (validateshares them). Want the CLI flags renamed too (e.g.--graph-configuration-file), or is the metavar-only change right?Summary by CodeRabbit
build-kgnow requires a graph configuration file and no longer supports legacy table-config or--fullmapoptions.validatenow requires an explicit schema selection:graphortable.