Skip to content

Stable-1 report risks: unassessed repeat tests, PCA label identity, percent near 100%, anomaly folders - #645

Merged
guijacquemet merged 5 commits into
mainfrom
claude/stable1-report-risks
Nov 24, 2026
Merged

guijacquemet merged 5 commits into
mainfrom
claude/stable1-report-risks

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Fixes the Stable-1 risks on the report + html_report path (the default group_cols condition + repeat_group) that the MorphoCoverage triage of 2026-11-24 found. There is one commit per issue. Each fix has a regression test that fails on main c25c4e9.

Closes #557
Closes #555
Closes #628
Refs #90

#90 (part): a paired test with no p is "not assessed", never "not significant"

With 3 or more repeats that all give the same change, the paired t-test has no variance to test with, so it gives no p. Before this change:

  • the reading and the page table across repeats said "not significant across repeats", or "same direction …, not significant" from 6 repeats;
  • panel C and its interactive hover said "fewer than 3 repeats imaged both" even with 3 repeats;
  • "Plan the next experiment" dropped a condition whose repeat plan had no estimable answer, and could then say "Every condition is significant across repeats".

What changes:

  • reading_text.NOT_ASSESSED = "not assessed across repeats" is added to VERDICTS. The summaries iterate over VERDICTS, so they list it.
  • _html_across._verdict returns not assessed across repeats: <contrast_repeats.NO_SPREAD>. It checks this before it checks significance.
  • Panel C (static and plotly) uses a shared plots_pairwise.unpaired_words: "=" means not assessed because the difference is the same in every repeat, "–" means fewer than 3 shared repeats, and "≠" means normalised to different controls. PAIRED_NOTE explains "–" and "=".
  • _html_plan_repeats keeps such a plan as not assessable: <plan status> (DEGENERATE / MISSING_VALUE), and the panel says so.

Why no reason is guessed: the upstream paths drop NaN values, and a log ratio is used only when every value is positive. So with at least MIN_REPEATS finite inputs, paired_t returns NaN only when the compared values are all equal.

Not done here: the shared machine-readable status vocabulary of #90, which the owner described as a design change, and the legend_text.figure_legend path (D67). The issue therefore stays open.

#557: PCA loading labels stay beside their own arrows

_spread_labels returned the positions sorted by height, while _arrows zipped them with the features in the loadings' order. Positions now come back in the order given. The test reads the drawn figure: each label is anchored at 1.06 × its own arrow's tip, its nearest tip is its own, and the case with coincident, shuffled loadings is covered.

#555: percent near 100%

round(100 - share, 9) became 0 for shares such as 1 − 1e-12, and the log of 0 raised a math domain error. The gap is now kept only to the digits a float holds of it, at most 9 and never 0. For example, 1 − 1e-12 reads 99.9999999999% and nextafter(1, 0) reads 99.99999999999999%. A share below 1 never reads 100%. Ordinary shares give the same output as on main (checked: 99.1, 99.5, 99.9, 99.90 for 0.99901, 99.91, 99.99 and others).

#628 item 3: acquisition-anomaly rows name their folder

_pairing.with_folder_labels gives each anomaly row a folder column and puts the folders in its field, for example ctrl · repeat rep1 · img0 (folder control/rep1). This shows in the text report and in the page's fields to check. A table whose folders are their IDs is unchanged. Items 1 and 2 and the comparisons hint were already done in #629, so this closes the issue.

The tests use v33 (condition ID), v30 (repeat group) and v03. v27 is not used: it holds 5 fields per folder, fewer than the 8 a group needs to be judged. The "labels are IDs" case uses v33 with its IDs set to the labels.

Evidence

All 15 new or changed tests fail on c25c4e9. They were run on a worktree of main with the new test files copied in: 14 failed, plus test_html_plan.py::test_a_condition_without_a_repeat_plan_is_said_not_assessable_in_the_table, which asserted the silent drop before and now expects the row. The other 20 selected tests are controls that pass on both.

