Skip to content

feat: make the rig: graph section optional - #288

Open
ArdaTkn wants to merge 1 commit into
SkyeAv:mainfrom
ArdaTkn:feat/optional-rig
Open

ArdaTkn wants to merge 1 commit into
SkyeAv:mainfrom
ArdaTkn:feat/optional-rig

Conversation

@ArdaTkn

@ArdaTkn ArdaTkn commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #274. RIG metadata is a Translator publication requirement, not a graph-building one — drafts and internal pipelines previously had to author a full RIG (infores, terms, contributions, access locations) before anything validated.

Without rig: the graph validates, build-kg emits KGX only and skips compile_rig, and a build-time log warning notes the absent publication metadata. With rig: behavior is unchanged.

Fallback design (the decisions the issue asked to make explicit)

RIG-derived value Fallback Default
graph infores (provided_by, uuid namespace) new top-level infores field (validated infores CURIE) infores:tablassert
artifact output dir new top-level output_dir field current directory

Both fields are rejected when rig: is set — there rig.source_info.infores_id / rig.artifact_base_path stay authoritative, so the two can never drift.

One subtlety worth review attention: top-level infores is a legacy key (LEGACY_RIG_KEYS), so it is exempted from the legacy rejection only when rig: is absent; the guard is data.get("rig"), not "rig" in data, because validate_assignment=True re-runs mode="before" validators on the default-filled dict where rig=None looks present. The vendored negative corpus (MOKG.yaml) still rejects on description with the migration pointer.

Byte-parity pin

uuid_namespace already routed through Graph.infores_id; it now resolves rig -> explicit infores -> infores:tablassert. RIG-bearing graphs derive identical namespaces and edge ids — pinned by an explicit test, per the issue's success metric.

Changes

  • models.py: rig optional; new infores/output_dir fields with conflict validation; infores_id/artifact_path properties; guarded legacy-key check; RIGConfig docstring
  • lib.py: compile_graph(rig: RIGConfig | dict | None, ..., output_dir, infores); the rig phase is skipped when rig is None
  • cli.py: Tcode infores and the QC study read the properties; build-time warning for RIG-less graphs
  • Tests: fallback validation, conflict rejection, RIG byte-parity, RIG-less e2e smoke (KGX emitted, provided_by fallback, no .RIG.yaml), updated negative corpus + test_graph_rejects_missing_rig_section inverted to the new contract
  • Docs: graph.md required/optional tables + legacy-key wording, llms.txt summary

Local gate

  • ruff check / ruff format --check: clean
  • pyright: 0 errors; vulture / deptry: clean
  • Full pytest suite: 1377 passed; 3 failures are pre-existing on clean main (two macOS errno tests + test_real_repo_files_round_trip, already tracked by your follow-up issue)
  • mkdocs build --strict: clean

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 437d6789-3126-4636-be23-99cb973b6215
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ArdaTkn

ArdaTkn commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main (ef65a36) and added an Unreleased changelog entry under ### Changed so the CI / changelog check passes.

@ArdaTkn
ArdaTkn force-pushed the feat/optional-rig branch 2 times, most recently from 45d10ca to f6e016d Compare November 19, 2026 22:48

@SkyeAv SkyeAv left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks, @ArdaTkn! The core implementation looks good. Before merging, please:

  • Rebase onto main and resolve the CHANGELOG.md conflict.
  • Update docs/index.md:41 and the node/edge provided_by wording in graph.md:32 and models.py:1438.
  • Add real byte-parity and RIG-less validate-kgx assertions, or adjust the current test claims.
  • Rename the stale “required RIG” test in tests/test_models.py:47.

Targeted tests pass: 188 passed, 1 skipped.

@ArdaTkn

ArdaTkn commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Addressed all review items in dd982a4:

  1. docs/index.md: Updated the configuration link description from the required rig: section to the optional rig: section.
  2. provided_by wording: Updated docs/configuration/graph.md and Graph.rig_fallback_fields docstring in src/tablassert/models.py from node/edge provided_by to node provided_by to match what lib.py and validate-kgx actually emit/check.
  3. Byte-parity & validate-kgx assertions: Added test_build_pipeline_rig_and_rigless_kgx_byte_parity in tests/test_e2e_smoke.py comparing the full .nodes.ndjson and .edges.ndjson bytes between RIG-bearing and RIG-less builds with the same infores, and added validate_kgx(nodes, edges) verification to test_build_pipeline_without_rig_emits_kgx_only.
  4. Test naming: Renamed test_graph_rig_section_is_required_and_defaults_apply to test_graph_rig_section_defaults_apply in tests/test_models.py.

Local gates re-run and passing: check_changelog.py, ruff check, ruff format --check, pyright, vulture, deptry, mkdocs build --strict, and pytest (180 passed).

RIG publication metadata is a Translator requirement, not a graph
building one; drafts and internal pipelines had to author a full RIG
before anything validated (SkyeAv#274).

- Graph.rig becomes optional. Without it, build-kg emits KGX only and
  skips compile_rig; a build-time warning notes the absent publication
  metadata instead of erroring.
- Defined fallbacks replace every rig-derived value: graph infores comes
  from a new config-level infores field (valid infores CURIE; defaults to
  infores:tablassert), artifacts land in a new output_dir field (defaults
  to the current directory). Both are rejected when rig: is set, where
  rig.source_info.infores_id / rig.artifact_base_path stay authoritative.
- Top-level infores is exempted from the legacy-keys rejection only when
  rig: is absent: with rig present the rejection is unchanged, and the
  negative legacy corpus (MOKG.yaml) still fails on description with the
  migration pointer. data.get(rig) (not 'rig' in data) is the guard,
  because validate_assignment re-runs before-validators on the
  default-filled dict where rig=None looks present.
- uuid_namespace keeps routing through Graph.infores_id, so RIG-bearing
  graphs derive byte-identical namespaces and edge ids (pinned by test);
  RIG-less graphs with uuid_fields namespace on the fallback infores.
- Tcode infores, the QC study path, and compile_graph all read the
  properties instead of dereferencing rig directly.

Tests: RIG-less validation with both fallbacks, rig/fallback conflicts,
byte-parity pin for RIG-bearing graphs, a RIG-less end-to-end build
smoke (KGX emitted with fallback provided_by, no .RIG.yaml), and the
updated negative corpus. Docs: graph.md required/optional tables,
legacy-key wording, llms.txt summary.

Closes SkyeAv#274

This branch has not been deployed

No deployments
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.

Make the rig: graph section optional

2 participants