Skip to content

fix(mod): "next 5h" only before a share; test the cold token figure - #1174

Merged
amiddavid merged 2 commits into
mainfrom
band-share-notes
Nov 16, 2026
Merged

amiddavid merged 2 commits into
mainfrom
band-share-notes

Conversation

@amiddavid

@amiddavid amiddavid commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

Behavior change

  • Who: subscription users of the band, below 80 columns, in one rare state: learned 5-hour weights, no warm price from the proxy (an old proxy), and a write tier the fit did not learn.
  • Old: next 5h 90.0k wr cold. The 5h label had no share after it.
  • New: next 90.0k wr cold.
  • How to turn it off: there is no switch. Revert this PR.
  • This needs the owner's yes.

Summary

This PR fixes the 2 non-blocking notes from the round-2 review of #1135 (reviewer 2). Follow-up to #1095.

What changed

  • context-guru-plugin/hooks/register.tsx: below 80 columns, row 1 starts with next 5h only when a share follows it. A lone token figure gets plain next.
  • context-guru-plugin/hooks/register.test.tsx, 2 new tests:
    • A cold band whose write tier the fit did not learn: ○ cache cold · next message 90.0k wr, warning color, no of 5h, at 140 and 60 columns.
    • The narrow case above: next 90.0k wr cold, with no 5h.

Data dependence

No change. The band reads the same token counts and weights as before.

How it was tested

🤖 Generated with Claude Code

Two non-blocking notes from the round-2 review of #1135:
- Below 80 columns the band wrote "next 5h 90.0k wr cold" when the warm
  state had no price and the fit did not learn the entry's write tier. The
  "5h" label had no share after it. Now the label is "next 5h" only when a
  share follows it.
- New test: a cold band whose write tier the fit did not learn shows
  "next message 90.0k wr" in the warning color, with no "of 5h", at 140 and
  60 columns.

Assisted-By: Claude
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Owner decision (David Amid, 2026-11-16): approved. The label change below 80 columns (next 5h 90.0k wr cold becomes next 90.0k wr cold) may merge.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @amiddavid) Claude Code 2.1.325 offload-review skill, @amiddavid's session fresh 2 of 2 1 of 2 df6937570954 approve

Verdict: approve

Findings

None.

Non-blocking

  • register.tsx:342 — the new comment is in the wrong place. It sits above const cmd = rotatingTip(now), which is not related. Move it to the narrow ? … 'next 5h ' line (355), or next to coldShare (341).
  • Narrow row with a warm share and a cold token figure is still unclear. At 60 columns, a warm 1-hour entry with an unlearned 1-hour write reads next 5h ≈0.1% · 90.0k wr cold. The leading 5h reads as if it applies to both figures. The wide row is clear (≈0.1% of 5h · 90.0k wr if cold). This is old behavior, not from this PR. No test pins the narrow form of this state. Consider a follow-up test, or a decision on the wording.
  • register.test.tsx:455 — the regex /of 5h|5h/ has a redundant branch. /5h/ alone covers it.
  • The first new test passes on the base too. The cold branch did not change, so this test adds coverage and does not pin the fix. The second test pins the fix: on the base, isShare is true and the row starts next 5h , so /^◆ next 90\.0k wr cold/ fails.

What I checked

  • The full diff (1 commit, 2 files, +33/−1) and the PR body.
  • register.tsx:294-375: the band row 1, warm/cold/isShare/coldShare, and the warm and cold branches.
  • model.ts:87-120, nextPrice: share returns with warm undefined only when warmUsd is missing. coldIsTokens is true when the write tier's weight is not learned.
  • The new label logic, case by case, below 80 columns:
    • warm share, cold share or cold tokens → next 5h (as before).
    • no warm, cold share → next 5h ≈x% cold (as before).
    • no warm, cold tokens → next 90.0k wr cold (new; the 5h had nothing to qualify).
    • tokens or usd → next (as before).
  • The wide row and the cold-cache row do not read narrow for the label, so they do not change.
  • The pane (register.tsx:510-513) has its own coldUnit logic and does not change.
  • Test fixtures: entry() puts expiry at end_ts + ttl_s. Test 1 uses end_ts = NOW − 2h, ttl_s = 3600, so the cache is cold. WEIGHTS has cache_write_1h: false, so the cold figure stays in tokens. Test 2 drops next_warm_usd from the doc and the main thread, so warm is undefined. The cold figure is 90.0k wr.
  • The behavior change is named at the top of the PR, with who, old, new and how to turn it off. It asks for the owner's yes, as CLAUDE.md requires.
  • Data dependence: no change. The band reads the same counts and weights. No row file is needed.
  • I did not run the tests (live tests not approved for this review).

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (bob, user of @amiddavid) IBM Bob Shell 1.0.3 offload-review skill, @amiddavid's session fresh 1 of 2 1 of 2 df6937570954 approve