Focused tests on this branch, all passed: test_unassessed_repeat_tests, test_reading, test_html_tests, test_html_plan, test_plots_pairwise, test_plots_embedding, test_wording, test_morphofeature_exports, test_repeat_groups, test_discovery, test_html_scale, test_unusual_split, test_html_next, test_html_conditions, test_figure_repeat_level, test_bio_reading, test_repeat_plan, test_comparisons, test_contrast, test_style_foundation and test_html_maps.

The whole suite was not run (another heavy job was running on the machine). It must still run before merge.

Gate (on e0f0268)

python -m ruff check src tests data            -> All checks passed!
python -m ruff format --check src tests data   -> 536 files already formatted
pytest -n 0 tests/test_guards.py tests/test_function_guards.py tests/test_function_tools.py
                                               -> 102 passed, 1 warning
python tools/audit.py --check-against origin/main -> baselines only tightened against origin/main

The function index has been regenerated, and the CHANGELOG, AGENTS.md, glossary, figures.md and data_format.md are updated.

Seen in passing (not changed)

report on the v27 export with one field raised by 100 in x ran for more than 15 minutes inside object_rules._fovs_until (via object_rule_check in control_checks). The same report without the outlier takes about 2 s. This looks like a separate performance problem.


Generated by Claude Code

… significant (#90)

With 3 or more biological repeats that all give the same change, the paired
t-test has no variance to test with and gives no p. The reading's verdict and
the page's table across repeats read that as "not significant across repeats"
(or "same direction ..., not significant" from 6 repeats), panel C of the
figures and its hover said "fewer than 3 repeats imaged both", and "Plan the
next experiment" left out a condition whose repeat plan had no estimable
answer, then could say every condition was significant.

- reading_text: new verdict NOT_ASSESSED, "not assessed across repeats", in
  VERDICTS, when enough repeats give no q; the reading keeps its reason.
- _html_across: the table's verdict is "not assessed across repeats: <reason>"
  (contrast_repeats.NO_SPREAD), checked before significance.
- plots_pairwise / _html_plotly: panel C marks such a pair "=" with its reason
  (unpaired_words), "–" only for fewer than 3 shared repeats, and the legend
  says both.
- _html_plan_repeats: a plan without repeats needed stays in the table as
  "not assessable: <status>"; the panel says so.

The shared machine-readable status vocabulary of #90 is not part of this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
_spread_labels placed the labels from the lowest up and returned them in that
order, while _arrows zipped them with the features in the loadings' order: a
feature's name could be drawn at another feature's arrow tip, with or without
any overlap. The positions now come back in the order given, so each label is
anchored at its own arrow; overlapping labels still move apart vertically.

Tests read the drawn figure: each label's anchor is 1.06 times its own arrow's
tip and its nearest tip is its own, also with coincident loadings in shuffled
order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
percent rounded the gap to 100% to 9 decimals before taking its log, so a
valid share such as 1 - 1e-12 (or the float just below 1) gave a gap of 0 and
a math domain error, which would stop the report or its page. The gap is now
kept to the digits a float holds of it (at most 9, never 0), so 1 - 1e-12
reads 99.9999999999% and the float below 1 99.99999999999999%; a share below 1
never reads 100%. Ordinary shares (99.5%, 99.9%, 99.90% for 0.99901) read as
before.

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

On a MorphoFeature export whose conditions are named by condition_id (v33:
the folder "control" is "ctrl") or whose repeats are paired by repeat_group
(v30, v03), the acquisition anomalies' rows named a field by the IDs only
("ctrl · repeat rep1 · img0"), unlike the comparison rows and the fields to
check since #627. with_folder_labels now gives each row a `folder` and the
folders in its field ("... (folder control/rep1)"), in the report's table and
the page's fields to check. A table whose folders are their IDs is unchanged.

Item 3 was the last open part of #628 (items 1, 2 and the comparisons' hint
were done in #629).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
…/common/glossary.md is its rendering)

The full suite found test_docs_glossary_is_the_rendering_of_the_glossary failing:
the committed glossary doc had the #90 sentence but the glossary source did not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
@guijacquemet
guijacquemet merged commit 60874f9 into main Nov 24, 2026
2 checks passed
@guijacquemet
guijacquemet deleted the claude/stable1-report-risks branch November 24, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants