Skip to content

recorder: use target_power from TrainerSample, add json dump to logging#98

Merged
luigi311 merged 1 commit intomainfrom
returned_target_power
Feb 28, 2026
Merged

recorder: use target_power from TrainerSample, add json dump to logging#98
luigi311 merged 1 commit intomainfrom
returned_target_power

Conversation

@luigi311
Copy link
Owner

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the recorder to consume newer bleaksport trainer sample fields (notably target_power and speed_kmh) and enhances logging by binding full sample objects into Loguru records and pretty-printing them as JSON in the console formatter.

Changes:

  • Bump bleaksport git revision in uv.lock.
  • Add structured TRACE logging for RunningSample / TrainerSample via logger.bind(data=sample).
  • Update trainer sample handling to convert speed_kmh → m/s and schedule ERG updates based on TrainerSample.target_power.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
uv.lock Updates bleaksport git commit to pick up new/changed trainer sample fields/APIs.
src/fitness_tracker/recorder.py Uses TrainerSample.target_power to trigger ERG updates; switches to speed_kmh conversion; binds samples into TRACE logs.
src/fitness_tracker/main.py Introduces a custom Loguru formatter that JSON-dumps bound extra["data"] for easier debugging.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

from dataclasses import asdict, is_dataclass
from enum import Enum

from bleaksport.trainer import TrainerSample
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

TrainerSample is imported but not used in this module. If it’s not intentionally kept for side effects or type checking, remove it to avoid dead imports.

Suggested change
from bleaksport.trainer import TrainerSample

Copilot uses AI. Check for mistakes.
@luigi311 luigi311 force-pushed the returned_target_power branch from edf14bf to 7dfc5e1 Compare February 28, 2026 18:38
@luigi311 luigi311 merged commit 1f0fcf2 into main Feb 28, 2026
6 checks passed
@luigi311 luigi311 deleted the returned_target_power branch February 28, 2026 18:38
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