Verdict: approve

Findings

None.

Non-blocking

None.

What I checked

  • The diff: One logic change in register.tsx line 357, one comment added line 341, two new tests in register.test.tsx lines 445-474.
  • The change: The condition for showing "next 5h" prefix now checks isShare && (warm !== undefined || coldShare) instead of just isShare. This ensures "next 5h" appears only when a share percentage follows it, not when a token figure follows.
  • The tests: Two new tests cover the fixed cases:
    1. Cold band with unlearned write tier shows "90.0k wr" with no "of 5h" or "5h" (lines 445-460)
    2. Warm band below 80 columns with no warm price and unlearned write tier shows "next 90.0k wr cold" with no "5h" (lines 462-474)
  • Correctness: The logic is correct. When isShare is true but neither warm nor coldShare has a value, the display would show "next 5h" followed by nothing or a token figure. The fix prevents this.
  • Test coverage: Both new tests verify the exact output format and check that "5h" does not appear. The cold test also verifies the warning color.
  • Commit: DCO signed, follows conventional commit format, includes Assisted-By attribution.
  • No behavior change: This fixes a display inconsistency. No functional logic changes. No data flow changes.
  • Fail-open: Not applicable. This is a display-only change in the plugin UI layer.
  • Documentation: The inline comment at line 341 explains the rule clearly.

The fix addresses the non-blocking notes from #1135 round 2 review. The change is minimal, well-tested, and correct.

Review note on #1174 (reviewer 1): the comment sat above an unrelated line.
Comment-only change.

Assisted-By: Claude
Signed-off-by: DAVID AMID <[email protected]>
@amiddavid

Copy link
Copy Markdown
Collaborator Author

Round 1 answers. Both reviewers approve.

Reviewer 1 (approve), non-blocking notes

  • The new comment sat above an unrelated line: fixed in 90de887. It now sits above isShare, with the other comment about the narrow row. Comment-only. The approval script counts only Go and shell comments, so it prints CHANGED, and round 2 re-checks this delta.
  • next 5h ≈0.1% · 90.0k wr cold at 60 columns (warm share, cold token figure): kept. It is older behavior, not from this PR. A share leads the row there, so 5h belongs to it. The owner can ask for different words in a new issue.
  • The redundant branch in /of 5h|5h/: kept. It does no harm, and a change to it now would need one more review round.
  • The first new test also passes on the base: correct. It adds coverage for the cold token figure, as the round-2 note on feat(mod): on a subscription show the next message as a share of the 5-hour limit #1135 asked. The second test pins the fix.

Reviewer 2 (approve)

No findings.

Backends in this round

The GLM gateway did not answer (DNS, ENOTFOUND). Reviewer 1 posted with Bob. For reviewer 2, Bob login timed out after 3 minutes, so it posted with Claude.

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 2 (claude, user of @amiddavid) Claude Code 2.1.325 offload-review skill, @amiddavid's session resumed 2 of 2 2 of 2 90de887d6071 approve

Verdict: approve

Findings

None.

Earlier notes

No reviewer raised a blocking finding in round 1. My 4 non-blocking notes:

  1. Comment in the wrong place: fixed in 90de887d. The comment now sits above isShare, next to the other comment about the narrow row (register.tsx:337-339).
  2. next 5h ≈0.1% · 90.0k wr cold at 60 columns: kept by the author. Reason: old behavior, and a share leads the row, so 5h belongs to it. I accept this. It is not from this PR.
  3. Redundant /of 5h|5h/ branch: kept. I accept this. It does no harm.
  4. First new test passes on the base: the author agrees. It is coverage, as the #1135 note asked. The second test pins the fix.

