Skip to content

feat: comparison share serving, TOTP 2FA, realtime analytics feed, and config knob fixes - #1327

Merged
nanaf6203-bit merged 3 commits into
MettaChain:mainfrom
beulah7717108-eng:feat/comparison-2fa-realtime-config
Sep 28, 2026
Merged

nanaf6203-bit merged 3 commits into
MettaChain:mainfrom
beulah7717108-eng:feat/comparison-2fa-realtime-config

Conversation

@beulah7717108-eng

Copy link
Copy Markdown

Resolves four backend issues that share the auth, database and analytics wiring.

#1292 — ComparisonShare serving and share URLs

  • Adds public GET /property-comparison/shares/:token resolving the two compared properties without owner PII.
  • Enforces expiresAt and the new revokedAt, tracks viewCount/lastViewedAt, and adds a creator-only revoke endpoint.
  • Sharing URLs now point at the serving route, with e2e coverage for valid, expired and revoked tokens.

#1291 — TOTP two-factor with trusted devices and recovery codes

  • Trusted-device sessions (hashed tokens, TTL via TRUSTED_DEVICE_TTL_DAYS) let a remembered device skip the challenge.
  • Recovery-code regeneration plus trusted-device listing and revocation.
  • Admin force-disable endpoint for locked-out users.
  • High-risk account operations gated behind a fresh second factor.
  • Trusted devices are revoked on password change, 2FA disable and admin reset.
  • Coverage for enrollment, the login challenge (TOTP and recovery codes) and trusted-device bypass.

#1297 — Real-time dashboard metrics feed

  • Cached aggregate snapshot service (queue depth, fraud alerts, property/transaction deltas).
  • Authenticated analytics Socket.IO namespace with a heartbeat, using the existing Redis adapter for multi-replica fan-out.

#1290 — Declared-but-unused config values

  • Wires PGBOUNCER_POOL_TIMEOUT (Prisma pool_timeout) and CACHE_WARMING_INTERVAL (interval scheduler) into real behavior.
  • Reconciles the README / .env.example documentation and adds a config-docs smoke test.

Verification

  • npx jest src/auth src/property-comparison src/analytics test/unit/config-docs.spec.ts test/e2e/comparison-share.e2e.spec.ts --runInBand

Note: src/webhooks/webhooks.service.ts contains a pre-existing syntax error on main (orphaned block from an earlier merge) that breaks tsc/the webhooks suite independently of this change; it is left untouched here to keep this PR scoped.

Closes #1290
Closes #1291
Closes #1292
Closes #1297

…hboard feed, and config cleanup

Resolves four open backend issues together because they share the auth,
database and analytics wiring:

MettaChain#1292 ComparisonShare
- Add public GET /property-comparison/shares/:token that resolves the two
  compared properties without owner PII.
- Enforce expiresAt and the new revokedAt, track viewCount/lastViewedAt,
  and add a creator-only revoke endpoint. Sharing URLs now point at the
  serving route, with e2e coverage for valid/expired/revoked tokens.

MettaChain#1291 TOTP two-factor
- Add trusted-device sessions (hashed tokens, TTL via
  TRUSTED_DEVICE_TTL_DAYS) so remembered devices can skip the challenge.
- Add recovery-code regeneration plus device listing/revocation.
- Add an admin force-disable endpoint for locked-out users.
- Gate high-risk account operations behind a fresh second factor.
- Trusted devices are revoked on password change, 2FA disable and admin reset.

MettaChain#1297 Realtime dashboard feed
- Add a cached aggregate snapshot service (queue depth, fraud alerts,
  property/transaction deltas) and an authenticated `analytics` Socket.IO
  namespace with heartbeat, using the existing Redis adapter.

MettaChain#1290 Config knobs
- Wire PGBOUNCER_POOL_TIMEOUT and CACHE_WARMING_INTERVAL into real behavior,
  reconcile the README/.env.example documentation, and add a config-docs
  smoke test.

Closes MettaChain#1290
Closes MettaChain#1291
Closes MettaChain#1292
Closes MettaChain#1297
Adds integration coverage for the MettaChain#1291 two-factor lifecycle: enrollment
via setup/verify, the login challenge across TOTP and recovery codes,
trusted-device bypass, and one-time device token issuance.
@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@beulah7717108-eng Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nanaf6203-bit nanaf6203-bit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nanaf6203-bit
nanaf6203-bit merged commit 6f59e24 into MettaChain:main Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants