Skip to content

fix: validate config files deeply - #47

Merged
edhor1608 merged 1 commit into
mainfrom
repo-refresh-config-validation
May 2, 2026
Merged

edhor1608 merged 1 commit into
mainfrom
repo-refresh-config-validation

Conversation

@edhor1608

@edhor1608 edhor1608 commented May 1, 2026 •

Copy link
Copy Markdown
Owner

Validate config files deeply in loadRuleset and loadExportProfiles

  • Replaces shallow top-level key checks in loadRuleset and loadExportProfiles with full recursive validation of all nested fields.
  • Adds type, range, and allowlist checks for every field across all modes, orientations, and surfaces (e.g. crf_default in [0,51], risk_level in [low,medium,high], resolutions as NxN).
  • Both functions now throw descriptive errors with the offending JSON path (e.g. Invalid ruleset at profiles.reliable.feed.portrait: resolution must match NxN).
  • Behavioral Change: configs that previously loaded successfully with missing or malformed nested fields will now throw at load time.

Macroscope summarized 6833fd9.

Summary by CodeRabbit

  • Bug Fixes

    • Configuration files now undergo comprehensive validation at load time with deterministic error messages that clearly identify invalid nested structures, values, and field constraints.
  • Tests

    • Added tests for nested configuration validation of export profiles and rulesets to ensure constraint enforcement.

@coderabbitai

coderabbitai Bot commented May 1, 2026 •

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Config loading validation was enhanced across export profiles and rulesets. The loadExportProfiles function now validates the entire parsed JSON structure, including required top-level objects (image, video, version), per-mode/per-orientation image profiles, and per-mode/per-surface video profiles with typed field checks. Similarly, loadRuleset was refactored with dedicated validation routines to enforce required keys, per-mode/per-orientation profile rule fields, and white_canvas constraints. New internal validation helpers were introduced for record checking, enum membership, and resolution format validation. Error messages now specify the exact nested key path and constraint violation. Tests were added to verify error reporting for invalid nested fields. Documentation was updated to record these changes.


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Docstring Coverage ❌ Error Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: validate config files deeply' directly and clearly summarizes the main change: comprehensive nested validation of configuration files in loadRuleset and loadExportProfiles.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 repo-refresh-config-validation
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch repo-refresh-config-validation

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

@edhor1608
edhor1608 force-pushed the repo-refresh-config-validation branch from fb6be0f to d2141c8 Compare May 2, 2026 19:03
@edhor1608
edhor1608 force-pushed the repo-refresh-media-process-adapter branch from 5e758f0 to 9603e6c Compare May 2, 2026 19:03
@edhor1608
edhor1608 marked this pull request as ready for review May 2, 2026 19:03
@edhor1608
edhor1608 changed the base branch from repo-refresh-media-process-adapter to main May 2, 2026 21:20
@edhor1608
edhor1608 force-pushed the repo-refresh-config-validation branch from d2141c8 to cce4863 Compare May 2, 2026 21:24
@edhor1608
edhor1608 changed the base branch from main to graphite-base/47 May 2, 2026 21:24
@graphite-app
graphite-app Bot changed the base branch from graphite-base/47 to repo-refresh-media-process-adapter May 2, 2026 21:25
@edhor1608
edhor1608 force-pushed the repo-refresh-media-process-adapter branch from 1dba0d0 to ce15db4 Compare May 2, 2026 21:25
@edhor1608
edhor1608 force-pushed the repo-refresh-config-validation branch from cce4863 to 1313d46 Compare May 2, 2026 21:25
@edhor1608
edhor1608 force-pushed the repo-refresh-media-process-adapter branch from ce15db4 to de61e94 Compare May 2, 2026 21:32
@edhor1608
edhor1608 force-pushed the repo-refresh-config-validation branch from 1313d46 to 6163454 Compare May 2, 2026 21:32
@edhor1608
edhor1608 changed the base branch from repo-refresh-media-process-adapter to graphite-base/47 May 2, 2026 21:35
@edhor1608
edhor1608 force-pushed the graphite-base/47 branch from de61e94 to f6c2e9d Compare May 2, 2026 21:35
@edhor1608
edhor1608 force-pushed the repo-refresh-config-validation branch from 6163454 to 6833fd9 Compare May 2, 2026 21:35
@edhor1608
edhor1608 changed the base branch from graphite-base/47 to main May 2, 2026 21:35
@edhor1608
edhor1608 merged commit b1608a1 into main May 2, 2026
3 of 4 checks passed
@edhor1608
edhor1608 deleted the repo-refresh-config-validation branch May 15, 2026 18:54
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