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)
- Audit all
HowToLens/scripts/**/tutorial_*.py for the signature above;
produce the confirmed truncated set (seed: ch1 tutorial_1, tutorial_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).
- Add
HowToLens/scripts/check_tutorials_complete.py + a .github/workflows
CI step invoking it; wire the stub-exclusion list.
- 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.)
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.pyand
tutorial_2_ray_tracing.pyboth end on a docstring that promises a plotwhich 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
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. Deliberatenot written yetstubs — ch1tutorial_4_point_sources,tutorial_5_lensing_formalism— are NOT truncation and must be excluded.)tutorial-prose work), mirroring the complete HowToGalaxy/HowToFit sibling
where one exists, lens-flavoured, ending in a proper Wrap Up.
a tutorial ends mid-docstring / lacks a terminal Wrap Up section.
HowToFit (phase 3), each as its own docs-only PR.
Detailed implementation plan
Affected Repositories
Branch Survey
dataset/— generated artifacts, no source edits)dataset/)dataset/)Suggested branch:
feature/restore-truncated-howto-tutorialsRoot cause
Line counts for the affected scripts have been frozen since the bootstrap
commit (
62a5f3ain HowToLens, "bootstrap HowToLens from workspace tutorials")— a classic LLM output-token cutoff during that generation, baked into commit
#1. Not a runtime bug.
tutorial_1is 429 lines vs the complete 654-lineHowToGalaxy 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/apltcall after it — and there isno terminal Wrap Up section. A missing literal
__Wrap Up__header is NOTsufficient on its own:
tutorial_4_dealing_with_failureandtutorial_4_bayesian_regularizationend on genuine prose conclusions and arecomplete. 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)
HowToLens/scripts/**/tutorial_*.pyfor the signature above;produce the confirmed truncated set (seed: ch1
tutorial_1,tutorial_2).(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).
HowToLens/scripts/check_tutorials_complete.py+ a.github/workflowsCI step invoking it; wire the stub-exclusion list.
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 linesHowToLens/scripts/chapter_1_introduction/tutorial_2_ray_tracing.py— truncated at 214 linesHowToGalaxy/scripts/chapter_1_introduction/tutorial_1_grids_and_galaxies.py— complete 654-line reference siblingHowToLens/scripts/check_tutorials_complete.py— new completeness linterHowToLens/.github/workflows/*.yml— CI wiringOriginal 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.)