Non-blocking

  • The round-1 answers comment lists my 4 notes under "Reviewer 1". Reviewer 1 had no notes. They came from reviewer 2. The record is wrong, but the answers are right.

What I checked

  • Last review: round 1, df69375709541eaf42a7d74be7bdc44875828089, 2026-11-16T19:18:17Z
  • New commits read: 1 — 90de887d docs(mod): put the narrow-label comment next to the code it explains
  • Read in full: 2 reviews, 2 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 1 round-1 review (19:19:07Z): approve, no findings, no notes. Nothing to answer.
    • Author's round-1 answers (19:20:29Z): checked each answer against my notes, as above.
    • The owner's decision comment (19:13:09Z) is older than my last review. I read it now: the owner approves the label change. This satisfies the behavior-change rule in CLAUDE.md.
  • The new diff is 1 comment line moved, +1/−1. No code changed. The full PR diff from base is the same logic as in round 1.
  • I did not run the tests (live tests not approved for this review).

@amiddavid amiddavid left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer Kind Started by Context Review Round Head Verdict
Reviewer 1 (bob, user of @amiddavid) IBM Bob Shell 1.0.3 offload-review skill, @amiddavid's session resumed 1 of 2 2 of 2 90de887d6071 approve

Verdict: approve

Findings

None.

Earlier notes

I had no findings or non-blocking notes in round 1. Reviewer 2 had 4 non-blocking notes. The author addressed note 1 (comment placement) in commit 90de887d. Notes 2-4 were kept by the author with valid reasons.

Non-blocking

None.

What I checked

  • Last review: round 1, df69375709541eaf42a7d74be7bdc44875828089, 2026-11-16T19:19:07Z
  • New commits read: 1 — 90de887d "docs(mod): put the narrow-label comment next to the code it explains"
  • Read in full: 3 reviews, 2 comments, 0 inline comments (from the three files)
  • New items since my last review:
    • Reviewer 2 round-1 review (19:18:17Z): approve with 4 non-blocking notes about comment placement, narrow row wording, redundant regex, and test coverage
    • Author's round-1 answers (19:20:29Z): fixed comment placement in 90de887d, kept other items with reasons
    • Reviewer 2 round-2 review (19:21:07Z): approve, confirms comment fix, accepts author's reasons for keeping other items
    • Owner decision (19:13:09Z, older than my round 1 but read now): approves the label change
  • The new commit 90de887d:
    • Moves comment from line 342 to line 339 (above isShare declaration)
    • Comment now sits next to coldShare and the other narrow-row comment
    • No code changed, only comment position
    • Diff: +1/-1, one line moved
  • Verified the comment now explains the correct code: it sits above isShare and describes when "5h" leads the narrow row
  • The full PR diff from base remains the same logic as round 1: the condition change at line 357 and the two new tests
  • DCO signed, conventional commit format, Assisted-By attribution
  • I did not run the tests (live tests not approved for this review)

The comment-only change is correct. The PR is ready to merge.

@amiddavid amiddavid closed this Nov 16, 2026
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Nov 16, 2026
@amiddavid amiddavid reopened this Nov 16, 2026
@amiddavid
amiddavid merged commit b3a8fde into main Nov 16, 2026
15 of 16 checks passed
amiddavid added a commit that referenced this pull request Nov 19, 2026
Plugin versions for v0.7.4:
- Claude Code plugin 0.7.3 -> 0.7.4 (#1096, #1135, #1174, #1177, #1199,
  #1216).
- Codex plugin 0.2.12 -> 0.2.13 (#1115, #1135).
- Pi package 0.1.1 -> 0.1.2 (#1113).
- Bob plugin 0.1.1 -> 0.1.2 (#1093, #1111, #1118, #1124, #1126, #1127).
  The owner's Bob hold (#1221) covers release tests only.
- OpenCode: PINNED_VERSION v0.7.3 -> v0.7.4 in opencode-plugin/index.js,
  its README, docs/how-to/install-opencode-plugin.md and 3 tests.

Behavior change: the version numbers; the OpenCode plugin's first start
downloads proxy v0.7.4. Release bumps are approved by the owner ("I
approve version bumps").

Data dependence: none.

Reviews: 2 offload review rounds (GLM): both approve at ab79001. After
it: 1422093, a merge of main with no hand resolution (remerge-diff 0;
approval-still-valid: SAME CHANGE).

Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant