Skip to content

Commit 66a7815

Browse files
authored
Merge pull request #255 from PyAutoLabs/claude/latex-raw-string-docstrings-9h4ine
prompt: latex-raw-string-docstrings — unblock, implement across 6 repos, record
2 parents d05aa5b + dc6fbb8 commit 66a7815

8 files changed

Lines changed: 187 additions & 142 deletions

File tree

active.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,50 @@
11
# Active Tasks
22

3+
## latex-raw-string-docstrings
4+
- issue: https://github.com/PyAutoLabs/autolens_workspace/issues/491
5+
- status: workspace-dev — 5 of 6 PRs MERGED; HowToLens#73 held RED (not this PR's failure)
6+
- issue-umbrella: autolens_workspace#491 (one issue, six PRs)
7+
- merged: HowToFit#47, HowToGalaxy#70, autofit_workspace#145, autogalaxy_workspace#218,
8+
autolens_workspace#492 — all green, incl. the CI 'Catalogue staleness' check, which
9+
independently re-confirms the regeneration gate.
10+
- BLOCKED: HowToLens#73 red on smoke (3.12 + 3.13). Two scripts fail with numba
11+
'Pass nopython_type_inference': chapter_3_pixelizations/tutorial_8_adaptive_pixelization.py
12+
and tutorial_11_brightness_adaption.py. NEITHER is in the diff, and all 8 files that ARE
13+
in it pass. Reproduced identically on one re-run. A docstring r-prefix cannot cause a numba
14+
typing error. Prime suspect: PyAutoArray#453 (in-place Cholesky buffer + new numba kernels
15+
for fnnls_cholesky) merged 2026-08-20 22:09:30 UTC, minutes before this run; CI installs
16+
autoarray from source at HEAD, and the last green HowToLens main run (04:29 UTC) predates
17+
it. NOT yet proven: two specific mechanisms were tested and BOTH passed under the exact CI
18+
versions (numba 0.67.0 + scipy 1.17.1) — a strided Ubuf view into _cholupdate, and the new
19+
np.dot inside _cho_solve_buffer. So the suspicion rests on timing + code area, not a
20+
reproduced mechanism. Control experiment running: re-run of the last GREEN main build
21+
(same commit, fresh dependency install) — if it now fails the same way, the break is on
22+
main/library drift and this PR is clean.
23+
- prompt: active/latex_raw_string_docstrings.md
24+
- repos (all on branch claude/latex-raw-string-docstrings-9h4ine):
25+
- HowToFit: 4 files, 13 literals, 7 corruptions repaired
26+
- HowToGalaxy: 4 files, 20 literals, 13 repaired
27+
- HowToLens: 8 files, 32 literals, 21 repaired
28+
- autofit_workspace: 2 files, 2 literals, 1 repaired
29+
- autogalaxy_workspace: 6 files, 30 literals, 28 repaired
30+
- autolens_workspace: 17 files, 83 literals, 61 repaired
31+
- totals: 41 files, 180 literals, 131 corruptions repaired — 41 matches the survey exactly.
32+
- verification (per repo, in order): baseline regeneration is a NO-OP; both sweeps zero;
33+
runtime value check (every changed literal's value compared HEAD vs worktree — the prefix
34+
may only REMOVE corruption) = 131 repaired / 0 unexpected; diff-empty gate passes
35+
byte-exactly on notebooks/ markdown/ llms-full.txt workspace_index.json. autolens_workspace
36+
additionally: all 57 __Env__ declarations re-read IDENTICALLY, and 4 of the raw-stringed
37+
files carry __Env__, so the PyAutoHands#251 fix is exercised end to end.
38+
- gate refinement: HowToFit's 4 `plt.ylabel` labels are runtime strings in CODE cells, which
39+
copy source verbatim, so the `r` legitimately shows there. The gate holds exactly as written
40+
for every docstring; that one code-cell delta is by design.
41+
- residue: autolens_workspace scripts/group/likelihood_function.py keeps 2 warned + 1 silent.
42+
Three docstrings use the DOUBLE-backslash convention ($\\theta$, \\frac, \\vec) mixed with
43+
single-backslash macros; adding `r` would double the correct ones. Needs a convention
44+
decision + un-doubling 18 backslashes = a prose edit this task excludes. Follow-up.
45+
- follow-up to file: -W error::SyntaxWarning compile guard in workspace CI (catches only the
46+
warned class; the silent class needs the AST sweep).
47+
348
## numba-cpu-likelihood-profiling
449
- issue: https://github.com/PyAutoLabs/autolens_profiling/issues/151
550
- pr: https://github.com/PyAutoLabs/autolens_profiling/pull/152

draft/maintenance/workspaces/latex_raw_string_docstrings.md renamed to active/latex_raw_string_docstrings.md

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ corner of the problem, and found a hard dependency the prompt did not know
3333
about. Both sweeps are ~20 lines each and specified below — rebuild them rather
3434
than trusting these counts blind.
3535

36-
### BLOCKED BY: `draft/bug/hands/raw_string_docstring_prefix.md`
36+
### ~~BLOCKED BY~~ — CLEARED 2026-08-20
37+
38+
The PyAutoHands prerequisite **merged**: issue #250 / PR #251 (merge `c887290`), all 3
39+
CI matrix jobs green. Both parsers accept `r`/`R` prefixes now, verified on `main`. This
40+
task is ready to start. History of the block, kept because it explains the gate below:
41+
3742

3843
Two PyAutoHands docstring parsers **silently** mis-handle an `r"""` opener, so
3944
raw-stringing these scripts today would break the generated artefacts rather
@@ -47,7 +52,22 @@ than fix them. Both reproduced, neither raises:
4752
`.../potential_correction/`), so their smoke env profile would be silently
4853
rerouted.
4954

50-
Do not start this task until that Hands fix has merged.
55+
~~Do not start this task until that Hands fix has merged.~~ It has.
56+
57+
**Re-verified 2026-08-20 (resumed `/start_dev`): still blocked, still unfixed.**
58+
Against PyAutoHands `main` @ `cdea28c`, on a probe pair differing only by an `r`
59+
on the first narrative docstring:
60+
61+
- `_narrative_docstring_ranges` → plain `[(0, 2), (6, 10)]` vs raw `[(6, 10)]`
62+
— the raw block is dropped, silently, no exception.
63+
- `read_env_declaration` → plain `['jax']` vs raw `None` — silently, no exception.
64+
65+
`add_notebook_quotes.py:67` still reads `lines[start].startswith('"""')` and
66+
`env_config.py:110` still reads `^(?:"""|''')\s*$`; neither accepts an `r`/`R`
67+
prefix. No `feature/hands-raw-string-docstring-prefix` branch exists on the
68+
remote yet, and its own blocker (`feature/hands-hygiene-leftovers`) is still
69+
open. Re-run this two-probe check at the next `/start_dev` rather than trusting
70+
this note.
5171

5272
### Two sweeps are needed, not one
5373

@@ -63,6 +83,17 @@ diagnostic at all — `\t` in `\theta`, `\f` in `\frac`, `\r` in `\rm`, `\b` in
6383
segment contains a backslash, flag any control character (`ord < 32`, `\n`
6484
excepted) in the *value***132 hits**.
6585

