Skip to content

Remade the activity tracker#174

Merged
breadddevv merged 9 commits into
mainfrom
remake/activity-track
Jul 19, 2026
Merged

Remade the activity tracker#174
breadddevv merged 9 commits into
mainfrom
remake/activity-track

Conversation

@breadddevv

@breadddevv breadddevv commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added activity tracking options for Private Servers and Studio Sessions.
    • Added bulk session startup and improved session lifecycle handling.
    • Added remote activity configuration support, including rank and tracking settings.
    • Activity downloads now include workspace, rank, private-server, and Studio settings.
  • Bug Fixes

    • Improved reliability when handling rate limits, retries, and inactive or disconnected sessions.
    • Enhanced AFK detection and timer updates.
  • UI Improvements

    • Updated activity settings controls with clearer toggle behavior and status feedback.
    • Added a disabled “Workspace Bans” option marked “Coming soon.”

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@breadddevv, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 38 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 019f12b7-e91a-4689-ad47-24f622d5fecf

📥 Commits

Reviewing files that changed from the base of the PR and between a4d6030 and 992a4b7.

📒 Files selected for processing (8)
  • Orbit-activity.rbxmx
  • components/settings/general/activity.tsx
  • components/switch.tsx
  • pages/api/activity/bulk-start.ts
  • pages/api/activity/config.ts
  • pages/api/workspace/[id]/settings/activity/download.ts
  • pages/api/workspace/[id]/settings/activity/setprivateserver.ts
  • pages/api/workspace/[id]/settings/activity/setstudio.ts
📝 Walkthrough

Walkthrough

OrbitActivity was rewritten around unified player state, reliable queued HTTP delivery, session synchronization, AFK tracking, and remote configuration. New APIs and settings controls add bulk session startup plus private-server and studio tracking configuration.

Changes

Activity platform

