Skip to content

fix(desktop): restore artifacts grid views and multi-repo tasks clobbered by canvas port - #78183

Merged
trunk-io[bot] merged 2 commits into
masterfrom
posthog-code/restore-canvas-port-regressions
Aug 5, 2026
Merged

fix(desktop): restore artifacts grid views and multi-repo tasks clobbered by canvas port#78183
trunk-io[bot] merged 2 commits into
masterfrom
posthog-code/restore-canvas-port-regressions

Conversation

@k11kirky

@k11kirky k11kirky commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Problem

PR #76649 ported the canvas build pipeline from a stale snapshot and silently downgraded unrelated desktop code when it merged. #77252 restored part of the damage (space repository linking). Two audit passes over both canvas PRs (#73874, #76649) against the master commits they overwrote found the rest:

  • The channel artifacts page lost its page header, list/grid/masonry view toggle, card layouts, and delete-undo handling.
  • Task.repositories (from feat(tasks): link repositories to spaces in the desktop UI #76448) lost its type field and all three consumers, so multi-repo cloud tasks degrade to single-repo: run instructions and git checkpoints cover only one repo, and local handoff clones only the first repository. The covering tests were deleted.
  • The canvas toolbar lost its Delete… flow, its space-aware pin label, and its menu width fix; the CONTEXT.md editor stopped filling the viewport.
  • The new CanvasBuildStatus component shipped with banned @radix-ui/themes imports.
  • feat(canvas): build and securely deliver cloud artifacts #73874's conflict resolution re-added a stale !common/alerting line to .dockerignore (the directory no longer exists).

Changes

  • Restores WebsiteChannelArtifacts.tsx to its pre-feat(canvas): build and securely deliver cloud artifacts #76649 shape, adapted to the new schema: DashboardRecord, PR keys by taskId, and quill components instead of the reintroduced Radix import.
  • Canvas cards show a placeholder preview frame, matching WebsiteDashboardsIndex, because records no longer carry source code.
  • Restores repositories?: string[] on Task and the fallbacks in normalizeTaskResponse, AgentServer, and LocalHandoffService.start.
  • Restores the three deleted multi-repo handoff tests, including the unsafe-repository-entry cases.
  • Restores the canvas toolbar's Delete… confirm-then-undo flow in WebsiteLayout.tsx, with its space/channel pin label and w-auto min-w-fit menu width fix.
  • Moves the CONTEXT.md edit textarea back out of the scroll area in WebsiteContext.tsx so it fills the viewport again.
  • Converts CanvasBuildStatus.tsx from Radix Flex/Text/Tooltip to quill equivalents.
  • Removes the orphaned !common/alerting line from .dockerignore.

Note

Still degraded after this PR, left for a product decision: live canvas previews in grid cards (needs per-card artifact URL wiring; WebsiteDashboardsIndex has the same deliberate placeholder) and the removed "Save as fork" toolbar action in WebsiteLayout.tsx.

How did you test this code?

  • Red-green: restored the three multi-repo handoff tests first and watched 7 cases fail, then applied the fixes; all 16 pass.
  • Added a parameterized normalizeTaskResponse case asserting the repositories fallback, since deleting that line previously broke nothing.
  • Ran @posthog/core (3064 tests), @posthog/api-client (163), and @posthog/ui canvas tests (360); all pass, including after the second-pass toolbar and context editor fixes.
  • Typecheck passes for shared, api-client, core, agent, and ui; Biome clean; hogli ci:preflight --fix reports 0 failures.
  • I could not render the desktop app in this sandbox, so the restored surfaces have no screenshots. The layout code matches what shipped before feat(canvas): build and securely deliver cloud artifacts #76649.

Automatic notifications

  • Publish to changelog?

Docs update

None.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

  • Claude (PostHog Code cloud task) authored this PR; skills invoked: /writing-tests, /writing-user-facing-copy, /writing-code-comments, /writing-pr-descriptions.
  • I diffed both canvas merges against every master commit that touched the same files since the desktop import, then verified each candidate against current HEAD with parallel read-only agents; most apparent reverts were intentional supersession by the new build pipeline.
  • A second adversarial pass re-examined the files the first pass cleared and found the toolbar and context editor regressions; zombie-file and sibling-port-PR checks came back clean.
  • I kept feat(canvas): build and securely deliver cloud artifacts #76649's intentional changes (DashboardRecord rename, PR keys by taskId, server-provisioned personal channels) and restored only the clobbered behavior.

Created with PostHog Code

…ng clobbered by the canvas port

The canvas artifacts port (#76649) was built from a stale snapshot and overwrote newer master work when it merged. This restores the artifacts page's list/grid/masonry view toggle, page header, and delete-undo handling; the Task.repositories field and its three consumers (task normalization, cloud-run instructions/checkpointing, local handoff) from #76448 that #77252 did not cover; the deleted multi-repo handoff tests; converts the new CanvasBuildStatus component off banned Radix imports; and drops the stale common/alerting entry #73874's conflict resolution re-added to .dockerignore.

Generated-By: PostHog Code
Task-Id: 167fa10a-0a98-447b-bc44-34d4433de1f0
@k11kirky k11kirky self-assigned this Aug 5, 2026
@trunk-io

trunk-io Bot commented Aug 5, 2026

Copy link
Copy Markdown

😎 Merged successfully - details.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Hey @k11kirky! 👋

It looks like your git author email on this PR isn't your @posthog.com address (k11kirky@gmail.com). Since you're on the PostHog team, it's worth pointing your local git author email at your @posthog.com address. Why it matters:

  • Consistent work identity in git history — internal tooling that attributes commits to team members keys off your @posthog.com address.
  • Keeps team contributions easy to tell apart from external community ones when scanning history.

You can fix it for this repo with:

git config user.email "you@posthog.com"

Or set it globally with git config --global user.email "you@posthog.com". No need to redo this PR — just a nudge for next time. 🙂

@github-actions github-actions Bot added the feature/desktop Feature Tag: Desktop label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 3db06f2.

@trunk-io

trunk-io Bot commented Aug 5, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@k11kirky
k11kirky marked this pull request as ready for review August 5, 2026 12:10
@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(desktop): restore artifacts grid vie..." | Re-trigger Greptile

Comment on lines +135 to +139
const repositories = task.repositories?.length
? task.repositories
: task.repository
? [task.repository]
: [];

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.

Logic error: checking task.repositories?.length will treat an explicit empty array [] as falsy and incorrectly fall back to task.repository. If a task is normalized with no repositories (repositories: []), but has a legacy repository field, this will incorrectly use the single repository instead of respecting the empty array.

Fix:

const repositories = task.repositories !== undefined
  ? task.repositories
  : task.repository
    ? [task.repository]
    : [];

This ensures an explicit empty array is respected rather than falling through to the legacy field.

Suggested change
const repositories = task.repositories?.length
? task.repositories
: task.repository
? [task.repository]
: [];
const repositories = task.repositories !== undefined
? task.repositories
: task.repository
? [task.repository]
: [];

Spotted by Graphite

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping this as is: it restores the exact semantics of #76448, which #76649 clobbered. An empty repositories list means the multi-repo field wasn't populated, so falling back to the legacy single repository field keeps handoff working for such tasks. normalizeTaskResponse also wraps repository into repositories now, so the empty-plus-legacy combination only arises for Task objects built outside the normalizer, where the fallback is the safe choice.

…text editor fill

Second adversarial audit pass over the #76649 diff found four more still-broken downgrades: the canvas toolbar's Delete… flow (destructive confirm + undo toast + navigate back to artifacts) was removed, the pin menu label was hardcoded to "channel" under the Spaces layout, the menu lost the w-auto min-w-fit width fix that prevented "Unpin from space" clipping, and the CONTEXT.md edit textarea stopped filling the viewport (fixed rows inside a scroll area).

Generated-By: PostHog Code
Task-Id: 167fa10a-0a98-447b-bc44-34d4433de1f0
@k11kirky

k11kirky commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io
trunk-io Bot merged commit 9407e92 into master Aug 5, 2026
215 checks passed
@trunk-io
trunk-io Bot deleted the posthog-code/restore-canvas-port-regressions branch August 5, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature/desktop Feature Tag: Desktop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants