Skip to content

Land the press-rebound fix that raced the #1248 merge - #1249

Merged
malpern merged 1 commit into
masterfrom
claude/press-rebound-fix
Jul 30, 2026
Merged

Land the press-rebound fix that raced the #1248 merge#1249
malpern merged 1 commit into
masterfrom
claude/press-rebound-fix

Conversation

@malpern

@malpern malpern commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Summary

#1248 was merged three minutes before its final review-fix commit was pushed, so master carries the press-physics pass with two known defects this commit fixes:

  • The release rebound was dead code for a plain tap (signed press level collapsed by max() before the guard); now gated on components with a scene-level regression test
  • The capsApplying authored echo pose overwrote the press travel; travel now applies on top

Cherry-pick of 8efc9a1 from the merged branch, unchanged.

Review gate

remote review gate selected — GitHub claude-review is the enforced reviewer.

Testing

  • Scene/interaction/entrance suites pass (44 tests) including the new rebound regression test; snapshot suites stable

🤖 Generated with Claude Code

Review findings, both real:

- The per-key guard collapsed press and hold levels with max() before
  checking magnitude, so a plain tap's negative rebound level (hold
  absent, max(negative, 0) == 0) bailed out on exactly the frames the
  above-rest lift was written for. Gate on the signed components and
  clamp only the derived interaction level. Added a scene-level
  regression test for the rebound frame.
- The capsApplying authored echo pose assigned translation after the
  press travel, overwriting it; the travel now applies on top of the
  authored offset.

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

claude Bot commented Jul 30, 2026

Copy link
Copy Markdown

Reviewed the diff — both fixes look correct and the added test targets the right behavior.

  • KeyboardStageSceneBuilder.swift: good catch. The old code set translation.y = 0.12 * 0.023 and then immediately overwrote the whole translation with KeyboardStagePoint(x: -0.48, y: -0.52), silently discarding the indent offset. Folding it into -0.52 + 0.12 * 0.023 is the right fix.
  • KeyboardStageInteraction.swift: gating on abs(pressLevel) > 0.001 || abs(holdLevel) > 0.001 instead of abs(max(pressLevel, holdLevel)) > 0.001 correctly stops discarding the release-rebound frames (negative pressLevel, zero holdLevel) that previously collapsed to 0 and got skipped.
  • New test testReleaseReboundLiftsTheCapAboveRest covers the interesting case (negative pressLevel, zero hold) and checks interactionLevel == 0 / pressure unchanged, which matches the "no residual press styling" intent.

Minor/non-blocking nits:

  • max(pressLevel, holdLevel) is now computed twice (once implicitly via the two abs checks, once again for interactionLevel) instead of reusing a single level local like before — purely stylistic, no behavior issue.
  • The new test doesn't assert on opacity, which this same code path forces to max(_, 0.98) even during the negative-rebound frames it's exercising — worth a follow-up assertion if that opacity floor during rebound is intentional, just to lock in the expected visual (currently slightly brightened key while it's rebounding past rest).

No actionable correctness/reliability/security issues found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 600ad846f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// the rebound a plain tap has pressLevel slightly negative and no
// hold level, and max(negative, 0) would discard exactly the
// frames the above-rest lift exists for.
guard abs(pressLevel) > 0.001 || abs(holdLevel) > 0.001 else {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid retaining pressed opacity during the negative rebound

When a tapped key's authored opacity is below 0.98 (including most standard and dimmed keys), allowing its negative pressLevel through this guard also executes responsiveKey.opacity = max(responsiveKey.opacity, 0.98). The rebound frame therefore has zero interaction level and pressure but remains visibly highlighted until it abruptly returns to its base opacity when the transition settles, contrary to the intended no-residual-press-styling behavior. Apply the signed level only to the translation rebound, or gate the opacity boost on a positive press/hold level.

Useful? React with 👍 / 👎.

@malpern
malpern merged commit 8c76a79 into master Jul 30, 2026
5 checks passed
@malpern
malpern deleted the claude/press-rebound-fix branch July 30, 2026 06:37
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