Repository navigation
refactor(src): typed errors and simpler parameter merge (T1 of #449) - #457
Merged
Merged
Conversation
- Metadata and reference files: the load-time checks throw `IncorrectArgument` instead of `error(...)` (EXC1). - `features(:unknown)` throws `IncorrectArgument` instead of `UndefVarError`. - `Catalogue.status` reads `Metadata.problem_metadata`, with its check. - `Metadata.merge` (four methods shadowing `Base.merge`) removed: `parameters_data(problem, parameters)` handles `nothing` and uses `Base.merge`, without catching and rethrowing. - ModelingToolkit named in the docstrings of the package and `Modelings`. Refs #449 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 of 53 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #449 (T1, findings). Applied conventions:
ct-conventions v0.14.0,ct-agents v0.5.0.Fixes findings 1–5 of the T1 review. No change to the exported API.
Changes
EXC1, load-time checks.src/Metadata/loading.jl(a metadata field missing, unknown or of the wrong type) andsrc/References/objectives.jl(a malformed reference table) throwCTBase.Exceptions.IncorrectArgument, withgot,expectedandsuggestion, instead oferror(...).EXC1,features(:unknown)throws theIncorrectArgumentofproblem_metadatainstead of anUndefVarError.Catalogue.statusreadsMetadata.problem_metadata(problem)[:status]: one check of the name, with the structured message.Metadata.mergeremoved. Its four methods shadowedBase.merge.parameters_data(problem, parameters)returns the defaults fornothing, throws thePreconditionErroritself for a problem without parameters, and usesBase.mergeotherwise, without catching and rethrowing.OptimalControlProblemsandModelings.Tests
test_parameters.jl: testsparameters_datainstead ofMetadata.merge. No problem of the collection is without parameters, so the test adds one toMETADATA_STORAGEand removes it (try/finally).test_references.jl: a broken reference file throwsIncorrectArgument.test_modelings.jl:features(:not_a_problem)throwsIncorrectArgument.Test plan
Pkg.test(; test_args=["core"]): 1309 passed, 1 broken (the existing one oftest_discovery_cache.jl).🤖 Generated with Claude Code