Skip to content

refactor!: remove build-kg --table-config and require explicit validate --schema - #64

Merged
SkyeAv merged 2 commits into
mainfrom
remove-table-config-options-for-runs
Jul 31, 2026
Merged

refactor!: remove build-kg --table-config and require explicit validate --schema#64
SkyeAv merged 2 commits into
mainfrom
remove-table-config-options-for-runs

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Slams the build-kg and validate CLI surface shut around explicit, graph-only inputs: drops the build-kg --table-config throwaway-graph wrapper and replaces validate's YAML-sniffing auto-detection with a required --schema flag, so a config is always interpreted as exactly what the caller declares.

build-kg

  • Removed --table-config/-tc: the throwaway TEMP_KG wrapper for building a bare table (Section) config is gone — build-kg now always takes a graph YAML. Also removed --fullmap/-fm, which existed solely to feed that wrapper (the real fullmap comes from the graph's own fullmap field).
  • Renamed the parameter configuration_filegraph_configuration_file to 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.

validate

  • Removed auto-detection: the top-level-tables-key heuristic (graph vs table) is gone, fixing the mis-classification errors that motivated this.
  • Added required --schema {graph,table}/-s: graph validates the Graph model and every referenced table; table validates section syntax only. tablassert validate foo.yaml now fails without --schema.

Design

  • Why explicit over sniffed: the heuristic mis-fired on edge-case configs; a required selector is self-validating (cyclopts rejects a missing/invalid --schema) and matches the Literal style already used by agent --backend.
  • Accepted caveat (breaking): bare tablassert validate <file> and build-kg <table.yaml> --table-config no longer work. To build a single table config, wrap it in a graph config — tablassert agent already writes a ready graph.yaml under builds/<pmc_id>/, and validate --schema table still checks a bare table config on its own.
  • Agent unaffected: it calls build_pipeline/validate_pipeline directly (Python API), never the removed flags.

Docs

  • docs/cli.md: build-kg table loses the -tc/-fm rows and uses the GRAPH-CONFIGURATION-FILE metavar; validate gains the required --schema/-s row; workflow example updated.
  • docs/agent.md: the reuse example now builds the agent-written builds/<pmc_id>/graph.yaml instead of --table-config.
  • docs/configuration/graph.md: points single-table checks at validate --schema table.
  • CHANGELOG.md: UnreleasedBreaking Changes entry covering all three changes.

Testing

  • uv run ruff check .All checks passed!
  • uv run ruff format --check .63 files already formatted
  • uv run pyright (after uv sync --group dev --extra qc, as in CI) → 0 errors, 0 warnings
  • uv run pytest -q621 passed, 27 skipped (agent tests skip without the agent extra, as in CI); src/tablassert/cli.py at 100% coverage.

Questions for the reviewer

  • build-kg flag-rename scope. I renamed only the Python parameter (configuration_filegraph_configuration_file), keeping the CLI flags --configuration-file/-f to preserve the cross-command convention from fix: add a consistent -f/--configuration-file flag to build-kg #58 (validate shares them). Want the CLI flags renamed too (e.g. --graph-configuration-file), or is the metavar-only change right?

Summary by CodeRabbit

  • Breaking Changes
    • build-kg now requires a graph configuration file and no longer supports legacy table-config or --fullmap options.
    • validate now requires an explicit schema selection: graph or table.
    • Updated commands, examples, and pipeline reuse guidance to reflect the new workflow.
  • Documentation
    • Added migration notes describing the updated CLI requirements and removed legacy usage patterns.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8e84fcbb-1368-410c-97cb-45074b933207

📥 Commits

Reviewing files that changed from the base of the PR and between 221548f and e2a4265.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • docs/agent.md
  • docs/cli.md
  • docs/configuration/graph.md
  • src/tablassert/cli.py
  • tests/test_agent_storage.py
  • tests/test_cli_validation.py
  • tests/test_cover_cli.py
  • tests/test_e2e_smoke.py

📝 Walkthrough

Walkthrough

The CLI now accepts only graph YAML files for build-kg and requires --schema graph or --schema table for validate. Tests, documentation, reuse instructions, and changelog entries were updated.

Changes

CLI contract update

Layer / File(s) Summary
Build and validation dispatch
src/tablassert/cli.py
build-kg now accepts only graph configurations and rejects table-config wrapping and --fullmap. validate requires an explicit schema and dispatches to graph or table validation.
Command contract tests
tests/test_cli_validation.py, tests/test_cover_cli.py, tests/test_e2e_smoke.py, tests/test_agent_storage.py
Tests verify explicit schema selection, removed option rejection, configuration-file argument forms, graph validation errors, and direct API reuse documentation.
CLI workflow documentation
docs/cli.md, docs/agent.md, docs/configuration/graph.md, CHANGELOG.md
Documentation describes graph-only builds, explicit validation schemas, updated reuse commands, and the breaking changes.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the breaking CLI changes to remove build-kg table configuration and require explicit validate schema selection.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 remove-table-config-options-for-runs

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
tests/test_cover_cli.py (1)

204-224: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert rejection of removed build options.

Add parser assertions that --table-config/-tc and --fullmap/-fm fail for build-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 win

Test the required CLI option through the parser.

These direct validate() calls bypass Cyclopts parsing. Add cli.APP.parse_args() coverage for validate with -s or --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

📥 Commits

Reviewing files that changed from the base of the PR and between 0554c1d and 221548f.

📒 Files selected for processing (9)
  • CHANGELOG.md
  • docs/agent.md
  • docs/cli.md
  • docs/configuration/graph.md
  • src/tablassert/cli.py
  • tests/test_agent_storage.py
  • tests/test_cli_validation.py
  • tests/test_cover_cli.py
  • tests/test_e2e_smoke.py

Comment thread docs/cli.md
Comment thread tests/test_agent_storage.py Outdated
SkyeAv added 2 commits July 31, 2026 14:16
…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.
@SkyeAv
SkyeAv force-pushed the remove-table-config-options-for-runs branch from 29d6436 to e2a4265 Compare July 31, 2026 21:21
@SkyeAv
SkyeAv merged commit 5b9ce48 into main Jul 31, 2026
4 of 5 checks passed
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.

1 participant