Skip to content

fix: limit minimum time for stored positions to minTimeOffset (18 hours ago)#49

Merged
k1LoW merged 1 commit intomainfrom
limit-default-time
Jan 5, 2026
Merged

fix: limit minimum time for stored positions to minTimeOffset (18 hours ago)#49
k1LoW merged 1 commit intomainfrom
limit-default-time

Conversation

@k1LoW
Copy link
Copy Markdown
Owner

@k1LoW k1LoW commented Jan 5, 2026

  • Add check in Load() to return minTime when stored time is older
  • Rename defaultTime to minTime and defaultTimeBefore to minTimeOffset for clarity

This pull request updates the logic for handling minimum time offsets in the Pos struct, making the minimum allowable time more flexible and robust. The main changes involve renaming variables for clarity, extending the minimum time offset, and ensuring that loaded times do not fall below this minimum.

Improvements to time handling and struct clarity:

  • Changed the minimum time offset from -12 * time.Hour to -18 * time.Hour and renamed the variable from defaultTimeBefore to minTimeOffset for clarity.
  • Updated the Pos struct and its constructors to use minTime instead of defaultTime, reflecting the new minimum time logic.

Robustness in time loading:

  • Modified the Load method to ensure that any loaded time earlier than minTime is replaced with minTime, preventing outdated timestamps from being used.

@k1LoW k1LoW self-assigned this Jan 5, 2026
@k1LoW k1LoW added bug Something isn't working tagpr:minor labels Jan 5, 2026
@k1LoW k1LoW requested a review from Copilot January 5, 2026 07:48
@k1LoW k1LoW added enhancement New feature or request bug Something isn't working and removed bug Something isn't working enhancement New feature or request labels Jan 5, 2026
Copy link
Copy Markdown

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 enhances the position tracking system to prevent processing logs older than a configurable minimum time threshold. It renames variables for clarity and adds runtime validation to clamp stored positions to a minimum time boundary.

Key Changes:

  • Renames defaultTime to minTime and defaultTimeBefore to minTimeOffset for clearer semantics
  • Increases the minimum time offset from 12 hours to 18 hours in the past
  • Adds validation in Load() to return minTime when stored times are older than the threshold

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

Comment thread pos/pos.go
Comment thread pos/pos.go
…rs ago)

- Add check in Load() to return minTime when stored time is older
- Rename defaultTime to minTime and defaultTimeBefore to minTimeOffset for clarity
@k1LoW k1LoW force-pushed the limit-default-time branch from 8e33212 to c3684b5 Compare January 5, 2026 07:57
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 5, 2026

Code Metrics Report

main (b18830b) #49 (54bc9f6) +/-
Coverage 5.6% 5.8% +0.2%
Code to Test Ratio 1:0.1 1:0.1 +0.0
Test Execution Time 10s 10s 0s
Details
  |                     | main (b18830b) | #49 (54bc9f6) |  +/-  |
  |---------------------|----------------|---------------|-------|
+ | Coverage            |           5.6% |          5.8% | +0.2% |
  |   Files             |             10 |            10 |     0 |
  |   Lines             |            405 |           407 |    +2 |
+ |   Covered           |             23 |            24 |    +1 |
+ | Code to Test Ratio  |          1:0.1 |         1:0.1 |  +0.0 |
  |   Code              |            939 |           942 |    +3 |
+ |   Test              |            102 |           108 |    +6 |
  | Test Execution Time |            10s |           10s |    0s |

Code coverage of files in pull request scope (30.2% → 30.7%)

Files Coverage +/- Status
pos/pos.go 30.7% +0.5% modified

Reported by octocov

@k1LoW k1LoW merged commit 7f65bc5 into main Jan 5, 2026
2 checks passed
@k1LoW k1LoW deleted the limit-default-time branch January 5, 2026 08:02
@github-actions github-actions Bot mentioned this pull request Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working tagpr:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants