Repository navigation
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Vasanthdev2004
left a comment
There was a problem hiding this comment.
These fixes still address gaps on main. Please sync the branch first: the reported-post route and AdminQueue now use authenticated admin sessions. Keep requireAdmin, useAdminAccount, the private/no-store response policy and the endpoint without ?wallet= while adding the error handling.
Please also add focused tests for the database failure and non-JSON/network-error paths, then rerun CI on the updated head. The current helper tests don't exercise those failures, and the older green checks don't cover the new auth integration.
d8cd2ed to
2c54f91
Compare
|
Thanks for the feedback @Vasanthdev2004 Rebased onto current
New head |
…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.
2c54f91 to
ef1d4d7
Compare
|
@Vasanthdev2004 Synced the branch onto current main and resolved the presence-route conflict, keeping the hardened clientIp(req) bucket and adding the try/catch around the bot-pulse read. requireAdmin, useAdminAccount, the private/no-store policy and the endpoint without ?wallet= are all intact. Added focused route tests for presence DB outage (GET and both POST branches), reported-queue DB outage behind the admin session gate, and a pure readReportedQueue helper test for 502 JSON, non-JSON bodies and network failures. Full tests, lint, typecheck, build, pr-guard and CodeRabbit all pass on the new head. Ready for your re-review. |
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.tshad zero error handling.readPulse/recordBeacon(presence.ts) throw on a configured-DB outage (maybeDb()null is safe, outage throws;memo.tsrethrows). 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, beacon every 30s) went silently stale on HTML 500s.app/src/app/api/posts/reported/route.tsthrew instead of JSON-erroring, andAdminQueue.tsxcalledawait 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.fmtSharepainted NaN%/Infinity% —holders.ts:NaN <= 0andNaN < 1are both false, so NaN fell through to"NaN%"; Infinity →"Infinity%". Rendered in the trust-critical panel (HoldersPanel,TokenProof,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.requireAdmin), then try/catch → JSON 502 +private, no-store.AdminQueue.load(): 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: 1371 pass / 0 fail / 11 skipped.npm run typecheck: clean.eslinton all touched files: clean.npm run build: pass.upstream/main@1e006c3; the conflict in the reported route / AdminQueue was resolved keeping the newrequireAdmin+useAdminAccountauth. Head2c54f91, CI green.Summary by CodeRabbit