Skip to content

docs: restore truncated HowTo tutorials + add completeness CI check #26

Description

@Jammy2211

Overview

Several HowTo tutorial scripts were cut off mid-generation when the HowTo
repos were bootstrapped from the workspace tutorials — the model hit an output
cutoff while re-emitting a long file, and the truncated scripts have been frozen
at that length ever since (the original workspace source no longer exists). In
HowToLens/scripts/chapter_1_introduction, tutorial_1_grids_and_galaxies.py
and tutorial_2_ray_tracing.py
both end on a docstring that promises a plot
which never appears, with no trailing code and no Wrap Up. This restores the
lost content and adds a CI check so the regression cannot silently recur.

Plan

  • Audit every tutorial across HowToLens (all chapters) for the truncation
    signature: ends on a docstring that promises a plot/code that never
    follows
    , with no terminal Wrap Up. (Confirmed so far: ch1 tutorial_1,
    tutorial_2. Deliberate not written yet stubs — ch1 tutorial_4_point_sources,
    tutorial_5_lensing_formalism — are NOT truncation and must be excluded.)
  • Fully restore each truncated script: author the missing code + prose (Opus
    tutorial-prose work), mirroring the complete HowToGalaxy/HowToFit sibling
    where one exists, lens-flavoured, ending in a proper Wrap Up.
  • Add a tutorial-completeness linter + CI workflow to HowToLens that fails when
    a tutorial ends mid-docstring / lacks a terminal Wrap Up section.
  • Ship HowToLens as the phase-1 PR.
  • Repeat the same audit → restore → linter/CI in HowToGalaxy (phase 2) and
    HowToFit (phase 3), each as its own docs-only PR.
Detailed implementation plan

Affected Repositories

  • HowToLens (primary, phase 1)
  • HowToGalaxy (phase 2)
  • HowToFit (phase 3)

Branch Survey

Repository Current Branch Dirty?
./HowToLens main dirty (20 files, all under dataset/ — generated artifacts, no source edits)
./HowToGalaxy main dirty (13 files, all dataset/)
./HowToFit main dirty (315 files, all dataset/)

Suggested branch: feature/restore-truncated-howto-tutorials

Root cause

Line counts for the affected scripts have been frozen since the bootstrap
commit (62a5f3a in HowToLens, "bootstrap HowToLens from workspace tutorials")
— a classic LLM output-token cutoff during that generation, baked into commit
#1. Not a runtime bug. tutorial_1 is 429 lines vs the complete 654-line
HowToGalaxy sibling.

Truncation signature (what the audit + linter must detect)

A script is truncated when its final docstring block promises output that
never appears
— e.g. ends on "...plotted in log10 space reveals more details."
or "...in logarithmic space:" with no plt/aplt call after it — and there is
no terminal Wrap Up section. A missing literal __Wrap Up__ header is NOT
sufficient on its own: tutorial_4_dealing_with_failure and
tutorial_4_bayesian_regularization end on genuine prose conclusions and are
complete. The linter should therefore require every non-stub tutorial to end
with a recognized terminal section (Wrap Up / summary), and normalize the
prose-conclusion tutorials under that marker so they pass.

Implementation Steps (phase 1 — HowToLens)

  1. Audit all HowToLens/scripts/**/tutorial_*.py for the signature above;
    produce the confirmed truncated set (seed: ch1 tutorial_1, tutorial_2).
  2. For each, restore missing code + prose, mirroring the HowToGalaxy sibling
    (e.g. tutorial_1_grids_and_galaxies → log10 plot + Over Sampling section +
    Wrap Up), lens-flavoured. Validate the added code executes (mirror
    already-proven sibling plot patterns; do NOT run in TEST_MODE).
  3. Add HowToLens/scripts/check_tutorials_complete.py + a .github/workflows
    CI step invoking it; wire the stub-exclusion list.
  4. Ship phase-1 PR (docs-only, no library changes).

Phases 2-3

Repeat steps 1-4 for HowToGalaxy then HowToFit (per user: HowToLens first).

Key Files

  • HowToLens/scripts/chapter_1_introduction/tutorial_1_grids_and_galaxies.py — truncated at 429 lines
  • HowToLens/scripts/chapter_1_introduction/tutorial_2_ray_tracing.py — truncated at 214 lines
  • HowToGalaxy/scripts/chapter_1_introduction/tutorial_1_grids_and_galaxies.py — complete 654-line reference sibling
  • HowToLens/scripts/check_tutorials_complete.py — new completeness linter
  • HowToLens/.github/workflows/*.yml — CI wiring

Original Prompt

Click to expand starting prompt

The first two scripts in HowToLens/chapter_1 have lost python code and cut off,
which is an issue we diagnosed and solved before. Investigate this, work out why
they were cut off, restore them, then look for all instances of this happening
across all scripts and repos, fix all, and prevent this from happening long term.

(Filed prompt: docs/workspaces/restore_truncated_howto_tutorial_scripts_and_add.md
— Type docs, Target workspaces, Difficulty medium, Autonomy supervised, Priority high.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions