Repository navigation
fix(analytics): convert decimal channel hashes to hex format in UI - #192
Merged
Merged
Conversation
ITblacksheep
approved these changes
Oct 11, 2026
Contributor
|
Can you go ahead and open an enhancement to fix this on the backend also? |
Contributor
Author
Follow-up items documented in #193 |
ITblacksheep
force-pushed
the
bug-190_incorrect_decimal_channel_hashes
branch
from
October 11, 2026 17:46
1a0e8ce to
9c884f6
Compare
This was referenced Oct 12, 2026
Strycher
force-pushed
the
bug-190_incorrect_decimal_channel_hashes
branch
from
October 12, 2026 01:33
9c884f6 to
7440c6b
Compare
Contributor
|
Human approval received from Strycher in session 64287058 ("Merge #192."). Re-validated against the remote immediately prior: state=OPEN, mergeable=MERGEABLE, mergeStateStatus=CLEAN, reviewDecision=APPROVED (ITblacksheep), head Rebased earlier tonight onto the #194 staging fix. The rebase preserved content exactly — diff hash |
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 #190
The Hash column in Analytics → Channels showed decimal values (
17,129) instead of hexadecimal.Root cause
channelRowHtmlinpublic/analytics.jsonly formatted the hash as hex whenc.hashwas a JavaScript number./api/analytics/channelssends it as a decimal string ("17"), so it took the fallback branch and was printed as-is. The Go tests assert this string format (channel_analytics_test.go), so the API is unchanged and the fix is in the frontend.Changes
public/analytics.jschannelHashNum(h), which turns a number or an all-digits string into a number and returnsNaNfor anything else.formatChannelHash(h), which renders0xNN(uppercase, zero-padded to 2 digits) for numeric values. Non-numeric ids such asenc_A1B2pass throughesc(). They were previously printed unescaped.channelRowHtmlusesformatChannelHash(c.hash)for the Hash cell.hashcase insortChannelscompares numerically when both hashes are numeric, so the order is0x05 < 0x11 < 0x81. Previously decimal strings sorted as text. Non-numeric hashes keep the old string compare.#/channels?ch=<hash>deep link still uses the decimal value, so existing bookmarks keep working.tests/unit/test-frontend-helpers.js"17","129"and"5"render as0x11,0x81and0x05. Decimal is not displayed, and the deep link keeps?ch=17.enc_A1B2is unchanged and<b>is HTML-escaped.Testing
node tests/unit/test-frontend-helpers.js: 729 passed, 0 failed.Performance
No hot-path impact. This is one regex and one
toString(16)per rendered row, and the sort comparator does a cheap parse per comparison.Follow-ups (not in this PR)
hashHexfield, so clients stop converting a string themselves. This is a good moment to move the channels analytics response to a named struct, in line with themap[string]interface{}rule in AGENTS.md.public/channels.jsshows the same decimal value anywhere.