86+
**The warning sweep is interpreter-dependent — check this before trusting a
87+
zero.** Invalid escape sequences are a `SyntaxWarning` only on **Python 3.12+**;
88+
on 3.11 and earlier they are a `DeprecationWarning`. A sweep that collects
89+
`SyntaxWarning` on a 3.11 interpreter reports **0 hits** and is
90+
indistinguishable from "already fixed" — verified 2026-08-20 on 3.11.15, where
91+
`compile()` on a docstring containing `$\odot$` yields 0 `SyntaxWarning` and 1
92+
`DeprecationWarning`. Collect **both** categories, or assert the interpreter is
93+
3.12+ before believing the count. (`-m compileall` needs `-f` too, or
94+
`__pycache__` suppresses recompilation and the counts silently drop.) This
95+
already cost one mis-grade on the 2026-08-09 sweep.
96+
6697
`HowToLens/scripts/chapter_4_scaling_up_lensing/tutorial_5_cluster_scale.py`
6798
has **only** silent hits and zero warnings, so a warning-only sweep skips it
6899
entirely. Drive the edit off the union of both.
@@ -142,9 +173,18 @@ The four matplotlib labels in
142173
- `autocti_workspace`, every `*_workspace_test` / `*_workspace_developer`, and
143174
`PyAutoFit` / `PyAutoArray` / `PyAutoLens` source: swept, **zero** hits.
144175

176+
## Constraints
177+
178+
- Docstring content is user-facing tutorial prose. Add the `r` prefix and change
179+
**nothing else** — do not reword the LaTeX or the surrounding sentences.
180+
Prose changes belong to a docs task, not this one.
181+
- Notebooks are regenerated, never hand-edited.
182+
145183
## Verification per repo (the diff-empty gate)
146184

147-
1. Both sweeps return zero.
185+
1. Both sweeps return zero — on a **3.12+** interpreter, or collecting
186+
`DeprecationWarning` as well (see the interpreter trap above). A zero from a
187+
3.11 `SyntaxWarning`-only sweep is vacuous and does not clear this gate.
148188
2. Regenerate:
149189
`PYTHONPATH=../PyAutoHands/autohands python3 ../PyAutoHands/autohands/generate.py <project>`
150190
(`howtofit`, `howtogalaxy`, `howtolens`, `autofit`, `autogalaxy`, `autolens`).
@@ -158,6 +198,17 @@ The four matplotlib labels in
158198
Ship as six independent PRs, one per repo. Prose-only, no API surface, so no
159199
cross-repo merge ordering.
160200

