Skip to content

test: close TOML/JSON fixture divergence for passthrough.exclude and watch#1129

Merged
zeroedin merged 2 commits into
mainfrom
test/fixture-parity-1127
Jul 24, 2026
Merged

test: close TOML/JSON fixture divergence for passthrough.exclude and watch#1129
zeroedin merged 2 commits into
mainfrom
test/fixture-parity-1127

Conversation

@zeroedin

@zeroedin zeroedin commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds 2 passthrough entries (with exclude arrays) and 2 watch entries to valid.toml and valid.json, matching the existing valid.yaml fixture
  • Expands the TOML and JSON format-parity test contexts from 3–4 spot-check assertions to comprehensive coverage of all config sections: top-level scalars, build, content/goldmark, templates, plugins, pagination, taxonomies, passthrough (including exclude), sources, sitemap, structure, collections, SSR, languages, and watch
  • Prior state: TOML and JSON contexts claimed "produces same Config struct as YAML" but only verified Title, BaseURL, Build.Output, and Structure.Components

Test summary

Context Before After
TOML config 1 It (4 assertions) 14 It blocks
JSON config 1 It (4 assertions) 14 It blocks

Fixture changes

File passthrough entries watch entries
valid.yaml 4 (2 with exclude) 2
valid.toml 2 → 4 (2 with exclude) 0 → 2
valid.json 2 → 4 (2 with exclude) 0 → 2

All 136 config specs pass (go test -race ./internal/config/).

Refs #1127

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded configuration validation for TOML and JSON, including detailed field-by-field checks across build, content, templates, plugins, pagination, taxonomies, passthrough rules, sources, sitemap, collections, SSR, languages, and watch settings.
    • Added coverage for custom directory paths, exclusion/glob behavior, and new watch entries.
  • Configuration
    • Added passthrough rules to copy elements build inputs into asset destinations, with exclusions for HTML, demo content, and minified files.
    • Added watch settings to monitor elements (content) and shared-layouts (layout).

