Baseline "expires" date takes effect at UTC midnight, not on the local day

Open
#198 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
backend, testing

Research direction

Read internal/finding/baseline.go around expired and check how the engine clock is supplied in internal/engine/run.go and internal/engine/scaffold.go. Choose and document one expiry time zone in docs/ci.md, then add a fixed-clock test in a non-UTC zone for the boundary. Run make test-short (or .\make.ps1 test-short on Windows) and make lint; done when the test pins the chosen rule and the docs explain it.

Written by the indexing model from the issue text.

Description

bug good first issue severity: low

Summary

A baseline entry's expiry date is parsed as midnight UTC and compared with the current instant, so west of UTC the entry stops accepting on the evening before the date written. The docs name no time zone.

Where

  • internal/finding/baseline.go:50-55 (expired)
  • internal/engine/run.go:122, internal/engine/scaffold.go:34 (engine clock)
  • docs/ci.md:182 ("from that day on it accepts nothing")

Details

expired parses the date with time.Parse(time.DateOnly, e.Expires) and returns !now.Before(d); now is time.Now by default.

Impact

At UTC-8 an entry expires at 16:00 on the previous day, so a local scan or pre-commit hook fails the gate a day early; east of UTC it keeps accepting for the first hours of the expiry day. CI runners in UTC behave as documented, so the same baseline can pass in CI and fail locally on the same evening.

Suggested fix

Decide the rule and state it. Either compare calendar days in one zone (now.UTC().Format(time.DateOnly) >= e.Expires, and say "UTC" in docs/ci.md), or parse the date in the local zone with time.ParseInLocation.

Acceptance criteria

  • The rule is one of the two above and docs/ci.md states it
  • A test with a fixed clock in a non-UTC zone pins the boundary

Related: #81

Getting started

  • Relevant files: docs/ci.md, internal/engine/run.go, internal/finding/baseline.go
  • How to run tests: make test-short (Unix) or .\make.ps1 test-short (Windows PowerShell); make lint before you call it done
  • Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at 50e92ec. Severity: low. Effort: S. audit-key: bug|internal/finding/baseline.go|BaselineEntry.expired

Dominant language
Go
Stars
0
Forks
1
Avg merge
8h 14m
Merged PRs (30d)
3

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TMHSDigital/Spackle

All issues in TMHSDigital/Spackle

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.