Skip to content

Link a finished timelapse to a devlog (reassure + attach)#754

Open
dhamariT wants to merge 2 commits into
mainfrom
feat/timelapse-devlog-link
Open

Link a finished timelapse to a devlog (reassure + attach)#754
dhamariT wants to merge 2 commits into
mainfrom
feat/timelapse-devlog-link

Conversation

@dhamariT

@dhamariT dhamariT commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

The problem

People think their Lookout recording vanished. After recording, the timelapse is saved on Stardance's side — but it never surfaces again and isn't tied to anything, so it feels lost.

Digging in: the backend already supports linking a session to a devlog (DevlogsController#attach_lookout_sessions reads params[:post_devlog][:lookout_session_ids]), but nothing in the UI ever sends it, and devlogs never display a timelapse. So the wiring exists — it's just not connected.

This PR — "reassure + link first" (flag: timelapse_devlog, off by default)

  1. Recorder done screen: says it plainly — "Saved! We've got your timelapse" — and turns "Post a Devlog" into "Add it to a devlog", carrying the session id + just_recorded=1 back to the project page.
  2. Project page (ProjectsController#show): reads lookout_session_id, sets @pending_lookout_session (must be attachable, owned by the user, not already linked).
  3. Composer: renders a hidden post_devlog[lookout_session_ids][] for that session + a reassurance banner ("Your timelapse (Xm) is saved and will be attached to this devlog"). The modal controller auto-opens the composer on ?just_recorded=1 and strips the params.
  4. Devlog card: a small "Timelapse attached" chip when the devlog has a linked session — so the connection is visible on the post.

Backend link + the destination flow are unchanged; on submit the existing attach_lookout_sessions sets devlog_id.

Turning it on (and rolling back)

The whole feature is gated on the timelapse_devlog Flipper flag, registered in config/initializers/flipper.rb. It's a per-actor flag (Flipper.enabled?(:timelapse_devlog, current_user)), so you can enable it for yourself first, then a percentage, then everyone. Enable it the same way as lookout.

Heads up: the flag gates both sides — the author flow (recorder → "Add it to a devlog") and the viewer's "Timelapse attached" chip. So test with the flag enabled for the user who records and views.

Option A — Flipper UI (/admin/flipper, admin-gated):

  • Go to https://stardance.hackclub.com/admin/flipper, open timelapse_devlog.
  • Just you: under Actors, add your user's flipper_id and register it.
  • Gradual: set Percentage of Actors (e.g. 10 → 50 → 100).
  • Everyone at once: flip the Boolean gate to fully on.
  • Roll back: clear the gate(s) / toggle Boolean off.

Option B — Rails console (Coolify web or worker, bin/rails console):

# just one user (recommend starting here — enable it for yourself)
Flipper.enable_actor(:timelapse_devlog, User.find(<your_user_id>))

# gradual rollout to a % of users
Flipper.enable_percentage_of_actors(:timelapse_devlog, 25)

# everyone
Flipper.enable(:timelapse_devlog)

# roll back / turn fully off
Flipper.disable(:timelapse_devlog)

Prod is byte-for-byte unchanged until you enable it for an actor.

Deliberately deferred (fast follow)

The actual timelapse frame as the devlog's image (auto-attaching a screenshot). Lookout exposes a thumbnailUrl; the plan is a same-origin thumbnail proxy + pre-attach into the composer so the screenshot shows in the draft.

Notes / tradeoffs

  • Reuse-only: no new endpoints, models, or migrations. Uses the existing attachable scope, format_seconds helper, the modal query-param opener pattern, and BEM classes in _feed.scss.
  • The card chip does a per-card lookout_sessions.exists?; gated behind the flag to bound cost during rollout. Preload lookout_sessions on the timeline query before this goes wide (follow-up).

Testing

  • ruby -c / ERB parse / node --check all clean.
  • Manual (with :timelapse_devlog on): record a timelapse → "Add it to a devlog" → project page opens the composer with the reassurance banner + hidden session field → post → devlog shows the "Timelapse attached" chip and the session's devlog_id is set.

Note

Medium Risk
Touches devlog create params and session linking with Flipper gating; card exists? queries may need preload before wide rollout, but behavior is unchanged until the flag is enabled.

Overview
Under the timelapse_devlog Flipper flag (off by default), this connects the existing devlog attach path (post_devlog[lookout_session_ids][]attach_lookout_sessions) to the UI so finished Lookout sessions don’t feel lost.

Author flow: After recording, the done screen becomes “Add it to a devlog” with copy that the timelapse is saved, linking to the project with lookout_session_id and just_recorded=1. ProjectsController#show loads a linkable session (new scope: stopped / compiling / complete, broader than attachable) owned by the user and not yet linked. The devlog composer shows a reassurance banner plus a hidden session id field; modal_controller opens the composer on ?just_recorded=1 and strips only that param (keeps lookout_session_id for refresh-before-submit).

Feed: Devlog cards show a mint “Timelapse attached” indicator when the post has linked lookout sessions (flag-gated; uses lookout_sessions.exists? per card).

Styling adds composer note and card timelapse chip classes in _feed.scss. No new endpoints or migrations.

Reviewed by Cursor Bugbot for commit eb3dd94. Bugbot is set up for automated code reviews on this repo. Configure here.

Users thought their Lookout recording vanished: after recording, the
timelapse was saved on Stardance's side but never surfaced again and was
tied to nothing. The backend already supported linking a session to a
devlog (Projects::DevlogsController#attach_lookout_sessions reads
params[:post_devlog][:lookout_session_ids]) but nothing in the UI ever
sent it, and devlogs never showed a timelapse.

Wire it up (flag: timelapse_devlog, off by default):
- Recorder done screen: reassure ('Saved! We've got your timelapse') and
  turn 'Post a Devlog' into 'Add it to a devlog', carrying the session id
  + just_recorded=1 to the project page.
- Project page: ProjectsController#show reads lookout_session_id and sets
  @pending_lookout_session (attachable, owned by the user, not yet linked).
- Composer: renders a hidden post_devlog[lookout_session_ids][] field for
  that session + a reassurance banner ('Your timelapse (Xm) is saved and
  will be attached to this devlog'). The modal controller auto-opens the
  composer on ?just_recorded=1 and strips the params.
- Devlog card: shows a 'Timelapse attached' chip when the devlog has a
  linked session, so the connection is visible on the post.

The actual timelapse frame as the devlog's image is the fast follow.

Note: the card chip does a per-card lookout_sessions.exists? (gated behind
the flag to bound cost during rollout); preload when this goes wide.
@dhamariT dhamariT marked this pull request as ready for review July 1, 2026 19:41
Comment thread app/controllers/projects_controller.rb
Comment thread app/javascript/controllers/modal_controller.js
- Broaden the pending-session lookup to a new :linkable scope
  (stopped/compiling/complete) so a background sync flipping a
  just-stopped session to compiling mid-flow no longer silently
  drops the attach. Leaves :attachable (finished-video only) intact
  for the hardware-review recordings list.
- Keep lookout_session_id in the URL after auto-opening the composer;
  only strip just_recorded. A pre-submit refresh now still resolves
  @pending_lookout_session instead of losing the link.
- Hide the duration in the reassurance banner when it hasn't synced
  yet, so it no longer reads "Your timelapse (0s)".

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit eb3dd94. Configure here.

<div class="feed-composer__timelapse-note" role="status">
Your timelapse<% if pending_lookout_session.duration_seconds.to_i > 0 %> (<%= helpers.format_seconds(pending_lookout_session.duration_seconds) %>)<% end %> is saved and will be attached to this devlog.
</div>
<% end %>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Project chip drops timelapse link

Medium Severity

After recording, the composer keeps a hidden post_devlog[lookout_session_ids][] for the timelapse and tells the user it will attach, but the project-page composer still shows project chips. Choosing another chip retargets the form to that project’s devlogs endpoint while the hidden id still refers to a session scoped to the original project, so attach_lookout_sessions finds no row and the timelapse is not linked.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit eb3dd94. Configure here.

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.

1 participant