Skip to content

Design: confirming the design is one answer, one refresh, with a busy state - #293

Merged
guijacquemet merged 2 commits into
mainfrom
claude/confirm-design-speed
Nov 12, 2026
Merged

guijacquemet merged 2 commits into
mainfrom
claude/confirm-design-speed

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Summary

Owner bug on the v0.5.2 notebook (12 November 2026): Looks right: confirm the design seemed to do nothing, or was very slow.

Cause (cProfile on synthetic experiments): the click saved the answers twice (_confirm_ids, then the "no comparison" answers) and called _refresh_description three times. Each refresh rebuilt one image-type row per folder on the Channels page (ImageTypeRows, about 60 % of the time) and every replicate box of Check and save twice, so the cost grew with the number of folders. #292 fixed a different path, the axes confirmation.

By module:

  • notebook_design_step.py: the IDs and the "no comparison" answers are now one answer, saved once and refreshed once. _design_clicked disables the button, changes it to "Confirming the design…" (spinner) and shows a working line before any work. It ends with the green result or the reason for a refusal. An unexpected exception becomes a red card naming the error, with the traceback in Technical details, and the button is given back. A click on a disabled button does nothing.
  • notebook_description.py: _adopt_ids still tries each ID on its own, so every refusal is listed, all or none, as before. It then saves the given answers once.
  • notebook_channels_type.py: ImageTypeRows.refresh rebuilds its rows only when what they show changes: the folders, each saved type and note, the pictures and the reopen statuses. Cells replaced by ImageTypeColumn.open are never kept.
  • notebook_replicates.py (new, ui layer): the replicate boxes moved here from notebook_check_save.py to stay within the 600-line module rule. They are rebuilt only when their views, pictures, channel types, counts, statuses or published dates change.

Timing (headless, same machine, click only)

Experiment (cond × rep × tech × FOV) images before after widgets built per click, before → after
3 × 3 × 2 × 2 36 0.99 s 0.14 s 2,403 → 255
4 × 4 × 2 × 2 64 1.46 s 0.23 s
6 × 6 × 3 × 2 216 3.07 s 0.22 s
8 × 8 × 3 × 2 384 5.27 s 0.29 s 14,550 → 450
10 × 10 × 3 × 3 900 7.71 s 0.46 s

In a real kernel each widget is also sent to the browser, so on Colab the before times are longer than these headless figures.

Screenshots

Headless Chrome render of the Design card (embed_minimal_html). There are no JupyterLab styles and no Font Awesome icons, so the spinner icon is not drawn.

Decisions

  • No change in what is recorded: the same answers are saved, refused and dated as before, and no Spec or file-format change is needed.
  • The refusal wording for a save failure during the click is now the IDs' refusal card ("These IDs were not taken: nothing was confirmed", "These IDs together: …"), because IDs and comparisons are one answer. Before, a failure of the second save said "Not taken."

Notes for review

  • Not checked in a real JupyterLab or Colab. All widget behaviour was tested headless.
  • The cache keys compare objects (layouts, pictures) by identity and answers by value. A change these keys do not cover would leave a row stale until the next real change. The keys cover everything _row and _replicate_box read.
  • Remaining per-answer cost, as a follow-up: on 192 units, a pairing dropdown takes 0.5 s and one "same way" click 0.45 s. These are listed in the v0.5.3 design note.
  • tests/test_notebook_row_fold.py now patches notebook_replicates.replicates, because the function moved there.

Tests

  • New tests/test_notebook_design_confirm_speed.py (5 tests, on a 64-image fixture):

    • one _answer and one _refresh_description per click;
    • no ImageTypeRows._build_rows call;
    • a 2.0 s budget;
    • the busy state is seen before the work starts;
    • the failure card is shown and the button is given back;
    • a click on a disabled button does nothing;
    • a changed image type still rebuilds its rows.

    All 5 fail on main.

  • python tools/check.py (ruff, format, code rules, pytest): see the CI result and the comment below.


Generated by Claude Code

… state

Owner bug on the v0.5.2 notebook (12 November 2026): *Looks right: confirm the
design* seemed to do nothing, or was very slow.

Cause: the click saved the answers twice and refreshed every page three times;
each refresh rebuilt one image-type row per folder (the Channels page) and every
replicate box of Check and save, twice. The cost grew with the number of folders
(headless: 1.0 s for 36 images, 5.3 s for 384, 7.7 s for 900; about 2,400 to
14,500 widgets sent to the page per click).

- The IDs and the "no comparison" answers are saved as one answer (each ID is
  still tried on its own first, so every refusal is listed; all or none).
- ImageTypeRows and the replicate boxes are rebuilt only when what they show
  changed (folders, saved types and notes, pictures, reopen statuses, views).
- The button is disabled and says "Confirming the design..." with a working
  line before any work; the click ends with the result or the reason; an
  unexpected failure is a red card naming the error, with the traceback in
  Technical details, and the button is given back.
- The replicate boxes move to notebook_replicates.py (600-line module rule).

After: 0.14 s, 0.29 s, 0.46 s; about 250 to 450 widgets. Nothing recorded
changed: the same answers are saved.

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

Copy link
Copy Markdown
Contributor Author

Tests: python tools/check.py locally (Python 3.13, Linux): ruff, format, code rules all pass; pytest 5492 passed, 4 skipped (skips: case-insensitive file system x3, permissions as root x1). CI 7/7 green on 1ff7343. The macOS 3.13 job was cancelled before it got a runner (no steps ran); after a re-run it passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a


Generated by Claude Code

…confirmed

The replicate boxes are now kept when nothing they show changed. A "same way"
click whose answer was refused changes nothing in the answers, so the clicked
toggle stayed on "confirmed" although nothing was saved (on main the rebuild
reset it). Drop the kept boxes when the answer is not taken. Regression test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
@guijacquemet
guijacquemet merged commit 3c91e7c into main Nov 12, 2026
7 checks passed
@guijacquemet
guijacquemet deleted the claude/confirm-design-speed branch November 12, 2026 22:04
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.

2 participants