Skip to content

docs(plans): add editor asset library plan (NES-1614)#9155

Open
edmonday wants to merge 5 commits into
mainfrom
05-05-ES-docs-editor-asset-library-plan
Open

docs(plans): add editor asset library plan (NES-1614)#9155
edmonday wants to merge 5 commits into
mainfrom
05-05-ES-docs-editor-asset-library-plan

Conversation

@edmonday
Copy link
Copy Markdown
Contributor

@edmonday edmonday commented May 5, 2026

Summary

Lands the Editor Asset Library plan (docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md) on main as the durable source of truth.

The plan currently only exists on the prototype branch (04-28-ES-feat-editor-asset-library-personal / PR #9102), which is a throwaway. Production work for the Media Library Picker project will be tracked via Linear milestones cut from this plan, so the plan needs to live on main independently of the prototype.

The plan covers:

  • 2026-04-28 approach pivot — per-tab history backed by CloudflareImage and MuxVideo, replacing the rejected Block-table-as-source-of-truth and standalone Library tab designs.
  • 2026-05-01 v1 ship state and v1.1 team-shared visibility plan — including the persisted-teamId design where each asset's home team is derived from journey.teamId at upload time, so assets stay with the team after the uploader leaves.
  • mediaLibrary LaunchDarkly flag gating for production rollout — the three grid mount points are gated; backend additive changes (isAi column, orderBy correctness) ship unflagged.
  • Quick-start (Template Customization) flow scoped out per Lyuba's feedback.
  • Pre-pivot Relay / imageBlocksConnection material retained as a decision trail and clearly marked as superseded.

Test plan

  • Plan file renders correctly in GitHub markdown.
  • Cross-reference the v1 ship state section against PR feat: prototype editor asset library (NES-1614) #9102's actual diff.
  • Cross-reference the v1.1 design against the Linear project description (Media Library Picker).
  • Confirm Lyuba's feedback wording on quick-start is captured accurately.

Summary by CodeRabbit

  • Documentation
    • Added a detailed Editor Asset Library plan: v1 per-tab history grids (Your uploads/Custom, Your generations/AI), video uploads grid, rollout phases, testing/acceptance, and feature-flag gating. Unsplash history and original connection-based tab deferred/dropped.
  • New Features
    • Feature-flagged per-tab media grids with deterministic "Load More" pagination, journeyId required for uploads, and planned v1.1 team-shared visibility (nullable team association + membership checks).

Land the Editor Asset Library plan on main as the durable source
of truth, independent of the throwaway prototype PR (#9102) where
it currently lives.

Covers:
- 2026-04-28 approach pivot (per-tab history backed by
  CloudflareImage / MuxVideo, dropping the Block-table and
  standalone Library tab approaches).
- 2026-05-01 v1 ship state and v1.1 team-shared visibility plan,
  including the persisted teamId design (asset's home team is
  derived from journey.teamId at upload time).
- mediaLibrary LaunchDarkly flag gating for production rollout.
- Quick-start (Template Customization) flow scoped out per
  Lyuba's feedback.
- Historical pre-pivot Relay / imageBlocksConnection material
  retained as a decision trail and clearly marked as superseded.
@linear
Copy link
Copy Markdown

linear Bot commented May 5, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a comprehensive Editor Asset Library plan documenting a pivot (2026-04-28) from Block-centered history to per-tab history backed by CloudflareImage and MuxVideo rows. Defines v1 (personal per-tab grids, nullable CloudflareImage.isAi, deterministic offset pagination, mediaLibrary flag), and v1.1 (nullable teamId, journeyId threading, merged personal+team queries), rollout, tests, and risks.

Changes

Editor Asset Library Plan

Layer / File(s) Summary
Plan Metadata & Pivot
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 1–66)
Adds front-matter and documents the 2026-04-28 pivot from Block.src-based library to per-tab history surfaces (Custom/AI; Unsplash deferred).
v1 Spec: Data & API Shape
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 68–115)
Defines v1: per-tab “Your uploads”/“Your generations” grids, getMyCloudflareImages(offset, limit, isAi), nullable CloudflareImage.isAi (no backfill), deterministic offset/limit ordering, and Mux video getMyMuxVideos usage.
v1 Gating & Rollout
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 68–156)
Specifies mediaLibrary LaunchDarkly gating for v1 UI grids, phased backend/frontend delivery, and v1 test expectations for feature-off behavior.
v1.1 Schema & Resolver Changes
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 116–186)
Proposes nullable teamId on CloudflareImage/MuxVideo, composite indexes for merged queries, and requiring journeyId in upload mutations so server persists teamId from journey.teamId.
v1.1 Resolver Semantics & Authorization
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 116–257)
Extends resolver signatures to accept optional teamId, requires membership prechecks, and merges results with userId OR teamId while preserving personal-only behavior when teamId omitted.
Frontend Wiring & Cache
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 187–203, 511–575)
Documents threading journeyId through uploads, passing useTeam().activeTeam?.id ?? null to grids, Apollo cache keyArg updates (offsetLimitPagination(['isAi','teamId']) / ['teamId']), and refetch/eviction behavior on active-team changes and uploads.
Behavioral Notes, Tests & Phasing
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 204–336, 237–256, 600–653)
Enumerates behavioral expectations, authorization/performance edge cases, migration and resolver tests, phased backend/frontend rollout steps, and acceptance criteria.
Indexing, Pagination & Performance Guidance
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 412–477, 466–477)
Recommends SQL composite indexes, deterministic ordering for offset pagination, and notes on cursor vs offset trade-offs and resolver guard behavior.
Appendix / Historical Plans
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (lines 272–671, 819–881)
Retains and marks the original (rejected) connection-based library design and detailed historical rationale, risks, metrics, and future v2 considerations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a documentation plan for the editor asset library feature, with the issue reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 05-05-ES-docs-editor-asset-library-plan

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Warnings
⚠️ ❗ Big PR (881 changes)

