Skip to content

Conversation

@arii
Copy link
Owner

@arii arii commented Feb 10, 2026

Description

This PR corrects stale HRM data detection and refactors types. It addresses the "ghost tile" issue where stale data was not being flagged correctly because the client was using the message receipt timestamp (lastUpdated) instead of the sensor's origin timestamp (updatedAt).

The motivation is to ensure accurate and timely display of Heart Rate Monitor (HRM) data by using the correct timestamp for staleness detection, resolving the "ghost tile" problem. Additionally, the HRM data types have been refactored for better consistency, and the component code has been cleaned up for improved performance (memoization) and readability.

Fixes # (issue)

Change Type: 🐛 Bug fix (non-breaking change fixing an issue)

PR Scope Checklist

This checklist is mandatory for all PRs.

  • PR has a clear, single purpose: The title and description of the PR clearly state the purpose of the change.
  • All changes relate to the stated objective: The code changes should be directly related to the purpose of the PR.
  • No unrelated cleanup or refactoring: The PR should not contain any changes that are not directly related to the stated objective.
  • Title and description match the actual changes: The title and description should accurately reflect the changes in the PR.
  • Tests cover the specific change scope: The tests should be focused on the changes in the PR and should not include unrelated tests.

Impact Assessment

  • Changes are backward compatible (or breaking changes are documented)
  • Tests are added/updated for new functionality
  • Documentation is updated if needed
  • ADR is created/updated for significant architectural changes
Original PR Body

This PR addresses the "ghost tile" issue where stale data was not being flagged correctly because the client was using the message receipt timestamp (lastUpdated) instead of the sensor's origin timestamp (updatedAt). It also refactors the HRM data types for better consistency and cleans up the component code for better performance (memoization) and readability.


PR created automatically by Jules for task 12774384463479310696 started by @arii

- Centralize HRM data types in `types/websocket.ts` (`ConnectedHrmData`, `ClientHrmData`) and remove redundant definitions in `context/webSocketReducer.ts` and `utils/hrm.ts`.
- Fix logic in `utils/hrm.ts` to use `updatedAt` (sensor timestamp) instead of `lastUpdated` (receipt timestamp) for staleness detection.
- Refactor `components/HrTileWrapper.tsx` to use flattened props and simple `React.memo` (removing custom comparator).
- Clean up `components/HrmTiles.tsx` by removing duplicate code blocks and verbose comments.
- Update `components/HrmConnectionPanel.tsx` to use refactored `HrTileWrapper`.
- Revert unintended changes in `deploy/runner/README.md`.
- Add unit test case for stale sensor data scenario in `tests/unit/utils/hrm.test.ts`.
- Update `tests/unit/components/HrTileWrapper.test.tsx` and `tests/mocks/components.tsx` to align with new props structure.

Co-authored-by: arii <342438+arii@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@github-actions github-actions bot changed the title fix: correct stale HRM data detection and refactor types feat(large): fix: correct stale HRM data detection and refactor types Feb 10, 2026
@arii
Copy link
Owner Author

arii commented Feb 10, 2026

📋 Quality Gate Results

Check Status
Knip ✅ success
Lint ❌ failure
Slop ✅ success
Build ✅ success
Infra Tests ❌ skipped
Unit Tests ❌ skipped
Component Tests ❌ skipped
Perf Tests ❌ skipped
Visual Tests ❌ skipped

❌ Lint Failure Details


> hrm@0.30.0 lint /home/runner/work/hrm/hrm
> eslint app/ components/ constants/ context/ hooks/ lib/ services/ tests/ types/ utils/ server.ts proxy.ts --cache


/home/runner/work/hrm/hrm/tests/unit/components/HrTileWrapper.test.tsx
   7:10  error  'HrTileProps' is defined but never used   unused-imports/no-unused-imports
  11:18  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 2 problems (2 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

 ELIFECYCLE  Command failed with exit code 1.

❌ Infrastructure Test Failure Details

Log file not found.

❌ Unit Test Failure Details

Log file not found.

❌ Component Test Failure Details

Log file not found.

❌ Visual Test Failure Details

Log file not found.

❌ Performance Test Failure Details

Log file not found.

⚠️ Some checks failed. Full logs available in workflow artifacts.


Report generated for commit: e57f94350c7c9e243c5c4c5225c6906f2c9cb16c

@google-labs-jules
Copy link
Contributor

📋 Quality Gate Results

Check Status
Knip ✅ success
Lint ❌ failure
Slop ✅ success
Build ✅ success
Infra Tests ❌ skipped
Unit Tests ❌ skipped
Component Tests ❌ skipped
Perf Tests ❌ skipped
Visual Tests ❌ skipped

❌ Lint Failure Details


> hrm@0.30.0 lint /home/runner/work/hrm/hrm
> eslint app/ components/ constants/ context/ hooks/ lib/ services/ tests/ types/ utils/ server.ts proxy.ts --cache


/home/runner/work/hrm/hrm/tests/unit/components/HrTileWrapper.test.tsx
   7:10  error  'HrTileProps' is defined but never used   unused-imports/no-unused-imports
  11:18  error  Unexpected any. Specify a different type  @typescript-eslint/no-explicit-any

✖ 2 problems (2 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.

 ELIFECYCLE  Command failed with exit code 1.

❌ Infrastructure Test Failure Details

Log file not found.

❌ Unit Test Failure Details

Log file not found.

❌ Component Test Failure Details

Log file not found.

❌ Visual Test Failure Details

Log file not found.

❌ Performance Test Failure Details

Log file not found.

⚠️ Some checks failed. Full logs available in workflow artifacts.


Report generated for commit: e57f94350c7c9e243c5c4c5225c6906f2c9cb16c

Fixed lint errors in tests/unit/components/HrTileWrapper.test.tsx by removing unused import HrTileProps and replacing any with specific prop types.

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