201+
## Supersedes
202+
203+
`draft/maintenance/autolens_workspace/latex_docstrings_invalid_escape_warnings.md`
204+
(filed 2026-08-09, split from #457) is the same defect measured on
205+
`autolens_workspace` alone — its 80 warnings across 17 files are exactly the 17
206+
files listed above, top-six counts matching. This prompt subsumes it across all
207+
six repos and adds the silent-escape class. Its unique content (the interpreter
208+
trap, now folded in above; the "do not reword the LaTeX or the prose while
209+
fixing the escapes" constraint) is carried here. One task, one prompt — pick up
210+
this file, not that one.
211+
161212
## Follow-up worth filing
162213

163214
A `-W error::SyntaxWarning` compile guard in workspace CI, so this cannot

draft/bug/hands/raw_string_docstring_prefix.md renamed to complete/2026/08/hands-raw-string-docstring-prefix.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
- issue: https://github.com/PyAutoLabs/PyAutoHands/issues/250 (closed on merge)
2+
- shipped: 2026-08-20 — PyAutoHands PR https://github.com/PyAutoLabs/PyAutoHands/pull/251
3+
(merge `c887290`, commit `27c828c`); all 3 CI matrix jobs green (pytest 3.12/3.13/3.14).
4+
- classification: bug (PyAutoHands) — silent parser defect, two sites.
5+
- summary: two independent docstring parsers silently mis-handled an `r"""` opener, and
6+
neither raised. `add_notebook_quotes._narrative_docstring_ranges` tested
7+
`lines[start].startswith('"""')`; a raw block is a perfectly good column-0
8+
`ast.Expr(Constant(str))`, so it reached that test and failed it — the block was dropped
9+
as a cell boundary and the tutorial prose would have shipped as a Python CODE cell
10+
containing a bare string literal. `env_config._DOCSTRING_DELIM_RE` matched a bare
11+
delimiter only, so an `r"""` opener was walked past and the block's CLOSER matched as an
12+
opener instead — docstring parity inverted for the rest of the file and an `__Env__`
13+
section further down was read as if outside a docstring, so `read_env_declaration`
14+
returned `None` and the script's smoke env profile was silently rerouted. Both sites now
15+
accept an optional `r`/`R` prefix on either delimiter
16+
(`_TRIPLE_DELIM_OPENER_RE`, `_DOCSTRING_DELIM_RE`). Unblocks latex-raw-string-docstrings
17+
(41 workspace files across 6 repos).
18+
- validation: 6 new regression tests, EACH verified to fail with the source change reverted
19+
and pass with it. Full suite 14F/337P on branch vs 14F/331P on main — identical failure
20+
sets, all 14 from `ipynb-py-convert` being unbuildable in the container (CI installs it,
21+
and CI ran green on all three Python versions).
22+
- key traps:
23+
- **The recorded blocker was not real.** The prompt said "blocked by hands-hygiene-leftovers
24+
(worktree dirty)". That was LOCAL WORKTREE CONTENTION, not a code dependency:
25+
`feature/hands-hygiene-leftovers` touches AGENTS.md, generate_release_notes.py,
26+
bin/autohands and two unrelated tests — ZERO overlap with the two files here. Done in a
27+
separate clone; the two merge in either order. Read a blocker before honouring it.
28+
- **The parity case is the test that matters.** `read_env_declaration` breaks when the raw
29+
docstring is NOT the one carrying the declaration — a single-block test passes while the
30+
defect is live. Test an EARLIER raw docstring.
31+
- **Do not run `black` on this repo.** It is not black-formatted: 44 files on main would
32+
reformat. Match surrounding style instead.
33+
- `ipynb-py-convert` will not build in a modern container, so the 14 notebook-level tests
34+
cannot run locally. Assert on the CONVERTED SOURCE instead — the converter replaces the
35+
opener line outright, so byte-identical conversion is the tighter claim and needs no
36+
external tool.
37+
- Checked and NOT affected, verified rather than assumed: `generate_markdown.script_title`
38+
(its regex finds the `"""` after the `r` — same title either way) and `navigator.py`
39+
(reads already-converted output). Boundary set confirmed not to have widened: column-0
40+
raw single-quoted strings, assigned literals, raw bytes literals and f-strings all
41+
remain non-boundaries.
42+
- `pyauto-brain bug` mis-read this task: "owner unresolved", sized *large*,
43+
"split into phases", for a two-line fix in a repo the prompt names in its header.
44+
Worth a look at the Bug Agent's owner map for `hands`.
45+
46+
## Original prompt
47+
148
# Teach the notebook/env parsers to accept raw-string (`r"""`) docstrings
249

350
Type: bug

complete/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Token-light navigation over the finished-work records (schema:
66
only then grep a dated bucket. Curators: edit the band between the CURATED
77
markers; everything below GENERATED is rebuilt.
88

9-
1060 records across 7 buckets.
9+
1061 records across 7 buckets.
1010

1111
<!-- CURATED:START -->
1212
## Highlights
@@ -69,6 +69,7 @@ _(curate hard-won records here — survives regeneration.)_
6969
- [folder-list-ref-drift-sweep](2026/08/folder-list-ref-drift-sweep.md) — Fixed the 12 real defects from the 2026-08-19 hygiene refs scan — 2 autoCTI_workspace/output casing refs, 2 ho…
7070
- [frozen-lane-counter](2026/08/frozen-lane-counter.md) — Added a third disjoint lane counter to the multi-start gradient search
7171
- [group-data-preparation-readme](2026/08/group-data-preparation-readme.md)
72+
- [hands-raw-string-docstring-prefix](2026/08/hands-raw-string-docstring-prefix.md) — closed on merge
7273
- [hazard-profiling-likelihood-tier](2026/08/hazard-profiling-likelihood-tier.md) — Tier-2 likelihood profiling landed with five persistent findings and corrected NNLS continuity semantics.
7374
- [health-conductor-stale-verdict](2026/08/health-conductor-stale-verdict.md)
7475
- [heart-green-validation-ingest](2026/08/heart-green-validation-ingest.md)

0 commit comments

Comments
 (0)