Skip to content

feat(content): new carousel posts are drawn by the template, and Instagram gets them at 4:5 - #664

Merged
5hirish merged 3 commits into
mainfrom
feat/carousel-posts-on-stage
Dec 2, 2026
Merged

5hirish merged 3 commits into
mainfrom
feat/carousel-posts-on-stage

Conversation

@5hirish

@5hirish 5hirish commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

What and why

Phase 1 of #657 is done: a new carousel post publishes to TikTok at 9:16 and to Instagram at 4:5, from one set of slides.

flowchart LR
  A[Agent writes slides] --> B[carouselRun maps them]
  B --> C[Template draws 9:16 and 4:5]
  C --> D[render_slide saves both]
  D --> E{Publish via}
  E -->|Zernio| F[TikTok 9:16 + Instagram 4:5, one post]
  E -->|PostBridge| G[Every platform 9:16]
Loading
Who What they see
A new carousel post Drawn by the template: same caption styles and slide kinds as before, no word under 44 px, every word clear of TikTok's buttons. The preview switches between 9:16 and 4:5
A post made before today Unchanged. It keeps the old engine, so nothing already sent looks different
A post with an agent-designed slide Unchanged, on the old engine: the template can't draw that slide yet

The agent's slides and prompts don't change. One module (lib/carouselRun.js) maps stored slides onto the template, for the preview and for render_slide.

Refs #657

Area

  • backend/ — FastAPI / Python
  • app/ — Next.js
  • desktop/ — Tauri shell / sidecar
  • site/ — static marketing site
  • CI / tooling / docs

Launch: changelog only, because it changes what an existing feature sends rather than adding one to find.

Verification

cd backend && .venv/bin/ruff check ...           # clean
.venv/bin/python -m pytest -q -m "not live" tests # 3311 passed
cd app && npx vitest run                          # 58 files, 635 passed
npm run typecheck && npm run check:parity         # OK
npm run check:i18n                                # OK
npm run check:stills                              # chromium, webkit OK
make dump-prompts                                 # no prompt changed

In Chromium and WebKit through /preview (scene post-template): every slide kind in the post view at 9:16 and 4:5, no console errors; the one-pass capture render_slide uses draws all 14 pictures.

  • I ran the checks for the areas I touched (see CONTRIBUTING.md)
  • I added or updated tests covering the behaviour that changed
  • I read the AGENTS.md for each directory I edited
  • I read my own diff back looking for the reason to reject it, and read it
    against the code around it (STYLE.md)
  • UI: ran the screen review checklist
    on the whole screen (not just the part I touched), and attached
    before and after shots at 390, 1100 and 1440

Things that need a second look

  • Touches an endpoint that reads or writes project-scoped data — it has
    get_current_user plus a membership check, and returns 404 (not 403)
    for a non-member
  • Adds a database migration — downgrade written and tested (3d9035ded97d, one column; the legacy-install test walks it back)

Where to look hardest:

  • GET /content/posts/{id}/pictures and /content/slide-run read pictures server-side and return them as data: URLs, because the template may load nothing. A slide's image_url is the agent's to write, so only files the project holds (a ContentAsset row, or the bundled reference library) are ever read. Tested with a cloud-metadata address, a path traversal and another project's file.
  • customMedia on Zernio is how Instagram gets the 4:5 set in the same post. I read it from Zernio's own client types; it is not yet tried against the live API.
  • A 4:5 set that isn't whole, or can't be read back, is left out, and Instagram takes the 9:16. The post still goes.
  • render_slide keeps a 4:5 render only if it is a PNG of exactly 1080×1350: one filed under the wrong size would publish cut.

AI assistance

  • An AI coding agent wrote or substantially shaped this change
  • I have read every line of this diff and can explain why each part is there

🤖 Generated with Claude Code

…agram gets them at 4:5

Phase 1 of #657 done: a new carousel post publishes to TikTok at 9:16
and to Instagram at 4:5 from one set of slides.

Which posts. A post now names the carousel template that draws it
(content_posts.carousel_template). Every post that exists reads "" and
stays on the old slide engine, so a post that went out never redraws
differently from what was sent; the model gives new posts the current
template. A post holding a slide the agent laid out itself (kind
"design") also stays on the engine: the template cannot draw it.
drawn_by_template (backend) and drawnByTemplate (app) decide, and say
the same.

The agent's slides do not change. lib/carouselRun.js maps the stored
slides onto the template's run, once, for the preview and for
render_slide, and every run it makes passes the template's contract.
No prompt changed.

Drawing:
- The post view draws a template post in the stage player
  (TemplateSlides), with 9:16 and 4:5 in the slide header, and falls
  back to the old carousel when this app has no version of the post's
  template.
- render_slide draws a template post's slide at every frame the
  template has, in one framing of it, and sends the 4:5 with the 9:16.
  The tool files each render under its size, and keeps one only if it
  is a PNG of exactly that size.
- The template's page loads nothing, so pictures reach it as data: URLs:
  GET /content/posts/{id}/pictures, one slide at a time, and
  /content/slide-run for render_slide. Only files the project holds are
  read: a slide's image_url is the agent's to write, so any other url (an
  address inside the network, another project's file) is never fetched.

Publishing:
- pick_media picks renders per frame and offers the 4:5 set only when
  every slide has one: some slides at 4:5 and the rest at 9:16 would be
  cut unevenly in the feed.
- A scheduler that takes media per platform (Zernio, `customMedia`) gets
  the 4:5 set for Instagram in the same post; the 4:5 set is uploaded only
  when an Instagram account is among the targets. PostBridge sends every
  platform the 9:16, as before. A 4:5 set that cannot be read back is
  left out and Instagram takes the 9:16; the post still goes.
- A post's card keeps showing its 9:16 render.

Checked: 3311 backend tests and 635 app tests; the post view and the
one-pass capture in Chromium and WebKit, every slide kind at both sizes.

Brand versions (phase 2) and video (phase 3) remain on the issue.

Refs #657

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation backend FastAPI service, models and migrations app Next.js app on Cloudflare Workers agents Agent instructions and skills labels Dec 1, 2026
The picture routes read a slide's image_url, which the agent writes, and
read a /static/references/ url from disk. The resolver already dropped
".." and "." segments, so no url could name a file outside the library,
but a link inside the library that points out of it would have been
followed. It now refuses a path whose resolved location leaves the
library. Raised by an automated review of #664.

Refs #657

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts-on-stage

No conflicts. The backend's artifact bundle is rebuilt, and the stage doc's
date moves to the day it last changed, which the docs check wants.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@5hirish
5hirish changed the base branch from feat/carousel-template-kinds to main December 2, 2026 23:07
@5hirish
5hirish marked this pull request as ready for review December 2, 2026 23:07
@5hirish 5hirish closed this Dec 2, 2026
@5hirish 5hirish reopened this Dec 2, 2026
@5hirish
5hirish merged commit 006a973 into main Dec 2, 2026
29 of 31 checks passed
@5hirish
5hirish deleted the feat/carousel-posts-on-stage branch December 2, 2026 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent instructions and skills app Next.js app on Cloudflare Workers backend FastAPI service, models and migrations documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant