Repository navigation
Conversation
…tting Presence GET/POST were the last JSON read routes without try/catch: a DB outage turned the site-wide pulse/beacon into HTML 500s instead of the JSON 502 contract every sibling keeps. Both verbs now return JSON 502 + no-store with a server log, keeping the per-IP beacon bucket untouched. GET /api/posts/reported had the same hole, with a two-stage break: AdminQueue called res.json() before checking res.ok with no try/catch (via void load()), so an HTML 500 became an unhandled rejection instead of the graceful error row. Route now returns JSON 502; the queue parses defensively and surfaces friendlyError. fmtShare was the last trust formatter missing the finite guard its siblings have: NaN painted as 'NaN%' and Infinity as 'Infinity%' in the holder/trust panel where users judge rug risk. Now '—'. Tests: fmtShare non-finite, presence bot/hash helpers (new file). Verified: npm test 1047 pass / 0 fail, typecheck + eslint clean.
|
Warning Review limit reachedOnly developers with an assigned seat can use this organization's usage-based review budget, and seats here are assigned manually. Ask an admin to assign a seat, or change the review continuation mode in Billing. Next included review available in 45 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (6)
Comment |
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 / why
Three real, verified gaps — the leftovers after PR #83 hardened the meta/holder/count paths. Each is the outlier against its siblings:
app/src/app/api/presence/route.ts:10-12,24had zero error handling.readPulse/recordBeacon(presence.ts:33,43-53) throw on a configured-DB outage (maybeDb()null is safe, outage throws;memo.ts:37-40rethrows). Every sibling read route (feed/list/live/search/candles/holders/me/posts) wraps in try/catch → JSON 502 + no-store. The site-wide pulse (LivePulse.tsx:24beacons every 30s) went silently stale on HTML 500s.app/src/app/api/posts/reported/route.ts:10threw instead of JSON-erroring, andAdminQueue.tsx:29-30calledawait res.json()before checkingres.okwith no try/catch (invoked asvoid load()). So a DB blip became an unhandled promise rejection instead of the graceful error row a JSON error takes. Siblingposts/route.ts:17-32already wraps both reads.fmtSharepainted NaN%/Infinity% —holders.ts:39-44:NaN <= 0andNaN < 1are both false, so NaN fell through to"NaN%"; Infinity →"Infinity%". Rendered in the trust-critical panel (HoldersPanel.tsx:35-37,66,75,TokenProof.tsx:71,trustNotes) where users judge rug risk. Every sibling guards (math.tsfmtCompact/fmtEth,market-format.tsmarketUsd,chart-terminal.ts, and fix(api): harden launch read paths — meta error shape, bounded holder swaps, finite count formatting #83's marketCount).Fix
no-store+ server log. Rate-limit bucket and prune logic untouched.no-store. AdminQueueload(): defensive JSON parse (non-JSON →moderation queue returned <status>),friendlyErrorsurfacing,setPosts(null)on failure — no more unhandled rejections.fmtShare:!Number.isFinite → "—", matching siblings.Uniqueness check (no open/merged/closed duplicate)
reportedroute), fix(ui): reject ambiguous decimal separators instead of rewriting them #56 decimal-input, fix(search): order cross-chain results by block time and escape LIKE wildcards #35 search, fix(memo): bound the cache with per-entry TTL expiry and oldest-first eviction #36 memo-cap, feat(security): per-IP rate limits on sync/meta/presence POST endpoints #37 write-limits (write buckets; presence beacon bucket already existed and is untouched), fix(app): improve launch input, fees and notifications #40 input-notifications.Verification (all true, nothing faked)
node -econfirms oldfmtShare(NaN) → "NaN%",Infinity → "Infinity%"; new →"—"(test added).holders.test.tsnon-finite fmtShare cases, newpresence.test.ts(bot allow-list, 64-hex visitor-hash uniqueness/stability).npm test: 1047 pass / 0 fail / 10 skipped (baseline 1045 — +2 new, no regressions).npm run typecheck: clean.eslinton all 7 touched files: clean.fix/presence-reported-trust-robustnesscut fromupstream/main@c567605, single commit, no old commits.