…watch (#1127)

Add passthrough entries with exclude arrays and watch entries to
valid.toml and valid.json to match valid.yaml. Expand TOML and JSON
format-parity test contexts from 3 spot-checks to comprehensive
assertions covering all config sections.

Refs #1127

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 24, 2026

Copy link
Copy Markdown

Deploy Preview for alloyssg ready!

Name Link
🔨 Latest commit 0aa276a
🔍 Latest deploy log https://app.netlify.com/projects/alloyssg/deploys/6a62f0d235e525000854af0a
😎 Deploy Preview https://deploy-preview-1129--alloyssg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Expanded TOML and JSON configuration fixtures with passthrough and watch entries, and replaced coarse parity checks with detailed assertions covering parsed configuration fields.

Changes

Configuration format parity

Layer / File(s) Summary
Fixture passthrough and watch settings
internal/config/testdata/valid.json, internal/config/testdata/valid.toml
Fixtures add element asset mappings, exclusion patterns, and content/layout watch entries.
TOML and JSON load assertions
internal/config/config_test.go
Config tests validate detailed TOML and JSON parsing across major fields, including passthrough and watch settings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

  • #1116 — Adds assertions for structure.components parsing in TOML and JSON configuration tests.

Poem

I’m a bunny with configs to check,
TOML and JSON hop neck and neck.
Assets pass through, watches gleam,
Fields line up like carrots in a dream.
Squeak—parity’s tidy and bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds the missing TOML/JSON fixture entries and expands parity tests as requested in #1127.
Out of Scope Changes check ✅ Passed The additional assertions are part of the requested parity expansion and do not appear unrelated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the fixture divergence fix for passthrough.exclude and watch, which is a core part of the change.
✨ 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 test/fixture-parity-1127

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

@zeroedin zeroedin left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code Review Results

Scope: internal/config/config_test.go, testdata/valid.{toml,json} — 3 files, +290/−8
Intent: Close TOML/JSON fixture divergence for passthrough.exclude and watch; expand format-parity assertions from spot-checks to comprehensive coverage

P1 — High

# File Issue Reviewer Confidence Route
1 PR body Closes #1127 will auto-close the issue on merge. This is a spec PR — per project rules, spec PRs must not auto-close issues. The commit message correctly uses (#1127) as a reference, but GitHub's keyword detection in the PR body overrides that. Change to Refs #1127. project-standards 90 Fix before merge
2 config_test.go:298-308, 440-450 TOML/JSON "parses sources identically to YAML" blocks assert only products.Type and products.Endpoint but drop products.Query, products.Cache, and products.As — all three are asserted in the YAML test (lines 171-173). Query is the graphql-specific field; if TOML/JSON parsers mangle it, nothing catches it. The test description claims full parity but delivers partial. testing, correctness 90 Fix before merge
3 config_test.go:340-350, 482-492 TOML/JSON "parses languages identically to YAML" blocks assert en.Strings["read_more"] but drop en.Strings["posted_on"], fr.Strings["read_more"], and fr.Strings["posted_on"] — all asserted in the YAML test (lines 215-221). The Strings map is the only nested-map-within-a-map structure in languages config; this is exactly the structure most likely to exhibit format-specific parsing differences. testing, correctness 90 Fix before merge

P2 — Moderate

# File Issue Reviewer Confidence Route
4 config_test.go:334-338, 476-480 TOML/JSON "parses SSR config identically to YAML" blocks assert SSR.Command but omit SSR.Mode empty-string assertion present in the YAML test (line 204). If a TOML/JSON decoder populated Mode with a non-empty default, the parity tests would not catch it. testing 80 Fix before merge

P3 — Advisory

# File Issue Reviewer Confidence Route
5 config_test.go:225-507 The TOML and JSON Context blocks are ~140 lines each with near-identical structure — same 14 It blocks, same assertions, differing only in variable name and format string. Findings #2-#4 above are a direct consequence: assertions were added to one format's reference (YAML) but not propagated to both parity blocks. A DescribeTable/Entry parameterized by format and fixture path would make divergence mechanically impossible. The file doesn't use DescribeTable elsewhere, so this is a style break — but the duplication cost is real and growing. maintainability 75 Consider

Coverage

  • Testing gaps: The three P1/P2 findings above represent 7 missing assertions per format (14 total) where the test descriptions claim "identically to YAML" but the assertions are a subset.
  • Residual risks: Future config section additions require touching 6 places (3 fixtures + 3 test blocks). DescribeTable (P3 #5) would reduce this to 4.

What's clean

  • Fixture values are byte-identical across all three formats — verified field-by-field
  • BeforeEach scoping is correct; each It gets a fresh config.Load call
  • loadErr guard in every It block is defensive but justified (prevents nil-pointer panics)
  • Passthrough entries 2 and 3 (with exclude) match exactly across YAML/TOML/JSON
  • Watch entries match exactly across all three formats
  • Conventional Commits format ✅, no encoding/json ✅, no Skip()

Verdict: Ready with fixes

Reasoning: The fixture changes and new test structure are solid — the passthrough/exclude and watch parity gaps that motivated issue #1127 are fully closed. The PR falls short of its own "comprehensive coverage" claim by leaving 7 assertions per format that exist in the YAML reference tests but were not carried into the TOML/JSON blocks (sources/products fields, languages/strings entries, SSR mode). These are straightforward additions. The PR body auto-close keyword also needs a one-word edit.

Add missing parity assertions for TOML/JSON sources (products.Query,
Cache, As), languages (posted_on, French strings), and SSR (Mode
empty-string) to match the YAML reference tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@zeroedin

Copy link
Copy Markdown
Owner Author

Review response

P1 #1 — PR body auto-close keyword

Fixed. Changed Closes #1127 to Refs #1127 in the PR body.

P1 #2 — TOML/JSON sources missing products.Query, Cache, As

Fixed in 0aa276a. Added Query, Cache, and As assertions for the products source in both TOML and JSON parity blocks, matching the YAML reference (lines 171-173).

P1 #3 — TOML/JSON languages missing posted_on and French strings

Fixed in 0aa276a. Added en.Strings["posted_on"], fr.Strings["read_more"], and fr.Strings["posted_on"] assertions in both TOML and JSON parity blocks, matching the YAML reference (lines 214-221).

P2 #4 — TOML/JSON SSR missing Mode empty-string assertion

Fixed in 0aa276a. Added SSR.Mode BeEmpty() assertion in both TOML and JSON parity blocks, matching the YAML reference (line 204).

P3 #5 — DescribeTable to reduce duplication (advisory)

Skipped. The file doesn't use DescribeTable anywhere, so introducing it here would be a style break. The duplication cost is real but the 14 missing assertions that caused findings #2-#4 are now added — future parity drift will require touching both blocks but the assertions are now complete.

@zeroedin zeroedin left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code Review Results (Rereview)

Scope: internal/config/config_test.go, testdata/valid.{toml,json} — 3 files, +308/−8 (2 commits)
Intent: Close TOML/JSON fixture divergence for passthrough.exclude and watch; expand format-parity assertions

Reviewing fix commit 0aa276a against prior review findings on 254db89.

Prior findings — all resolved

# Prior finding Status
1 P1: Closes #1127 auto-close keyword ✅ PR body uses Refs #1127 — no auto-close keywords present
2 P1: Sources missing Query, Cache, As assertions ✅ Added for both TOML (308-310) and JSON (459-461), matching YAML (171-173)
3 P1: Languages missing posted_on + French strings ✅ Added for both TOML (352, 357-358) and JSON (503, 508-509), matching YAML (215, 220-221)
4 P2: SSR missing Mode empty-string assertion ✅ Added for both TOML (341) and JSON (492), matching YAML (204)
5 P3: DescribeTable dedup advisory Open — fine as a future refactor

New findings

None. The fix commit is surgical — adds only the missing assertions, no regressions introduced. No encoding/json, no Skip(), conventional commits ✅.


Verdict: Ready

Reasoning: All blocking findings from the prior review are addressed. YAML/TOML/JSON parity assertions are now byte-identical across all three formats for every config section. The P3 DescribeTable suggestion remains valid as future cleanup but doesn't block.

@zeroedin
zeroedin merged commit 5bc88d5 into main Jul 24, 2026
6 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