(change count - 881): Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR will helps faster, easier review.

Generated by 🚫 dangerJS against 1387dd4

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 5, 2026

View your CI Pipeline Execution ↗ for commit 1387dd4

Command Status Duration Result
nx affected --target=subgraph-check --base=c292... ✅ Succeeded <1s View ↗
nx affected --target=extract-translations --bas... ✅ Succeeded <1s View ↗
nx affected --target=lint --base=c2926d43940f7b... ✅ Succeeded <1s View ↗
nx affected --target=type-check --base=c2926d43... ✅ Succeeded <1s View ↗
nx run-many --target=codegen --all --parallel=3 ✅ Succeeded <1s View ↗
nx run-many --target=prisma-generate --all --pa... ✅ Succeeded 4s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-06 23:29:09 UTC

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md`:
- Line 556: Add a language tag to the fenced code block in the markdown so
markdownlint MD040 is satisfied; update the opening fence from ``` to something
like ```text (e.g., ```text) for the block that lists the
Editor/Slider/ImageBlockEditor paths so the code fence has an explicit language
specifier.
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 73059e16-306e-4e22-ab97-7d7dade3957d

📥 Commits

Reviewing files that changed from the base of the PR and between c2926d4 and 533cfb9.

📒 Files selected for processing (1)
  • docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md

Comment thread docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (1)

571-571: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language tag to the fenced code block.

At Line 571, the fence opens without a language identifier, which triggers markdownlint MD040. Please change it to something like ```text.

🤖 Prompt for 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.

In `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md` at line 571, The
markdown fenced code block currently opens with an unlabeled backtick fence
("```"), which triggers markdownlint MD040; update that opening fence to include
a language tag (for example change "```" to "```text") so the block is
explicitly labeled and the lint rule is satisfied.
🤖 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.

Duplicate comments:
In `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md`:
- Line 571: The markdown fenced code block currently opens with an unlabeled
backtick fence ("```"), which triggers markdownlint MD040; update that opening
fence to include a language tag (for example change "```" to "```text") so the
block is explicitly labeled and the lint rule is satisfied.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 4ea0ba52-4f92-4348-95e2-df72505997c2

📥 Commits

Reviewing files that changed from the base of the PR and between 533cfb9 and 4254eaf.

📒 Files selected for processing (1)
  • docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md

@edmonday edmonday self-assigned this May 5, 2026
Replace the two-grid v1.1 design ("Your uploads" + "Team uploads")
with a single merged grid titled "Uploads" that surfaces both the
caller's own uploads and the active team's uploads in one
chronological feed.

Why: clearer mental model — users see everything they can re-pick
from the active team without scanning two stacked grids.

Changes:
- Resolver: when teamId arg is provided, predicate becomes
  `userId = caller OR teamId = arg` (a row matching both sides
  appears once).
- Schema: add (userId, createdAt, id) index alongside the
  (teamId, createdAt, id) index so Postgres can bitmap-OR
  efficiently across the merged predicate.
- Frontend: a single grid mount per tab/screen instead of two;
  takes activeTeam?.id ?? null. No active team → personal-only
  fallback.
- Title: "Uploads".
- Behavioral table, performance, auth, tests, phasing all
  updated to match.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (1)

577-577: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language tag to the fenced code block.

The code fence should specify a language (e.g., text) to satisfy markdownlint MD040 and ensure consistent rendering.

📝 Proposed fix
-```
+```text
 apps/journeys-admin/src/components/Editor/Slider/Settings/Drawer/ImageBlockEditor/
🤖 Prompt for 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.

In `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md` at line 577, The
fenced code block lacking a language tag should be updated to include one (e.g.,
"text") so it satisfies markdownlint MD040 and renders consistently; locate the
fence containing the path
"apps/journeys-admin/src/components/Editor/Slider/Settings/Drawer/ImageBlockEditor/"
and change the opening "```" to "```text" to apply the language tag.
🤖 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.

