Repository navigation
fix(channels): request GRP_TXT packets with type=5, the parameter the API reads (#2515) - #2518
Merged
Merged
Conversation
… API reads (Kpa-clawbot#2515) Client-side channel decryption fetched /api/packets?limit=1000&payloadType=5, but the packets endpoint only reads `type` (cmd/server/routes.go). The filter was dropped, so the 1000 newest rows of every payload type came back and channels.js threw away everything that was not GRP_TXT/CHAN. On a busy mesh that left only a fraction of the window as channel candidates, so decrypted channel history was much shorter than the limit implies. The request now sends type=5, which both the in-memory store and the SQLite path filter on payload_type. The candidate loop already checked the decoded type and channel hash, so it is unchanged; limit=1000 now means 1000 channel packets. No other public/ code sends payloadType=. The new test in test-issue-1851-channel-message-scope.js drives the real channels.js through selectChannel with a user key and asserts the /packets request carries type=5 and no payloadType. It fails before the fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zfouts
marked this pull request as ready for review
December 1, 2026 20:02
zfouts
added a commit
to zfouts/CoreScope
that referenced
this pull request
Dec 2, 2026
… and the advert reception changes to Postgres Brings in 10 master commits: Kpa-clawbot#2366 (catalogue key tier), Kpa-clawbot#2497 (regions count only received adverts), Kpa-clawbot#2498 (archived foreign-advert flags), Kpa-clawbot#2492 (observer comparison), Kpa-clawbot#2511, Kpa-clawbot#2513, Kpa-clawbot#2514, Kpa-clawbot#2517, Kpa-clawbot#2518, Kpa-clawbot#2519. Conflicts: - cmd/ingestor/approved_channels.go: both sides added a mutex to channelKeySet. One mu now serialises refresh, master's setCatalog and the branch's Close, and guards the users.db/Postgres accounts readers as well as master's approvedNames and catalogue tier. - cmd/ingestor/db.go, nodes upsert: master's foreign_advert carry-over on top of the branch's qualified columns and lastSeenClampSQL. Master looked up the archived flag with ?1, which dbx.Rebind turns into $11 on Postgres; it is now a plain ? bound to the public key again, and the EXISTS is wrapped in CASE so Postgres stores 0/1 in the BIGINT column. - cmd/ingestor/db.go, MoveStaleNodes: master's UPDATE that restores an archived foreign flag runs before the branch's portable moveStaleNodesSQL (not master's INSERT OR REPLACE ... SELECT *), with IS DISTINCT FROM 1 instead of the SQLite-only IS NOT 1. Ported to Postgres: - catalog_keys (Kpa-clawbot#2366): pgschema migration 0004_catalog_keys.sql (same columns, CHECKs, defaults and key; LatestVersion 4), the table in sqlite_endstate.sql, and the worker's upsert sets updated_at from excluded.updated_at instead of strftime('%s','now'). - corescope-migrate copies catalog_keys and verify never prints catalog_keys.key_hex (channel secrets), for any store. - GetNodes region filter (Kpa-clawbot#2497) and the observer comparison (Kpa-clawbot#2492) used IS NOT 'tx'; both use IS DISTINCT FROM 'tx'. The comparison's ORDER BY label COLLATE NOCASE is lower(<label expression>) on Postgres, which folds ASCII only under COLLATE "C", as NOCASE does. - docs/catalogue-keys.md: the revert SQL on PostgreSQL. Tests on both backends: - The catalogue key tests that use a store and the Kpa-clawbot#2498 foreign-advert tests run on SQLite and Postgres (onBothStores; insertTx uses RETURNING). - New dual tests for the observer comparison and the GetNodes region filter. - pgschema: an upgrade from version 3 with data; the control migration tests no longer assume 3 is the latest version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong
Client-side channel decryption in
public/channels.jsfetchedbut
/api/packetsreads the payload type filter fromtype(cmd/server/routes.go,r.URL.Query().Get("type")).payloadTypewas ignored, so the request returned the 1000 newest packets of every type, andchannels.jsdiscarded everything that was not GRP_TXT/CHAN. On a busy mesh only a fraction of that window were channel packets, so decrypted channel history was much shorter than the limit suggests.Fix
Send
type=5(GRP_TXT). Both the in-memory store and the SQLite path filterpayload_typeon it, and existing Go tests already cover?type=on/api/packets. The candidate loop still checks the decoded type and channel hash, so it is unchanged;limit=1000now means 1000 channel packets. No other code inpublic/sendspayloadType=.Tests
tests/unit/test-issue-1851-channel-message-scope.js: drives the realchannels.jsthroughselectChannelwith a user key and asserts the/packetsrequest carriestype=5,limit=1000and nopayloadType. It fails before the fix and passes after.sh test-all.sh: all suites pass.eslint public/*.js: 0 errors.Browser validation was not done.
Closes #2515
🤖 Generated with Claude Code