Enable debug logging and fix shared prefix entity resolution#985
Merged
Enable debug logging and fix shared prefix entity resolution#985
Conversation
- Remove unused Callsign entityCall and QString prefixForSubdivision - Remove redundant primarySubdivisions.clear() after fresh declaration - Skip second getPrimarySubDivisions query when hostFullPrefix == hostPrefix - Use int directly in qDebug instead of QString::number() - Fix debug message label at fallback step 50 https://claude.ai/code/session_01LWBgDGA4opzSHSYpq8sxnH
…ad of Antarctica CE9 is Antarctica's main prefix but also appears in South Shetland Islands' sub-prefix list. The prefixesofentity table allows both (UNIQUE on prefix+dxcc, not prefix alone), and getWorldData() has no ORDER BY so QHash::insert() lets the last-loaded row win — South Shetland Islands (241) appears after Antarctica (13) in cty.csv and silently overwrites CE9 in the hash. The new test_SharedPrefixEntityIdentification() pinpoints this regression and also guards KC4 (exclusive Antarctica prefix) and VP8/S (South Shetland Islands main prefix) to prevent related regressions. https://claude.ai/code/session_01LWBgDGA4opzSHSYpq8sxnH
getWorldData(): two-phase load so canonical main prefixes always win. Previously, when a prefix appeared in multiple entities' sub-prefix lists (e.g. CE9 in both Antarctica and South Shetland Islands), the last row loaded silently overwrote earlier ones in the QHash. Phase 2 now overwrites all sub-prefix entries with each entity's mainprefix from the entity table, making the canonical mapping deterministic regardless of cty.csv row order. readZones(): fix Qt5→Qt6 migration bug in both zone-override blocks. sliced(pos, 1) took only the bracket character itself, causing ITUz/CQz overrides like EA8[28] or KH8(32) to always produce zone 0. Changed to sliced(pos + 1) to capture the number after the bracket. https://claude.ai/code/session_01LWBgDGA4opzSHSYpq8sxnH
|
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
This PR enables comprehensive debug logging throughout the entity and prefix resolution logic and fixes a critical bug where shared prefixes between entities were resolved to the wrong entity.
Key Changes
Debug Logging Enhancements
qDebug()statements insetEntityAndPrefix()method to provide detailed tracing of entity resolution logicslotEntityNameComboBoxChanged()to log entity lookupsBug Fixes
hostFullPrefix != hostPrefixwhen checking ifprimarySubdivisionsis empty, preventing incorrect fallback to main prefix when a valid full prefix existsprimarySubdivisions.append()calls to direct assignment (=) to avoid accumulating duplicate resultsprimarySubdivisions.clear()callTest Coverage
test_SharedPrefixEntityIdentification()to verify that shared prefixes resolve to the correct entityImplementation Details
The root cause of the shared prefix bug was in the prefix lookup logic where multiple entities could claim the same prefix. The fix ensures that when a full prefix match is found, the code doesn't incorrectly fall back to the main prefix lookup, which could return a different entity that also uses that prefix.
https://claude.ai/code/session_01LWBgDGA4opzSHSYpq8sxnH