Duplicate comments:
In `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md`:
- Line 577: The fenced code block lacking a language tag should be updated to
include one (e.g., "text") so it satisfies markdownlint MD040 and renders
consistently; locate the fence containing the path
"apps/journeys-admin/src/components/Editor/Slider/Settings/Drawer/ImageBlockEditor/"
and change the opening "```" to "```text" to apply the language tag.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3bf25ec5-6990-43f0-819e-c12aed307007

📥 Commits

Reviewing files that changed from the base of the PR and between 4254eaf and e3c5cb4.

📒 Files selected for processing (1)
  • docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md (1)

577-577: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add language tag to fenced code block.

This issue was previously flagged but remains unresolved. The fence at line 577 needs a language identifier to satisfy markdownlint MD040.

📝 Proposed fix
-```
+```text
 apps/journeys-admin/src/components/Editor/Slider/Settings/Drawer/ImageBlockEditor/
🤖 Prompt for 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.

In `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md` at line 577, The
fenced code block containing the path
"apps/journeys-admin/src/components/Editor/Slider/Settings/Drawer/ImageBlockEditor/"
needs a language tag to satisfy markdownlint MD040; update the fence at that
location to include a language identifier (e.g., change ``` to ```text) so the
block becomes a labeled fenced code block and rerun linting.
🤖 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.

Duplicate comments:
In `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md`:
- Line 577: The fenced code block containing the path
"apps/journeys-admin/src/components/Editor/Slider/Settings/Drawer/ImageBlockEditor/"
needs a language tag to satisfy markdownlint MD040; update the fence at that
location to include a language identifier (e.g., change ``` to ```text) so the
block becomes a labeled fenced code block and rerun linting.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 9fe7beee-3cca-46f9-b84b-5c6f53513248

📥 Commits

Reviewing files that changed from the base of the PR and between e3c5cb4 and d66d58e.

📒 Files selected for processing (1)
  • docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md

NES-1627 ships orderBy: { createdAt: 'desc' } (no id tiebreaker) and
indexes without the id column. Update the plan's v1 references and the
v1.1 composite-index design to match.

Microsecond-precision createdAt + single-row inserts make the id
tiebreaker unnecessary in practice. Smaller index footprint, simpler
resolver. If a future bulk-insert path lands, the tiebreaker can be
added back at that point.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md`:
- Around line 143-144: The index definitions still include the id tiebreaker;
remove the id(sort: Desc) entry from the @@index declarations (e.g. change
@@index([userId, createdAt(sort: Desc), id(sort: Desc)]) and @@index([teamId,
createdAt(sort: Desc), id(sort: Desc)]) to @@index([userId, createdAt(sort:
Desc)]) and @@index([teamId, createdAt(sort: Desc)]) respectively), and repeat
the same removal for the other occurrences noted (lines referenced as 150–151 in
the comment).
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 69ebf3b7-e85e-4675-86f5-0acc27334f2d

📥 Commits

Reviewing files that changed from the base of the PR and between d66d58e and 1387dd4.

📒 Files selected for processing (1)
  • docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md

Comment on lines +143 to +144
@@index([userId, createdAt(sort: Desc), id(sort: Desc)])
@@index([teamId, createdAt(sort: Desc), id(sort: Desc)])
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Remove id column from index definitions to match the design decision.

The PR objectives state that NES-1627 removed the id tiebreaker from the orderBy/index design, with the rationale that "microsecond-precision createdAt plus single-row inserts make the id tiebreaker unnecessary." However, the index definitions here still include id(sort: Desc).

📝 Proposed fix to align with the shipped design
 model CloudflareImage {
   // ... existing fields
   teamId String?
-  @@index([userId, createdAt(sort: Desc), id(sort: Desc)])
-  @@index([teamId, createdAt(sort: Desc), id(sort: Desc)])
+  @@index([userId, createdAt(sort: Desc)])
+  @@index([teamId, createdAt(sort: Desc)])
 }

 model MuxVideo {
   // ... existing fields
   teamId String?
-  @@index([userId, createdAt(sort: Desc), id(sort: Desc)])
-  @@index([teamId, createdAt(sort: Desc), id(sort: Desc)])
+  @@index([userId, createdAt(sort: Desc)])
+  @@index([teamId, createdAt(sort: Desc)])
 }

Also applies to: 150-151

🤖 Prompt for 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.

In `@docs/plans/2026-04-28-001-feat-editor-asset-library-plan.md` around lines 143
- 144, The index definitions still include the id tiebreaker; remove the
id(sort: Desc) entry from the @@index declarations (e.g. change @@index([userId,
createdAt(sort: Desc), id(sort: Desc)]) and @@index([teamId, createdAt(sort:
Desc), id(sort: Desc)]) to @@index([userId, createdAt(sort: Desc)]) and
@@index([teamId, createdAt(sort: Desc)]) respectively), and repeat the same
removal for the other occurrences noted (lines referenced as 150–151 in the
comment).

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