Skip to content

Preserve field dispatch for ignored defaults - #105

Merged
quinnj merged 2 commits into
mainfrom
maintenance/struct-field-defaults
Oct 14, 2026
Merged

quinnj merged 2 commits into
mainfrom
maintenance/struct-field-defaults

Conversation

@quinnj

@quinnj quinnj commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Reading JSON into a struct can throw UndefVarError: x when a default is defined for an unknown or excluded field name. The type-only field dispatcher tries to mutate an object that does not exist. Remove that fallback so ignored names return false without calling the callback; construction continues to apply defaults. Add 20 checks for unknown/excluded names, renamed exclusions, callback execution, mutable values, and construction defaults. Fixes #92.

The existing validation needed repairs: UUID is now public in Base (#102), cache/uploader actions were retired, and the documentation had an unsupported option, a broken reference, and 16 unlisted docstrings. Restore the test and strict documentation checks, and authenticate repository coverage uploads with GitHub OIDC. The NamedTuple defaults example incorporates hellemo's correction from #101.

Validation: the new checks reproduce three undefined-variable errors before the fix and all pass afterward. Full source suites pass on Julia 1.6.7, 1.12.6, and 1.13.1 with four threads and bounds checks. A JSON3 1.14.3 reproducer fails on two unknown-key reads before the fix and passes all six checks afterward. Documenter 1.19 builds with strict checks; rendered API anchors and GitHub source links are verified. All seven GitHub checks pass at d42b5a9. The stable-job log confirms an accepted OIDC coverage upload to JuliaData/StructTypes.jl at that revision; both coverage checks pass.

Co-authored by Codex

AI disclosure: This work was prepared with assistance from OpenAI Codex.

Remove the invalid fallback that references x in the type-only dispatcher.
Unknown or excluded names return false without running the callback; defaults
continue to be applied by construction. Add regression tests for these cases.

Restore validation on current Julia: account for UUID becoming public in Base,
replace retired CI actions, authenticate coverage with GitHub OIDC, and repair
strict documentation builds. The corrected NamedTuple defaults example was
proposed by hellemo in #101.

Full suites pass on Julia 1.6.7, 1.12.6, and 1.13.1; the new 20-check regression
set and JSON3 1.14.3 reproduction pass. Documenter 1.19 builds with strict checks.

AI disclosure: This work was prepared with assistance from OpenAI Codex.
@codecov

codecov Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.57%. Comparing base (47c4691) to head (c8b773a).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #105      +/-   ##
==========================================
+ Coverage   75.31%   76.57%   +1.25%     
==========================================
  Files           2        2              
  Lines         401      414      +13     
==========================================
+ Hits          302      317      +15     
+ Misses         99       97       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@quinnj
quinnj merged commit dbe4efb into main Oct 14, 2026
7 checks passed
@quinnj
quinnj deleted the maintenance/struct-field-defaults branch October 14, 2026 00:56
@quinnj quinnj mentioned this pull request Oct 15, 2026
quinnj referenced this pull request Oct 15, 2026
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

StructTypes.x is not defined

1 participant