Repository navigation
fix(collector): filter non-six-digit symbols before name lookup - #12
Merged
Merged
Conversation
Ranking responses can include ETN-style symbols (e.g. 0197W0) which fetchStockNames() rejects with IllegalArgumentException, failing the entire chunk. Filter to six-digit KRX symbols in refreshSymbols() so ranking rows resolve their display names instead of showing null.
mytrashcan
commented
Jul 31, 2026
mytrashcan
left a comment
Owner
Author
There was a problem hiding this comment.
Code Review Summary
Verdict: Looks good — mergeable
Verified OK
- Root cause is accurate:
fetchStockNames()rejects any chunk containing a non-six-digit symbol, so a single ETN code (0197W0) from the ranking response failed every chunk and left the name cache empty. - Fix is minimal and correctly placed: filtering in
refreshSymbols()covers both call paths (refreshMissingfrom rankings,refreshAllfrom universe + watchlist) without touchingnameOf()semantics. \d{6}predicate matches the existingvalidateSymbols()contract exactly — no behavior drift.- KOSPI/KOSDAQ market symbols still resolve via
MarketInstrument.displayName()and never reachfetchStockNames(). - New test proves the regression: ETN-style symbols are excluded from the upstream call while valid six-digit symbols still populate the cache.
- Full suite passes:
./gradlew clean check→ BUILD SUCCESSFUL.
Good Things
- One-place fix with a clear comment explaining why the filter exists (ranking responses carry non-standard symbols).
- Test asserts both the positive (name resolved) and negative (symbol never sent upstream) outcomes.
Reviewed by Hermes Agent - deepseek-v4-flash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the ranking dashboard showing
name: nullfor some rows (only the stock code visible).Root cause: Toss ranking responses include non-six-digit symbols (e.g. ETN
0197W0).MarketRankingService.refreshAll()passed all of them toStockReferenceService.refreshMissing(), andTossMarketDataClient.fetchStockNames()rejects any chunk containing a non-six-digit symbol withIllegalArgumentException. Every chunk failed, so the name cache never populated andRankingView.namewas null for all rows (log:종목명 조회 실패(200종목): IllegalArgumentException).Fix:
StockReferenceService.refreshSymbols()now filters to six-digit KRX symbols (\d{6}) before calling the name API. This covers all call paths (refreshMissingfrom rankings,refreshAllfrom universe + watchlist) in one place.nameOf()behavior is unchanged — KOSPI/KOSDAQ still resolve viaMarketInstrument.displayName.Changes
StockReferenceService.java: filter non-six-digit symbols inrefreshSymbols()(3 lines + comment)StockReferenceServiceTest.java: new testfiltersNonSixDigitSymbolsBeforeNameLookup— asserts ETN-style symbols never reachfetchStockNames()while valid six-digit symbols doTest plan
./gradlew test --tests 'com.marketguard.collector.StockReferenceServiceTest'→ pass./gradlew test --tests 'com.marketguard.collector.MarketRankingServiceTest'→ pass./gradlew clean check --no-daemon --no-parallel→ BUILD SUCCESSFUL (full suite)