Skip to content

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
mainfrom
fix/generate-meta-all-fields
Draft

Fix generate_meta to emit all 22 meta fields and add unit tests (W-SRC-3, W-DOC-4)#430
tmigot wants to merge 1 commit into
mainfrom
fix/generate-meta-all-fields

Conversation

@tmigot

@tmigot tmigot commented Jun 19, 2026

Copy link
Copy Markdown
Member

Summary

  • W-SRC-3 / W-DOC-4: generate_meta in test/utils.jl was missing five provenance fields introduced after the original 17-field spec. Contributors using create_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

  • Added :url, :notes, :origin_notes, :reference, :lib to the generate_meta Dict template (matching the structure of src/Meta/arglina.jl).
  • Added an @isdefined(ndef) guard around include("test-utils.jl") so utils.jl can be safely re-included from within the runtests.jl context (where test-utils.jl is already loaded) without redefining constants.

test/test-generate-meta.jl (new)

Four @testsets:

  1. All 22 meta keys are present in the generated string (unconstrained problem arwhead).
  2. All six getter functions (get_arwhead_{nvar,ncon,nlin,nnln,nequ,nineq}) are emitted.
  3. The generated string is parseable as valid Julia (Meta.parse).
  4. All 22 keys also present for a constrained problem (hs7).

test/runtests.jl

  • include("test-generate-meta.jl") added before rmprocs().

Test plan

  • julia --project test/runtests.jl — new @testset "generate_meta: ..." groups pass
  • Run generate_meta("arwhead") manually and confirm the output contains all 22 fields with correct placeholder syntax (raw"""""", "")
  • Confirm create_meta_files(["arwhead"]) writes a file that is valid Julia

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings June 19, 2026 12:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 in test/utils.jl to include :url, :notes, :origin_notes, :reference, and :lib.
  • Added a new test/test-generate-meta.jl test file to validate key emission, getter emission, and parseability for both unconstrained and constrained problems.
  • Updated test/runtests.jl to 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
@tmigot tmigot marked this pull request as draft June 19, 2026 12:58
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.

2 participants