Skip to content

docs(modelling): make abstract-syntax.md executable (Phase E1) - #913

Merged
ocots merged 1 commit into
mainfrom
docs/abstract-syntax-executes
Aug 31, 2026
Merged

ocots merged 1 commit into
mainfrom
docs/abstract-syntax-executes

Conversation

@ocots

@ocots ocots commented Aug 31, 2026

Copy link
Copy Markdown
Member

What

docs/src/modelling/abstract-syntax.md — the most visited page of the site — described the
whole @def grammar but nothing on it was verified by the build: 0 @example, 41 inert
```julia fences (the campaign count of 37 missed 4 fences indented inside !!! warning
admonitions), 4 `@repl`. Every fragment could be wrong and CI would stay green. The blocker
was mechanical: the `...` idiom inherited from `docs/attic/` left every `@def` incomplete,
and `@def` validates at build time.

This is Phase E1 of the documentation campaign.

Changes (documentation only — no API change)

  • 30 non-notation fences → executed blocks: 27 @example + 7 @repl, all sharing one
    @setup abs module (using OptimalControl + two stubs, data(t) and c(t)).
    • single-clause blocks: complete @def, the off-topic clauses carry # hide, block ends
      nothing # hide — the reader sees only the taught clause.
    • whole-problem blocks (dynamics variants, constraints showcase, Bolza): shown in full.
    • error cases: @repl + try # hide / catch e # hide / showerror(IOContext(stdout, :color => false), e) # hide / end # hide — renders a clean REPL[1] box, no
      stacktrace, no path leak.
  • 11 :( … ) grammar patterns stay inert, covered by one opening !!! note — they are
    Expr templates with $-placeholders, not runnable code.
  • Three latent bugs fixed (the inert fences hid them; each verified at the REPL):
    was result fix
    ∫(x(t) - data(t))² → min Julia ParseError: identifier cannot begin with character '²' ∫((x(t) - data(t))^2) → min
    -ω²*q(t), ω² → min (ω is 1-D) @def keeps ω² as a free undefined symbol; breaks at solve -ω^2*q(t), ω^2 → min
    u ∈ R², control + c(t) * u(t)^2 integrand eval → MethodError: no method matching ^(::Vector{Float64}, ::Int64) u ∈ R, control across the Bolza section (matches the Lagrange section above)
  • Voice: her / the user → you / your (4 sites); fixed a copy-paste "state" → "control"
    in the control-aliases sentence.

Verification

Full docs build (julia --project=. docs/make.jl) run twice, exit 0, no failed to run,
every @def on the page executed. The only warnings are the pre-existing warnonly
external-link ones (Phase D backlog). Add the run documentation label to build the site in
CI.

Follow-ups (recorded in .reports/campaign/)

  • Two CTParser rough edges surfaced and are being filed as issues: x(0) == v (bound
    depending on the variable) reports a leaked-gensym UndefVarError instead of a clear
    message; @def … end true trace mode prints the parsed model twice.
  • New Phase J on the campaign board: review where the docs could use the unused
    VitePress code features ([!code ++/--/highlight], focus, code groups) — static fences
    only, since they do not work inside executed @example blocks.

🤖 Generated with Claude Code

Convert the 30 non-notation ```julia fences to executed blocks: 27
@example + 7 @repl sharing one `abs` module, complete models with the
off-topic clauses under `# hide`. The 11 `:( … )` grammar patterns stay
inert, covered by one opening note.

Fixes three latent bugs the inert fences hid: ∫(e)² (Julia ParseError),
ω² read as a free symbol, u(t)^2 on a 2-vector control. Error cases use
the try/catch + showerror idiom. Voice: her/the user → you/your.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ocots ocots added the run documentation Trigger the Documentation workflow on this PR label Aug 31, 2026
@ocots
ocots merged commit 3b235a5 into main Aug 31, 2026
9 checks passed
@ocots
ocots deleted the docs/abstract-syntax-executes branch August 31, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run documentation Trigger the Documentation workflow on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant