Skip to content

fix: debug and resolve all test failures#64

Merged
tmck-code merged 4 commits into
mainfrom
fix/debug-test-failures
Jun 6, 2026
Merged

fix: debug and resolve all test failures#64
tmck-code merged 4 commits into
mainfrom
fix/debug-test-failures

Conversation

@tmck-code
Copy link
Copy Markdown
Owner

Context

Three test failures were present on main after recent changes to ops/install.sh (ensure_marketplace/ensure_plugin updated) and an in-progress refactor of Renderer.path_git / fit_path (elapsed moved to a separate elapsed_section() method). A fourth failure (test_yas_full_width_fills_terminal) was caused by host environment variables (YAS_MAX_WIDTH=40) leaking into Config.load() during the test run.

Changes

1. Complete the elapsed_section split (renderer.py + layout.py + tests)

path_git and fit_path no longer accept an elapsed argument — elapsed time is now rendered as a separate section via Renderer.elapsed_section(). The layout.py calls to fit_path were still using the old five-argument form (passing '' for elapsed); those are updated to the new four-argument form. test_path_git.py is rewritten to match: path_git is tested for path/branch/dirty output only, elapsed_section gets its own tests, and the obsolete show_elapsed flag and test_no_elapsed_when_no_commit_still_overflows tests are removed. test_model_section.py similarly drops the elapsed arg from its fit_path calls.

2. Fix install script test assertions (test_install_script.py)

  • test_dry_run_marketplace_already_present: ensure_marketplace now runs an update (not a skip) when the marketplace is present — assertion updated from 'already present' or 'skipping' to 'would update marketplace'.
  • test_dry_run_would_install_when_plugin_absent: ensure_plugin changed its jq from top-level has("yas@...") to .plugins | has("yas@..."). The test's seed data had the key under .plugins, so the script saw it as installed and printed "Would update" instead of "Would install". Fixed by seeding with key yas-cached@yet-another-statuslineensure_plugin doesn't find it (wrong name), but do_wire's contains("yas") scan still resolves the installPath.
  • Updated _seed_installed_plugins docstring and surrounding comment block to reflect the current jq paths.

3. Isolate width test from host env vars (test_render_callable.py)

Config.load() calls dict(os.environ), so YAS_MAX_WIDTH=40 set in the developer's shell capped the rendered width at 40 instead of DEFAULT_MAX_WIDTH=140. Added monkeypatch.delenv('YAS_MAX_WIDTH', raising=False) (and YAS_FULL_WIDTH) before the test's calls.

Checklist

  • Tests added or updated for new/changed behaviour
  • (bug fixes) a regression test now covers the situation so it can't come back

Screenshots / recording

  • N/A — no visible change

Benchmark

Command Mean [ms] Min [ms] Max [ms] Relative
main 63.8 ± 1.3 61.6 66.5 1.00
PR 67.8 ± 9.3 62.7 119.7 1.06 ± 0.15

(Outliers detected; within noise — no performance-relevant code changed.)

System info

Key Value
OS Linux archlinux 7.0.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 23 May 2026 14:21:20 +0000 x86_64 GNU/Linux
Claude Code 2.1.167 (Claude Code)
Terminal TERM=tmux-256color TERM_PROGRAM=tmux SHELL=/bin/bash COLORTERM=truecolor
Locale LANG=en_AU.UTF-8 LC_ALL=
Python Python 3.13.1
uv uv 0.11.14 (x86_64-unknown-linux-gnu)

Test and others added 4 commits June 6, 2026 18:21
…/fit_path

path_git and fit_path no longer accept an elapsed argument; elapsed is
now rendered separately via Renderer.elapsed_section().  Update layout.py
to use the new four-argument fit_path, and rewrite test_path_git.py to
reflect the narrower contracts: path_git is tested for path/branch/dirty
output only, elapsed_section gets its own tests, and the obsolete
show_elapsed flag tests are removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two dry-run assertions broke after ops/install.sh was updated:

- ensure_marketplace now runs 'update' (not skips) when the marketplace
  is already present; update the test assertion to match.
- ensure_plugin now checks .plugins | has("yas@...") (nested) instead of
  the top-level key; seed installed_plugins.json with a differently-named
  key (yas-cached@...) so ensure_plugin sees absent while do_wire can
  still resolve the installPath via its contains("yas") scan.

Also update _seed_installed_plugins docstring and the comment block to
reflect the current jq paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vars

YAS_MAX_WIDTH and YAS_FULL_WIDTH set in the developer's shell leaked into
Config.load() (which calls dict(os.environ)) and capped width at 40
instead of DEFAULT_MAX_WIDTH=140.  Add monkeypatch.delenv for both vars
before the test's calls so the test sees the true defaults regardless of
the host environment.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The elapsed_section method was defined twice: once with GLYPH_HOURGLASS
(wider, misaligns layout width budget) and once without (correct, what
the layout and snapshot tests expect).  Remove the glyph variant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tmck-code tmck-code marked this pull request as ready for review June 6, 2026 08:27
@tmck-code tmck-code merged commit a26c904 into main Jun 6, 2026
6 checks passed
@tmck-code tmck-code deleted the fix/debug-test-failures branch June 6, 2026 08:28
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.

1 participant