4 Commits
Author SHA1 Message Date
vgearen f1b6b72d8d fix(critical): isolate AppStateTests from user's real data directory
PRIOR BEHAVIOR (data-loss bug):
AppStateTests.setUp() constructed AppState() directly, which used the real
~/Library/Application Support/Stockbar/ for stocks.json. Each test method
that did 'sut.stocks = [s1, s2]' triggered didSet → saveStocks → silently
overwrote the user's actual portfolio file with 2 test entries. backupIfNeeded
then rolled all 10 backup snapshots forward, eventually erasing every
historical copy of real data.

This destroyed a user's 29-stock portfolio when xcodebuild test was run
during Korean stock feature development (2026-05-14 10:08).

FIX:
- AppState gains a static appSupportDirOverride: URL? hook
- AppStateTests.setUp() creates a unique tmpDir, sets the override, tearDown
  resets and removes the directory
- Verified: after running all 7 AppStateTests, the real stocks.json is
  byte-identical to before the run.

This must land before any further test run touches AppState.
2026-05-14 10:35:01 +08:00
vgearen 6e63064207 feat(korea): add koreanMarketSession + wire KR into AppState.refresh
AppState.koreanMarketSession (nonisolated) returns '盘中' during KST 09:00-15:30
on weekdays, nil otherwise. Marked nonisolated so it can be called from sync
non-MainActor contexts (notably tests).

AppState.refresh now has a 5th parallel branch fetching Korean quotes via
DataService.fetchKoreanQuotes. KR is non-throwing (returns [:] on failure) so
it's awaited outside the try block — any KR network failure does not abort
A股/港股fetch results.
2026-05-14 10:05:47 +08:00
vgearenandClaude Sonnet 4.6 28cf10480b Rename app from StockMonitor to Stockbar
- Bundle ID: com.vgearen.StockMonitor → com.vgearen.Stockbar
- Display name: Stock Monitor → Stockbar
- App entry struct: StockMonitorApp → StockbarApp
- App Support path: ~/Library/Application Support/Stockbar
- Log path: ~/Library/Logs/Stockbar
- OSLog subsystem: com.vgearen.Stockbar
- Test module import: @testable import Stockbar
- GitHub Actions: scheme, DMG name updated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 09:34:19 +08:00
vgearenandClaude Sonnet 4.6 6b1f565d7d Initial release: macOS menu bar stock monitor
- A-shares, HK, and US stock real-time quotes (Sina / Tencent)
- Intraday minute charts (Tencent / Yahoo Finance)
- US extended-hours session indicator with price and change%
- Portfolio P&L tracking (cost price × shares)
- Sort by change%, color themes, launch at login
- File-based persistence with 10-snapshot rolling backup
- Universal binary (Apple Silicon + Intel)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 17:41:52 +08:00