Skip to content

fix(webapp): accept injected clock in staleNote and buildExitSaveRequest - #359

Merged
isac322 merged 1 commit into
mainfrom
fix/issue-332-heat-test-clock
Nov 12, 2026
Merged

isac322 merged 1 commit into
mainfrom
fix/issue-332-heat-test-clock

Conversation

@isac322

@isac322 isac322 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

TL;DR

  • Adds an optional now = Date.now() clock parameter to staleNote and buildExitSaveRequest, completing the pure clock-injection contract across frontend/src/lib/.
  • Keeps heat.test.ts pinned to a deterministic timestamp instead of reading the live calendar clock, fixing the date-dependent npm test failure.
  • Adds STALE_DAYS - 1 vs STALE_DAYS boundary assertions and pins deterministic conflict naming in sharedfile_restore.test.ts.

Fixes #332

What & why

Other pure time-dependent helpers in internal/webapp/frontend/src/lib/ (daysSince, staleHot, readsByFolder, greeting, dateWindow, historyApiQuery, dayLabel, agoShort) accept an optional now argument so callers use the wall clock by default while unit tests pass fixed timestamps. Two helpers broke that contract:

  1. heat.ts::staleNote called daysSince(time) without forwarding now, causing heat.test.ts's "yesterday" fixture (2026-08-17T00:00:00Z) to age past STALE_DAYS as calendar time moved forward.
  2. editbeacon.ts::buildExitSaveRequest called new Date() directly when minting a plain-folder conflict path.

Both functions now accept now = Date.now(), leaving existing callers unchanged while making unit tests deterministic at any calendar date.

Checklist

  • go build ./... && go vet ./... && go test ./... green
  • Sync behavior changes have a multi-device test in internal/syncer (N/A: syncer untouched)
  • Frontend changes: npm run build re-committed internal/webapp/static and npm run e2e green (npm test 305/305 + Playwright dashboard.spec.ts & browse.spec.ts 90/90)
  • CLI behavior changes updated both README.md and plugin/skills/beardrive/SKILL.md (N/A: CLI untouched)

@isac322 isac322 self-assigned this Nov 12, 2026
@isac322
isac322 requested a review from runbear-bot November 12, 2026 12:51

@runbear-bot runbear-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Bobb's bot(Totoro) Review

Conclusion: ready

  • 병합을 차단할 결함은 발견하지 못했습니다.
  • 두 함수는 기본적으로 현재 시각을 사용하며 주입된 시각을 각각 경과 시간 계산과 충돌 파일명 생성에 전달합니다. 경계값과 고정 충돌 파일명 테스트도 추가되었습니다.
  • 정적 자산의 참조 경로를 확인했으며 누락된 파일은 발견하지 못했습니다.
  • 클린 체크아웃에 의존성이 없어 로컬 패키지 테스트는 실행하지 않았습니다.

@isac322
isac322 merged commit 6fa608a into main Nov 12, 2026
5 checks passed
@isac322
isac322 deleted the fix/issue-332-heat-test-clock branch November 12, 2026 13:04
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.

Frontend heat test's fixed date makes fresh-file assertion expire

2 participants