Skip to content

Fix doc/comment lints found by the decision-record audit - #907

Merged
cailmdaley merged 6 commits into
developfrom
fix/lints
Sep 26, 2026
Merged

cailmdaley merged 6 commits into
developfrom
fix/lints

Conversation

@cailmdaley

Copy link
Copy Markdown
Contributor
  • _mode: docstring said median fallback below 10 elements; code uses 20.
  • completeness.py: :warn example named tile psfex_interp_runner (mandatory); the runner that warns is exp_psf's.
  • exposure.smk: mask_query writes MASK_EXT, not FLAG_EXT, and nothing cuts on it (setools' only mask cut is IMAFLAGS_ISO); dropped stale "floor's :warn tolerates setools attrition" comment (setools is mandatory, expect=80).
  • star_selection.setools: logged FWHM cut now matches the applied +/-0.2 px cut (was 0.1); plot scale now matches the cut's 0.187 arcsec/px (was 0.186). Display only.
  • make_cat_package: removed unimplemented TILE_LIST option; documented the actual TILE_ID column and that overlap dedup is downstream.

No behaviour change: all edits are docstrings, comments, or non-cut display scaling.

Closes #906

🤖 Generated with Claude Code

cailmdaley and others added 6 commits September 26, 2026 03:44
The docstring said the median fallback applies below 10 elements;
the code's threshold is 20 (cat_size >= 20 takes the mode branch,
cat_size > 0 falls through to median).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK
The docstring's :warn example named tile psfex_interp_runner, but
tile_vignets' psfex_interp_runner is mandatory (expect=1, no warn).
The runner that actually warns is exp_psf's (expect=40, warn=True).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK
mask_query writes MASK_EXT, not FLAG_EXT, and nothing cuts on it —
the committed star_selection.setools cuts IMAFLAGS_ISO == 0 alone,
with MASK_PATHS shipped commented out. Also drop the stale "floor's
:warn on psfex_interp_runner tolerating ~0.2% setools attrition"
claim: setools_runner is mandatory (expect=80, no warn); only
psfex_interp_runner is :warn, per completeness.py's COMPLETENESS
table and docstring (setools produced 80/80 in all 127 exposures).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK
The stat block logged the FWHM cut as mode +/- 0.1 px while the
applied cut (star_selection mask) is +/- 0.2 px; fixed the logged
expression to match. The fwhm_field plot scaled by 0.186 arcsec/px
while the cuts use 0.187; fixed the plot to use the same scale.
Display only — the applied cut values are unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK
TILE_LIST was documented as a config entry for flagging tile-overlap
objects, but no code reads it. What the module actually does: it
tags every object with its source tile via the TILE_ID column added
in save_sextractor_data, and leaves deduplication of tile-overlap
duplicates to downstream selection.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK
exposure.smk: "star selection cuts on IMAFLAGS_ISO alone" was false
taken literally (every mask block also cuts FLAGS/MAG/FWHM); reworded
to "selection's only mask cut is IMAFLAGS_ISO". Scoped the
psfex_interp_runner :warn claim to SP_PSF=psfex (under SP_PSF=mccd
every exp_psf runner is :warn, per completeness.py's COMPLETENESS
table). completeness.py: rewrote the module docstring's opening to
describe the present count policy instead of narrating removed lower
bounds and a rejected attrition claim.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK
@cailmdaley
cailmdaley marked this pull request as ready for review September 26, 2026 11:59
@cailmdaley
cailmdaley merged commit 32ff331 into develop Sep 26, 2026
3 checks passed
@cailmdaley
cailmdaley deleted the fix/lints branch September 26, 2026 12:00
cailmdaley added a commit that referenced this pull request Sep 28, 2026
The merged fixes made six record lints false and broke four value
assertions and one contract ref. Re-anchor the MCCD exposure chain to
what it now reads (split image/weight/flag, mask_query before setools),
the setools FWHM plot to 0.187, and CFIS EXP_PREFIX to a location-only
ref (blank). Pin the MCCD completeness counts the rationale now names.
Drop the resolved lints from the record, the @sc blocks and CONTRACTS;
the IMAFLAGS_ISO export (#912), ngmix's 0.186 pixel scale against star
selection's 0.187, and the ngmix noisefill/noise-window doc lints remain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cailmdaley added a commit that referenced this pull request Sep 28, 2026
…he code by @sc tags (#875)

* docs(astra): record the pipeline's scientific decisions in astra.yaml

ShapePipe's scientific choices — detection thresholds, masking geometry,
star selection, PSF model, ngmix priors and seeding, flag semantics,
completeness floors — live in code and committed configs with their
reasoning nowhere, or spread across PRs, papers and comments. astra.yaml
gathers them: 50 decisions across eight sub-analyses, each with its
rationale, the alternatives that were rejected and why, and a greppable
anchor back to the code or config that implements it.
universes/committed.yaml pins the option this branch selects for every one.

The record is ASTRA (astra-tools; `uvx astra-tools@0.2.17 guide`), applied
here at codebase level rather than to a single analysis. Conventions are
stated in the file's header: anchors as `path::symbol` / `path#SECTION.KEY`
and never line numbers, [HARDCODED] for a scientific value with no config
exposure, [LINT] for a place where the record and the code — or the code and
itself — disagree, [PENDING #NNN] for state not yet on develop.

Authoring it surfaced nine such lints, two of which #873 fixes, and mapped
ten places where the published Guinot+22 / Farrens+22 descriptions have
drifted from the code since publication; 16 decisions carry verbatim
paper quotes as prior insights.

CLAUDE.md gains the standing instruction: a scientific change is not
finished until the record is, amended in the same PR. The membership test
is whether a different defensible choice would change which objects enter
the shear catalogue, or the numbers attached to them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y2muA2sRojbxRNxU2SKQeP

* test(astra): validate decision anchors and universe pins

* test(astra): resolve Snakemake rule anchors; JSON report mode

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs(astra): rewrite the decision record against develop

- masking: describe healsparse queries (mask_query MASK_EXT on exposures,
  make_cat MASK_<band> on tiles) and the instrument flag image as the only
  pixel mask, replacing the deleted in-house mask generation
- detection: tiles follow the MegaPipe (Gwyn) SExtractor parameters (#896);
  option ids no longer encode the retired values
- shape_measurement: import defect_fill, blend_handling and
  epoch_masked_fraction_cut from the digital twin with their literature
  insights; defaults are what the committed code selects
- prune to the membership test: drop psf_diagnostics, survey_geometry, the
  workflow-policy decisions and the root findings; split compound decisions;
  reserve excluded for considered-and-rejected; strip chronology
- re-point anchors to the current configs; the anchor test passes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(claude): point the scientific-decisions section at the anchor test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(astra): correct seven rationale claims against the code

- epoch_provenance: names keep their trailing p; EXP_PREFIX is a no-op [LINT]
- fit_initialisation: only the PSF guesser takes the catalogue flux; an
  exception in Ngmix.process drops the object with no row
- star_galaxy_classification: thresholds come from SM_STAR_THRESH /
  SM_GAL_THRESH, which the committed config does not set
- psf_train_validation_split: seeded from the unit's file number
- stamp_positioning: an out-of-image stamp centre raises
- object_position_columns: tile stamps are cut at XWIN_IMAGE (COORD=PIX)
- mark the PSFEx built-in SAMPLE_* behaviour and the 33-px trim unverified
- record the galaxy prior reused for PSF fits and the silent epoch drops
  before the 1/3 cut; carry stale completeness, exposure.smk, _mode and
  pixel-scale comments as [LINT]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(astra): rephrase unverifiable claims; add Guinot+22 insights; sentinels and completeness precision

Follow-up to the correction pass: claims the repo cannot check are stated as
what the config assumes; five Guinot+22 prior insights with page-verified
quotes replace bare paper citations; failure_sentinels says an
NGMIX_N_EPOCH > 0 cut removes failed objects; per_unit_completeness counts
only rules that run shapepipe_run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(contracts): validate @sc contracts against the decision record

tests/helpers/contracts.py parses @sc/@cc contracts with sc-list's line
grammar from Python docstrings, Snakemake comment blocks and CONTRACTS
files under src/, workflow/ and scripts/. test_contracts.py fails on
malformed lines, missing or duplicate ids, tag lines hidden in .py
comments (invisible to sc-list), and decision: metas naming no decision
in astra.yaml. A report-only test prints decisions no contract cites and
contracts off the record's anchored symbols.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(sc): first scientific contracts at the record's anchors

Sixteen @sc contracts in the docstrings of declarations astra.yaml
anchors, each citing its decision: star-selection mode and split
seeding, SExtractor weight wiring and epoch membership bounds, CCD
splitting and WCS source, epoch provenance, stamp rounding, the PSF
acceptance gate, catalogue classification scope, never-fit sentinels,
mask-column and mask-flag semantics, and per-unit completeness. Where
the record carries a [LINT] at the declaration, the contract states the
intended behaviour and names the lint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(astra): record the header saturation level; note PSF_ACCURACY

- detection.saturation_level: SATUR_KEY SATURATE with no SATUR_LEVEL sets
  the FLAGS saturation bit that star selection rejects on; header presence
  on exposures and tiles is unverified here
- psf_model_complexity: PSF_ACCURACY 0.01 with its anchor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* test(contracts): utilities import boundary

src/shapepipe/utilities/CONTRACTS declares utilities-do-not-import-modules
(forbid: shapepipe.utilities.* -> shapepipe.modules.*). test_contracts.py
reads the forbid rule from that file and resolves every import under
src/shapepipe/utilities with ast, relative imports included. It holds
today; loom's check-imports agrees.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(astra): central_defect_veto; 4-fold symmetrisation for defect_fill

- shape_measurement.central_defect_veto: default disabled (committed
  develop has no veto); radius_10px, implemented on
  feat/symmetrized-defect-fill, is the smallest radius with |m| < 1%
- defect_fill: the recommended option is the 4-fold OR
  (symmetrized_4fold_noise); a single rot90 leaves coherent c2 of
  -0.006 to -0.012 for off-centre columns, 4-fold gives |c| < 2e-4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* test(contracts): contracts on config keys via governs:

Resolve semicolon-separated, directory-relative governed refs with the shared ASTRA anchor resolver. Reject empty refs and repeated metadata keys, and include config contracts in the report-only coverage check.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>

* test(astra): assert config values in the anchor grammar

Check active config values and static Python literals independently of anchor resolution. Normalize numeric and boolean spellings while retaining list shape and SETools comparison operators. Document the grammar and exercise it on PSF_NOISE.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>

* docs(sc): contracts for the config-anchored decisions

Keep canonical contracts beside the CFIS configs, with an inherited workflow contract beside the PSF selector. Cover the 17 previously uncovered decisions and the exposure pixel-scale/diagnostic coupling without changing scientific settings; retain the known config inconsistencies explicitly.

Match contract coverage against anchor locators through the shared parser, including the value-assertion grammar added concurrently. Keep the tile-overlap config projection visible as a report-only anchor gap.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>

* docs(astra): assert committed values on anchors

Assert 130 values across 29 decisions without changing defaults or option ids. Cover coupled stamp sizes, detection, star cuts, PSF settings, and literal ngmix priors/metacal settings. Clarify that the CCD's 2048-index span is inclusive, whereas the committed cut excludes both endpoints.

Co-Authored-By: GPT-6 Astra <noreply@openai.com>

* docs(astra): defect fill, central veto and masked-fraction cut follow the measured design

- defect_fill: noise on the unsymmetrized defect set stays default;
  interpolate (feat/defect-interpolation) describes the bounded-run fill
  with quarter-turn weight orbit; four-fold symmetrization is excluded on
  its measured m and c1; the model option is dropped
- central_defect_veto: fixed radii (10 px noise, 7 px interpolated) on
  the defect mask only; size-scaled radius excluded; calibration and known
  limits stated; default stays disabled
- epoch_masked_fraction_cut: the branch counts the raw defect set, with
  EPOCH_MASKED_FRACTION_CUT configurable; default stays 1/3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* test(astra): assert gate keys and absent keys; ambiguous subscript bindings; INI booleans per getboolean

- Assert the booleans that make asserted values live: WEIGHT_IMAGE (weight
  map), MAKE_POST_PROCESS (CCD_SIZE), vignetmaker MASKING (STAMP_SIZE).
- `= absent` asserts a config key has no active line; the record uses it
  for MASK_EXT in every star-selection mask block and SATUR_LEVEL in both
  .sex files. New contract psf-stars-vetoed-on-instrument-flags-only.
- NAME[...] = / NAME.attr = in the binding's scope makes a value read of
  NAME ambiguous.
- INI booleans follow ConfigParser.getboolean; Y/N only for .sex/.psfex.
- A real-record mutation test covers each drift that previously passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(astra): PSFEx compiled SAMPLE_* defaults, verified by psfex -dd

psfex_candidate_vetting and psfex-vetting-is-not-fully-disabled state the
PSFEx 3.21.1 compiled defaults (psfex -dd in the develop-runtime image)
and assert each omitted SAMPLE_* key absent from default.psfex, so pinning
one is visible to the record. Which cuts act with SAMPLE_AUTOSELECT N is
marked as from the PSFEx source, not re-read here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(astra): PSFEx vetting points at #919; compiled values are not assertable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014bvNTrAmZxcfb1ee83ApPK

* docs(astra): retire lints resolved by #907, #909, #918

The merged fixes made six record lints false and broke four value
assertions and one contract ref. Re-anchor the MCCD exposure chain to
what it now reads (split image/weight/flag, mask_query before setools),
the setools FWHM plot to 0.187, and CFIS EXP_PREFIX to a location-only
ref (blank). Pin the MCCD completeness counts the rationale now names.
Drop the resolved lints from the record, the @sc blocks and CONTRACTS;
the IMAFLAGS_ISO export (#912), ngmix's 0.186 pixel scale against star
selection's 0.187, and the ngmix noisefill/noise-window doc lints remain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(astra): tighten the record's prose

Rationales no longer restate values their Anchor sentence asserts, and
literature comparisons that a cited insight already carries become
pointers. The header keeps the anchor grammar and markers; the value
grammar's fine print moves to tests/helpers/astra_record.py, beside the
parser that enforces it. Anchors, ids, options and evidence are unchanged
(206 tests, astra validate).

Corrected while tightening: the fit_initialisation default label (the
galaxy guess takes its flux from a PSF-flux fit), and the blend_handling
`none` description, which now claims only what Jarvis et al. 2016 support.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AkrwnKzU1wfUaHUPt3yYk3

* test: link science guardrails to ASTRA decisions

* feat(decisions): add site-tag checker and Values resolver

* fix(decisions): tighten tag discovery and section scopes

* fix(decisions): resolve multiline INI values within sites

* fix(decisions): scope Python selectors to tagged declarations

* fix(decisions): ignore values outside Python site grammar

* migrate record anchors to site tags

* refactor: dissolve config contract sidecars into site tags

* docs: document decision tags and Values checks

* fix(decisions): tighten absence and duplicate checks

* fix(config): narrow decision tag placements

* fix(science): refine local decision-site contracts

* docs: simplify and wrap Values assertions

* docs(astra): record tile/exposure header evidence and the pixel-scale history

A sampled tile and exposure carry SATURATE, so the SExtractor fallback
level never applies; the exposure's FSCALE matches its PHOTZP against
the tiles' zero-point 30. The fit_priors lint now names what #858
settled (the WCS is the source of truth) and what still overrides it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test: run committed SExtractor configs with real tools

* docs(astra): correct pipeline decision rationale

* style(config): remove redundant migration blank lines

* fix(decisions): match pipeline config semantics

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: GPT-6 Astra <noreply@openai.com>
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.

Docstrings and display values that disagree with the code (decision-record lints)

1 participant