Layer / File(s) Summary
Runtime tracking and delivery
Orbit-activity.rbxmx
OrbitActivity now coordinates unified player state, queued HTTP requests, dead-letter retries, session synchronization, AFK timers, rank refreshes, and remote configuration.
Bulk session startup
pages/api/activity/bulk-start.ts
The new endpoint validates and concurrently processes session-start requests, including authorization, eligibility, user persistence, permissions, and activity-session creation.
Activity configuration APIs
pages/api/activity/config.ts, pages/api/workspace/[id]/settings/activity/*
Configuration endpoints expose and persist private-server and studio flags, generate missing loader keys, and add corresponding XML placeholders.
Settings controls and switch behavior
components/settings/general/activity.tsx, components/switch.tsx
Activity settings add reusable toggle rows for private servers and studio sessions, while the switch uses a native accessible button implementation.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: gml-pz

Sequence Diagram(s)

sequenceDiagram
  participant OrbitActivity
  participant HttpQueue
  participant ActivityAPI
  participant ActivityDatastore
  OrbitActivity->>HttpQueue: queue session and player updates
  HttpQueue->>ActivityAPI: send retryable HTTP request
  ActivityAPI->>ActivityDatastore: create, end, or synchronize session
  ActivityDatastore-->>ActivityAPI: return session result
  ActivityAPI-->>HttpQueue: return delivery response
  HttpQueue-->>OrbitActivity: report request status
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: a broad remake of the activity tracker and its related settings/APIs.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remake/activity-track

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread pages/api/activity/bulk-start.ts Fixed
Comment thread pages/api/activity/bulk-start.ts Fixed
breadddevv and others added 2 commits July 19, 2026 23:01
…ntrolled format string'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…ntrolled format string'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 15

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/settings/general/activity.tsx`:
- Around line 245-277: Preserve each setting’s previous value before the
optimistic update and restore that value in the catch blocks of
updatePrivateServer and updateStudio instead of hardcoding false. Also change
updateStudio’s error toast to a studio-specific failure message, while leaving
the successful response handling unchanged.

In `@components/switch.tsx`:
- Around line 27-33: Add a visible focus-visible indicator to the switch
element’s class list while preserving the existing focus:outline-none behavior
and disabled/checked styling. Update the clsx classes in the switch component to
apply an accessible ring or equivalent focus styling only when the control
receives keyboard-visible focus.

In `@Orbit-activity.rbxmx`:
- Around line 527-531: Update InitiatePlayer so MovementDetection runs
asynchronously on its own thread, allowing InitiatePlayer to return and
CreateSession to execute without waiting for Character or CharacterAdded.
Preserve the existing movement setup behavior while ensuring players without a
spawned character do not block session creation.
- Line 595: Update the URL construction in the httpGet call to use Luau’s
{Configuration.groupId} interpolation syntax instead of
${Configuration.groupId}, ensuring the actual group ID is sent in the request.
- Around line 596-608: Update the remote-config override loop to read values
from response.data instead of response, and align the overridable key list with
the API payload names: minTrackedRank, privateServerEnabled, and studioEnabled.
Ensure each matching Configuration field is updated and tracked in changed while
preserving the existing validation and local-default behavior.
- Around line 181-190: Update fetchRank’s GetRolesInGroupAsync call to pass the
player’s valid user ID property instead of Player.User, so the protected lookup
executes successfully and minTrackedRank filtering uses the retrieved rank.

In `@pages/api/activity/bulk-start.ts`:
- Line 103: Update both console.error calls in the bulk-start handler to keep
the first argument as a static message and pass userid or sessionData.userid as
a separate argument before error. Remove their interpolation from the format
string so user-controlled percent sequences cannot trigger format substitution.
- Around line 61-146: Limit concurrent session processing in the bulk-start
flow, especially the checkSpecificUser calls created by the creations map and
Promise.all, using a bounded concurrency limiter or batches instead of unbounded
fan-out. Reuse the userRank obtained by getRankInGroup when invoking
checkSpecificUser by extending its API as needed, avoiding duplicate Roblox rank
lookups while preserving existing permission behavior.
- Around line 70-135: The active-session check in the bulk-start flow is
vulnerable to TOCTOU races. Enforce one active session per user and workspace
group at the database level with a unique partial constraint/index, then replace
the check-then-create behavior around the existing lookup and
prisma.activitySession.create call with an atomic upsert or handle the
unique-constraint error as an already-started result.

In `@pages/api/activity/config.ts`:
- Around line 22-39: Return immediately after the successful response in the
activity config handler, updating the flow around getConfig and the existing
res.status(200).send call so execution cannot reach the unconditional response
at the end. Preserve the current error response and payloads.
- Around line 14-38: Add the same authorization-key validation used by the
bulk-start.ts and bulk-end.ts handlers to the GET handler before calling
getConfig or returning activity configuration. Validate the request’s
authorization value against the established key, and return the existing
unauthorized response for invalid or missing credentials while preserving the
current successful GET behavior.

In `@pages/api/workspace/`[id]/settings/activity/download.ts:
- Line 28: Remove the console.log(activityconfig) statement from the activity
download handler. Do not log the full activity configuration or its key;
preserve the surrounding configuration generation and download flow unchanged.
- Around line 28-35: Update the activityconfig initialization flow to assign the
newly generated key back to the local activityconfig after setConfig, preserving
any existing fields. Ensure activityconfig is non-null before later unguarded
activityconfig.key usage so the first download without an existing configuration
succeeds.

In `@pages/api/workspace/`[id]/settings/activity/setprivateserver.ts:
- Around line 28-33: Validate and coerce req.body.enabled to a real boolean
before constructing newconfig in the activity settings handler. Ensure values
such as the string "false" are stored as false rather than truthy, while
preserving the existing getConfig and setConfig flow.

In `@pages/api/workspace/`[id]/settings/activity/setstudio.ts:
- Around line 28-33: Update the setstudio handler’s newconfig construction to
coerce req.body.enabled with Boolean before assigning studioEnabled, matching
the validation used by setprivateserver.ts; leave the surrounding getConfig and
setConfig flow unchanged.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d31892a-32d4-4eb7-bfbf-e0a6d5950403

📥 Commits

Reviewing files that changed from the base of the PR and between 3c8f4b5 and a4d6030.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (10)
  • Orbit-activity.rbxmx
  • components/settings/general/activity.tsx
  • components/switch.tsx
  • pages/api/activity/bulk-start.ts
  • pages/api/activity/config.ts
  • pages/api/workspace/[id]/settings/activity/download.ts
  • pages/api/workspace/[id]/settings/activity/getConfig.ts
  • pages/api/workspace/[id]/settings/activity/setIdleTime.ts
  • pages/api/workspace/[id]/settings/activity/setprivateserver.ts
  • pages/api/workspace/[id]/settings/activity/setstudio.ts
💤 Files with no reviewable changes (1)
  • pages/api/workspace/[id]/settings/activity/setIdleTime.ts

Comment thread components/settings/general/activity.tsx
Comment thread components/switch.tsx
Comment thread Orbit-activity.rbxmx
Comment thread Orbit-activity.rbxmx
Comment thread Orbit-activity.rbxmx Outdated
Comment thread pages/api/activity/config.ts Outdated
Comment thread pages/api/workspace/[id]/settings/activity/download.ts Outdated
Comment thread pages/api/workspace/[id]/settings/activity/download.ts Outdated
Comment thread pages/api/workspace/[id]/settings/activity/setprivateserver.ts
Comment thread pages/api/workspace/[id]/settings/activity/setstudio.ts
breadddevv and others added 4 commits July 19, 2026 23:05
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@PlanetaryOrbit PlanetaryOrbit deleted a comment from coderabbitai Bot Jul 19, 2026
@breadddevv
breadddevv merged commit 5aa7b00 into main Jul 19, 2026
3 of 4 checks passed
@breadddevv
breadddevv deleted the remake/activity-track branch July 19, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants