Fix generate_meta to emit all 22 meta fields and add unit tests (W-SRC-3, W-DOC-4)#430
Draft
tmigot wants to merge 1 commit into
Draft
Fix generate_meta to emit all 22 meta fields and add unit tests (W-SRC-3, W-DOC-4)#430tmigot wants to merge 1 commit into
tmigot wants to merge 1 commit into
Conversation
W-SRC-3 / W-DOC-4: generate_meta was missing five fields introduced after
the original 17-field spec (:url, :notes, :origin_notes, :reference, :lib).
Contributors using create_meta_files() would get scaffolding that passes
CI but silently omits provenance documentation.
Changes:
- test/utils.jl: add :url, :notes, :origin_notes, :reference, :lib to the
generated Dict template, with empty-string / raw-triple-quote defaults
ready for the contributor to fill in.
- test/utils.jl: guard the include("test-utils.jl") call with @isdefined(ndef)
so utils.jl can safely be included from within the runtests.jl context
(where test-utils.jl is already loaded) without redefining constants.
- test/test-generate-meta.jl: new @testset covering all 22 keys, all six
getter functions, output parseability, and a constrained-problem path.
- test/runtests.jl: include the new test file before rmprocs().
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the test-side generate_meta scaffold generator to emit the full 22-field meta Dict (including newer provenance fields) and adds unit tests to ensure the generated output contains the expected keys/functions and is valid Julia syntax.
Changes:
- Expanded
generate_meta’s Dict template intest/utils.jlto include:url,:notes,:origin_notes,:reference, and:lib. - Added a new
test/test-generate-meta.jltest file to validate key emission, getter emission, and parseability for both unconstrained and constrained problems. - Updated
test/runtests.jlto include the new test file.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/utils.jl | Guarded inclusion of test-utils.jl and extended generate_meta output with the five missing provenance/meta fields. |
| test/test-generate-meta.jl | New tests asserting meta key/function emission and parseability of generated meta code. |
| test/runtests.jl | Includes the new test-generate-meta.jl test file in the main test run. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+5
| using Distributed, NLPModels, NLPModelsJuMP, OptimizationProblems, Test | ||
| import ADNLPModels | ||
|
|
||
| include(joinpath(@__DIR__, "utils.jl")) | ||
|
|
Comment on lines
+35
to
+37
| for key in _ALL_META_KEYS | ||
| @test occursin(key, str) | ||
| end |
Comment on lines
+57
to
+59
| for key in _ALL_META_KEYS | ||
| @test occursin(key, str) | ||
| end |
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.
Summary
generate_metaintest/utils.jlwas missing five provenance fields introduced after the original 17-field spec. Contributors usingcreate_meta_files()to bootstrap a new problem would get a scaffolded meta file that passes CI but silently omits:url,:notes,:origin_notes,:reference, and:lib— the very fields that the contributing guide emphasises gathering. The generated file now includes all 22 fields, with empty-string / raw-triple-quote defaults as placeholders for the contributor to fill in.Changes
test/utils.jl:url,:notes,:origin_notes,:reference,:libto thegenerate_metaDict template (matching the structure ofsrc/Meta/arglina.jl).@isdefined(ndef)guard aroundinclude("test-utils.jl")soutils.jlcan be safely re-included from within theruntests.jlcontext (wheretest-utils.jlis already loaded) without redefining constants.test/test-generate-meta.jl(new)Four
@testsets:arwhead).get_arwhead_{nvar,ncon,nlin,nnln,nequ,nineq}) are emitted.Meta.parse).hs7).test/runtests.jlinclude("test-generate-meta.jl")added beforermprocs().Test plan
julia --project test/runtests.jl— new@testset "generate_meta: ..."groups passgenerate_meta("arwhead")manually and confirm the output contains all 22 fields with correct placeholder syntax (raw"""""","")create_meta_files(["arwhead"])writes a file that is valid Julia🤖 Generated with Claude Code