:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(canvas): register system.canvases and retire the home-canvas concept (#77176)
Peter Kirkham311c00eec92f
diff --git a/posthog/hogql/database/schema/system.py b/posthog/hogql/database/schema/system.pyindex ec45c6341e53..f38e3e9965a0 100644--- a/posthog/hogql/database/schema/system.py+++ b/posthog/hogql/database/schema/system.py@@ -2276,6 +2276,61 @@ business_knowledge_chunks: PostgresTable = PostgresTable()+canvases: PostgresTable = PostgresTable(+ name="canvases",+ postgres_table_name="posthog_canvas",+ access_scope="canvas",+ # Mirror the REST API's default filter: soft-deleted canvases are not exposed.+ predicates=[parse_expr("deleted != true")],+ description="Canvases (agent-built sandboxed browser apps, filed into channels); one row per canvas (soft-deleted canvases are excluded).",+ fields={+ "id": StringDatabaseField(name="id", description="Canvas UUID."),+ "team_id": IntegerDatabaseField(name="team_id"),+ "channel_id": StringDatabaseField(+ name="channel_id", description="Channel the canvas is filed into (tasks Channel UUID)."+ ),+ "name": StringDatabaseField(name="name", description="Canvas name."),+ "template_id": StringDatabaseField(+ name="template_id", description="Template the canvas was created from, e.g. 'freeform'."+ ),+ "context": StringDatabaseField(+ name="context", description="Author-written context (markdown) passed to generation tasks."+ ),+ "generation_task_id": StringDatabaseField(+ name="generation_task_id",+ nullable=True,+ description="Task currently generating this canvas; joins to tasks.id.",+ ),+ "pinned_at": DateTimeDatabaseField(+ name="pinned_at",+ nullable=True,+ description="When the canvas was pinned to its channel; NULL if not pinned.",+ ),+ "current_source_version_id": StringDatabaseField(+ name="current_source_version_id",+ nullable=True,+ description="The canvas's head source version; NULL until the first publish.",+ ),+ "published_build_id": StringDatabaseField(+ name="published_build_id",+ nullable=True,+ description="Build whose artifact the canvas app currently renders; NULL until the first successful build.",+ ),+ "created_by_id": IntegerDatabaseField(+ name="created_by_id", nullable=True, description="User who created the canvas."+ ),+ "_deleted": BooleanDatabaseField(name="deleted", hidden=True),+ "deleted": ExpressionField(+ name="deleted",+ expr=ast.Call(name="toInt", args=[ast.Field(chain=["_deleted"])]),+ description="1 if the canvas has been deleted, 0 otherwise (always 0 here due to the table filter).",+ ),+ "created_at": DateTimeDatabaseField(name="created_at", description="When the canvas was created."),+ "updated_at": DateTimeDatabaseField(name="updated_at", description="When the canvas was last updated."),+ },+)++tags: PostgresTable = PostgresTable(name="tags",postgres_table_name="posthog_tag",@@ -2317,6 +2372,7 @@ class SystemTables(TableNode):name="business_knowledge_documents", table=business_knowledge_documents),"business_knowledge_sources": TableNode(name="business_knowledge_sources", table=business_knowledge_sources),+ "canvases": TableNode(name="canvases", table=canvases),"cohort_calculation_history": TableNode(name="cohort_calculation_history", table=cohort_calculation_history),"cohorts": TableNode(name="cohorts", table=cohorts),"custom_property_definitions": TableNode(name="custom_property_definitions", table=custom_property_definitions),diff --git a/posthog/hogql/database/schema/test/test_system_tables.py b/posthog/hogql/database/schema/test/test_system_tables.pyindex 10afbeaa5ee9..970369f71543 100644--- a/posthog/hogql/database/schema/test/test_system_tables.py+++ b/posthog/hogql/database/schema/test/test_system_tables.py@@ -599,6 +599,15 @@ def _create_task(team: Team, label: str):)+def _create_canvas(team: Team, label: str):+ Channel = apps.get_model("tasks", "Channel")+ Canvas = apps.get_model("canvas", "Canvas")++ with team_scope(team.pk):+ channel = Channel.objects.create(team=team, name=f"channel_for_canvas_{label}")+ return Canvas.objects.create(team=team, channel=channel, name=f"canvas_{label}")++def _create_task_run(team: Team, label: str):Task = apps.get_model("tasks", "Task")TaskRun = apps.get_model("tasks", "TaskRun")@@ -699,6 +708,7 @@ SYSTEM_TABLE_FACTORIES = [("business_knowledge_chunks", _create_business_knowledge_chunk),("business_knowledge_documents", _create_business_knowledge_document),("business_knowledge_sources", _create_business_knowledge_source),+ ("canvases", _create_canvas),("cohorts", _create_cohort),("cohort_calculation_history", _create_cohort_calculation_history),("custom_property_definitions", _create_custom_property_definition),@@ -840,6 +850,39 @@ class TestSystemTablesSandboxEnvironmentPrivacyIsolation(NonAtomicBaseTest):assert str(internal_env.pk) not in ids+class TestSystemTablesCanvasDeletedExclusion(BaseTest):+ """Verify the canvases system table excludes soft-deleted canvases,+ mirroring the REST API's default filter."""++ def test_generated_sql_includes_deleted_predicate(self):+ db = Database.create_for(team=self.team, user=self.user)+ context = HogQLContext(team_id=self.team.pk, enable_select_queries=True, database=db)+ query, _ = prepare_and_print_ast(parse_select("SELECT id FROM system.canvases"), context, dialect="clickhouse")+ assert "system__canvases.deleted" in query+ assert f"equals(system__canvases.team_id, {self.team.pk})" in query+++class TestSystemTablesCanvasDeletedExclusionIsolation(NonAtomicBaseTest):+ """End-to-end check that soft-deleted canvases are never returned via HogQL."""++ CLASS_DATA_LEVEL_SETUP = False++ def test_deleted_canvases_excluded(self):+ Channel = apps.get_model("tasks", "Channel")+ Canvas = apps.get_model("canvas", "Canvas")++ with team_scope(self.team.pk):+ channel = Channel.objects.create(team=self.team, name="canvas-exclusion-channel")+ live_canvas = Canvas.objects.create(team=self.team, channel=channel, name="live")+ deleted_canvas = Canvas.objects.create(team=self.team, channel=channel, name="deleted", deleted=True)++ response = execute_hogql_query("SELECT id FROM system.canvases", team=self.team, user=self.user)+ ids = {str(row[0]) for row in response.results}++ assert str(live_canvas.pk) in ids+ assert str(deleted_canvas.pk) not in ids++class TestSystemTablesTaskInternalExclusion(BaseTest):"""Verify the tasks system table excludes internal tasks (signals pipeline, etc.)mirroring the REST API's default filter."""diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambrindex 8c91b1292045..9f9c445296ad 100644--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr@@ -3932,6 +3932,145 @@"row_count": null,"type": "system"},+ "system.canvases": {+ "certification": null,+ "fields": {+ "id": {+ "chain": null,+ "fields": null,+ "hogql_value": "id",+ "id": null,+ "name": "id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "channel_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "channel_id",+ "id": null,+ "name": "channel_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "name": {+ "chain": null,+ "fields": null,+ "hogql_value": "name",+ "id": null,+ "name": "name",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "template_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "template_id",+ "id": null,+ "name": "template_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "context": {+ "chain": null,+ "fields": null,+ "hogql_value": "context",+ "id": null,+ "name": "context",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "generation_task_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "generation_task_id",+ "id": null,+ "name": "generation_task_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "pinned_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "pinned_at",+ "id": null,+ "name": "pinned_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ },+ "current_source_version_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "current_source_version_id",+ "id": null,+ "name": "current_source_version_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "published_build_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "published_build_id",+ "id": null,+ "name": "published_build_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "created_by_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_by_id",+ "id": null,+ "name": "created_by_id",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "deleted": {+ "chain": null,+ "fields": null,+ "hogql_value": "deleted",+ "id": null,+ "name": "deleted",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "created_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_at",+ "id": null,+ "name": "created_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ },+ "updated_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "updated_at",+ "id": null,+ "name": "updated_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ }+ },+ "id": "system.canvases",+ "name": "system.canvases",+ "row_count": null,+ "type": "system"+ },"system.cohort_calculation_history": {"certification": null,"fields": {@@ -12991,6 +13130,145 @@"row_count": null,"type": "system"},+ "system.canvases": {+ "certification": null,+ "fields": {+ "id": {+ "chain": null,+ "fields": null,+ "hogql_value": "id",+ "id": null,+ "name": "id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "channel_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "channel_id",+ "id": null,+ "name": "channel_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "name": {+ "chain": null,+ "fields": null,+ "hogql_value": "name",+ "id": null,+ "name": "name",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "template_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "template_id",+ "id": null,+ "name": "template_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "context": {+ "chain": null,+ "fields": null,+ "hogql_value": "context",+ "id": null,+ "name": "context",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "generation_task_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "generation_task_id",+ "id": null,+ "name": "generation_task_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "pinned_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "pinned_at",+ "id": null,+ "name": "pinned_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ },+ "current_source_version_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "current_source_version_id",+ "id": null,+ "name": "current_source_version_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "published_build_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "published_build_id",+ "id": null,+ "name": "published_build_id",+ "schema_valid": true,+ "table": null,+ "type": "string"+ },+ "created_by_id": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_by_id",+ "id": null,+ "name": "created_by_id",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "deleted": {+ "chain": null,+ "fields": null,+ "hogql_value": "deleted",+ "id": null,+ "name": "deleted",+ "schema_valid": true,+ "table": null,+ "type": "integer"+ },+ "created_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "created_at",+ "id": null,+ "name": "created_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ },+ "updated_at": {+ "chain": null,+ "fields": null,+ "hogql_value": "updated_at",+ "id": null,+ "name": "updated_at",+ "schema_valid": true,+ "table": null,+ "type": "datetime"+ }+ },+ "id": "system.canvases",+ "name": "system.canvases",+ "row_count": null,+ "type": "system"+ },"system.cohort_calculation_history": {"certification": null,"fields": {diff --git a/products/canvas/backend/build_service.py b/products/canvas/backend/build_service.pyindex 5378266a7751..fc2c4f117677 100644--- a/products/canvas/backend/build_service.py+++ b/products/canvas/backend/build_service.py@@ -44,6 +44,7 @@ from products.canvas.backend.source import (SYNTHETIC_INDEX_HTML,diagnostic,has_errors,+ synthetic_source_project,validate_relative_path,validate_source_project,)@@ -312,8 +313,6 @@ def current_source_project(canvas: Canvas) -> tuple[dict[str, Any], str | None]:if canvas.current_source_version_id:version = CanvasSourceVersion.objects.for_team(canvas.team_id).get(pk=canvas.current_source_version_id)return read_source_project(version), str(version.id)- from products.canvas.backend.source import synthetic_source_project # noqa: PLC0415-return synthetic_source_project(canvas.legacy_code), None@@ -424,11 +423,33 @@ def publish_source_project(key, digest, size = upload_source_project(canvas.team_id, canvas.id, project)+ # A migrated canvas's pre-relational source must survive its first publish:+ # it becomes a real parent version here so history (undo/revert) can reach+ # it — otherwise nulling legacy_code below would discard the only copy.+ # Same upload-then-commit posture as the main project.+ legacy_upload: tuple[str, str, int] | None = None+ if current_id is None and (canvas.legacy_code or "").strip():+ legacy_upload = upload_source_project(canvas.team_id, canvas.id, synthetic_source_project(canvas.legacy_code))+with transaction.atomic(), team_scope(canvas.team_id):canvas = _claim_canvas_head(canvas, has_expected_version=has_expected_version, expected_version_id=expected_version_id)first_publish = canvas.current_source_version_id is None and not (canvas.legacy_code or "").strip()+ if (+ legacy_upload is not None+ and canvas.current_source_version_id is None+ and (canvas.legacy_code or "").strip()+ ):+ legacy_key, legacy_digest, legacy_size = legacy_upload+ canvas.current_source_version = CanvasSourceVersion.objects.create(+ team_id=canvas.team_id,+ canvas=canvas,+ source_hash=legacy_digest,+ source_object_key=legacy_key,+ source_size=legacy_size,+ prompt="Imported source",+ )version = CanvasSourceVersion.objects.create(team_id=canvas.team_id,canvas=canvas,diff --git a/products/canvas/backend/migrations/0007_soft_delete_home_canvases.py b/products/canvas/backend/migrations/0007_soft_delete_home_canvases.pynew file mode 100644index 000000000000..8ef59c68ab84--- /dev/null+++ b/products/canvas/backend/migrations/0007_soft_delete_home_canvases.py@@ -0,0 +1,24 @@+"""Soft-delete the auto-created channel home boards.++The channel home is a native client view now, so the seeded home-board+canvases are retired. Soft-delete (recoverable) because they were+system-generated directory listings, not user content; user-created canvases+are untouched. The `is_home` machinery itself is removed in 0008.+"""++from django.db import migrations+++def soft_delete_home_canvases(apps, schema_editor):+ Canvas = apps.get_model("canvas", "Canvas")+ Canvas.objects.filter(is_home=True, deleted=False).update(deleted=True)+++class Migration(migrations.Migration):+ dependencies = [+ ("canvas", "0006_require_build_enqueued_at"),+ ]++ operations = [+ migrations.RunPython(soft_delete_home_canvases, migrations.RunPython.noop, elidable=False),+ ]diff --git a/products/canvas/backend/migrations/0008_remove_home_canvas.py b/products/canvas/backend/migrations/0008_remove_home_canvas.pynew file mode 100644index 000000000000..38760936bf2f--- /dev/null+++ b/products/canvas/backend/migrations/0008_remove_home_canvas.py@@ -0,0 +1,33 @@+"""Retire the home-canvas concept (schema side; 0007 soft-deleted the rows).++The partial unique constraint is dropped for real; the column itself is+removed from Django state only (per safe-migration policy) and given a+database-side default first, so inserts that no longer mention it keep+working. A later migration may drop the column physically.+"""++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("canvas", "0007_soft_delete_home_canvases"),+ ]++ operations = [+ migrations.RemoveConstraint(+ model_name="canvas",+ name="unique_home_canvas_per_channel",+ ),+ migrations.AlterField(+ model_name="canvas",+ name="is_home",+ field=models.BooleanField(default=False, db_default=False),+ ),+ migrations.SeparateDatabaseAndState(+ database_operations=[],+ state_operations=[+ migrations.RemoveField(model_name="canvas", name="is_home"),+ ],+ ),+ ]diff --git a/products/canvas/backend/migrations/max_migration.txt b/products/canvas/backend/migrations/max_migration.txtindex d0da8dfa0911..4b4ca0731778 100644--- a/products/canvas/backend/migrations/max_migration.txt+++ b/products/canvas/backend/migrations/max_migration.txt@@ -1 +1 @@-0006_require_build_enqueued_at+0008_remove_home_canvasdiff --git a/products/canvas/backend/models.py b/products/canvas/backend/models.pyindex a079fa728d2f..92491e4b12c9 100644--- a/products/canvas/backend/models.py+++ b/products/canvas/backend/models.py@@ -32,8 +32,6 @@ class Canvas(TeamScopedRootMixin, UUIDModel):generation_task_id = models.UUIDField(null=True, blank=True)# Set when the canvas is pinned to its channel (shared across users).pinned_at = models.DateTimeField(null=True, blank=True)- # A channel's home canvas is the board shown when the channel opens.- is_home = models.BooleanField(default=False)current_source_version = models.ForeignKey("canvas.CanvasSourceVersion", on_delete=models.SET_NULL, null=True, blank=True, related_name="+"@@ -56,13 +54,6 @@ class Canvas(TeamScopedRootMixin, UUIDModel):class Meta:db_table = "posthog_canvas"indexes = [models.Index(fields=["channel", "-created_at"], name="canvas_channel_recency")]- constraints = [- models.UniqueConstraint(- fields=["channel"],- condition=Q(is_home=True, deleted=False),- name="unique_home_canvas_per_channel",- )- ]class CanvasSourceVersion(TeamScopedRootMixin, UUIDModel):diff --git a/products/canvas/backend/presentation/serializers.py b/products/canvas/backend/presentation/serializers.pyindex cb198cec4e9a..babd99b9c52f 100644--- a/products/canvas/backend/presentation/serializers.py+++ b/products/canvas/backend/presentation/serializers.py@@ -41,7 +41,6 @@ class CanvasSerializer(serializers.ModelSerializer):"generation_task_id","pinned","pinned_at",- "is_home","current_version_id","published_build_id","created_by",@@ -67,11 +66,6 @@ class CanvasCreateSerializer(serializers.Serializer):template_id = serializers.CharField(required=False, default="freeform", max_length=64, help_text="Canvas template identifier.")- is_home = serializers.BooleanField(- required=False,- default=False,- help_text="Create the canvas as the channel's home board (at most one per channel).",- )class CanvasUpdateSerializer(serializers.Serializer):diff --git a/products/canvas/backend/presentation/views.py b/products/canvas/backend/presentation/views.pyindex 11773f6cd002..7f6a9e564ed5 100644--- a/products/canvas/backend/presentation/views.py+++ b/products/canvas/backend/presentation/views.py@@ -3,7 +3,6 @@ from uuid import UUIDfrom django.conf import settingsfrom django.core.exceptions import ValidationError as DjangoValidationError-from django.db import IntegrityError, transactionfrom django.db.models import QuerySetfrom django.utils import timezone@@ -19,7 +18,6 @@ from posthog.auth import OAuthAccessTokenAuthenticationfrom posthog.models.user import Userfrom posthog.storage.object_storage import ObjectStorageErrorfrom posthog.temporal.oauth import SANDBOX_OAUTH_APP_CLIENT_IDS-from posthog.utils import str_to_boolfrom products.canvas.backend import build_servicefrom products.canvas.backend.models import Canvas, CanvasBuild, CanvasSourceVersion@@ -111,7 +109,6 @@ class CanvasViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):OpenApiParameter("channel", OpenApiTypes.UUID, required=False, description="Only return canvases in this channel."),- OpenApiParameter("is_home", bool, required=False, description="Filter by channel-home status."),])def list(self, request: Request, *args: Any, **kwargs: Any) -> Response:@@ -134,9 +131,6 @@ class CanvasViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):except ValueError:return queryset.none()queryset = queryset.filter(channel_id=channel_id)- is_home = self.request.query_params.get("is_home")- if is_home is not None:- queryset = queryset.filter(is_home=str_to_bool(is_home))return queryset.order_by("-created_at")@extend_schema(@@ -154,28 +148,18 @@ class CanvasViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):# someone else's personal channel must be refused here too.if not tasks_facade.channel_exists(self.team_id, channel_id, user.id if user else None):return Response({"detail": "Channel not found in this team."}, status=status.HTTP_400_BAD_REQUEST)- try:- # Savepoint so losing the is_home uniqueness race doesn't poison- # the request's transaction.- with transaction.atomic():- canvas = Canvas.objects.create(- team_id=self.team_id,- channel_id=channel_id,- name=payload.validated_data["name"],- template_id=payload.validated_data["template_id"],- is_home=payload.validated_data["is_home"],- created_by=user,- # A sandbox-created canvas is its task's deliverable: bind- # the two at birth so the client can show the run on the- # canvas and nest the task under it — composer-initiated- # generations have no client-side create to record it.- generation_task_id=self._sandbox_task_id(request),- )- except IntegrityError:- return Response(- {"detail": "This channel already has a home canvas.", "code": "home_canvas_exists"},- status=status.HTTP_409_CONFLICT,- )+ canvas = Canvas.objects.create(+ team_id=self.team_id,+ channel_id=channel_id,+ name=payload.validated_data["name"],+ template_id=payload.validated_data["template_id"],+ created_by=user,+ # A sandbox-created canvas is its task's deliverable: bind+ # the two at birth so the client can show the run on the+ # canvas and nest the task under it — composer-initiated+ # generations have no client-side create to record it.+ generation_task_id=self._sandbox_task_id(request),+ )return Response(CanvasSerializer(canvas).data, status=status.HTTP_201_CREATED)@extend_schema(diff --git a/products/canvas/backend/tests/test_build_service.py b/products/canvas/backend/tests/test_build_service.pyindex 9136127d0927..edc8ca08f74f 100644--- a/products/canvas/backend/tests/test_build_service.py+++ b/products/canvas/backend/tests/test_build_service.py@@ -10,7 +10,7 @@ from django.utils import timezonefrom posthog.models.scoping import team_scopefrom products.canvas.backend import build_service-from products.canvas.backend.models import Canvas, CanvasBuild+from products.canvas.backend.models import Canvas, CanvasBuild, CanvasSourceVersionfrom products.canvas.backend.source import synthetic_source_projectfrom products.canvas.backend.tests.test_canvas_api import InMemoryStoragefrom products.tasks.backend.models import Channel@@ -301,3 +301,36 @@ class TestCleanup(BuildServiceBaseTest):assert str(aged[2].id) in kept # newest other ready build (instant rollback)assert str(published.id) not in kept # aged past retention, unprotectedassert pruned == 1+++class TestLegacySourcePreservation(BuildServiceBaseTest):+ def test_first_publish_materializes_legacy_code_as_parent_version(self):+ legacy = "export default function Legacy() { return null }"+ Canvas.objects.unscoped().filter(id=self.canvas.id).update(legacy_code=legacy)+ self.canvas.refresh_from_db()++ canvas, version, _build, first_publish = build_service.publish_source_project(+ self.canvas,+ project=synthetic_source_project("export default function Rewrite() { return null }"),+ prompt="rewrite",+ name=None,+ has_expected_version=True,+ expected_version_id=None,+ task_id=None,+ created_by_id=None,+ )++ head = CanvasSourceVersion.objects.unscoped().get(pk=version.id)+ assert head.parent_version_id is not None+ legacy_version = CanvasSourceVersion.objects.unscoped().get(pk=head.parent_version_id)+ assert build_service.read_source_project(legacy_version) == synthetic_source_project(legacy)+ assert canvas.current_source_version_id == head.id+ assert canvas.legacy_code is None+ assert not first_publish++ def test_publish_on_fresh_canvas_creates_single_root_version(self):+ self._publish()++ versions = CanvasSourceVersion.objects.unscoped().filter(canvas_id=self.canvas.id)+ assert versions.count() == 1+ assert versions.get().parent_version_id is Nonediff --git a/products/canvas/backend/tests/test_canvas_api.py b/products/canvas/backend/tests/test_canvas_api.pyindex eb56dc082e50..1d595661b700 100644--- a/products/canvas/backend/tests/test_canvas_api.py+++ b/products/canvas/backend/tests/test_canvas_api.py@@ -150,19 +150,6 @@ class TestCanvasCrud(CanvasAPIBaseTest):)assert response.status_code == status.HTTP_400_BAD_REQUEST- def test_home_canvas_is_unique_per_channel(self):- self._create_canvas(name="Home", is_home=True)- response = self.client.post(- f"/api/projects/{self.team.id}/canvases/",- {"name": "Home 2", "channel_id": str(self.channel.id), "is_home": True},- format="json",- )- assert response.status_code == status.HTTP_409_CONFLICT- assert response.json()["code"] == "home_canvas_exists"-- response = self.client.get(f"/api/projects/{self.team.id}/canvases/?is_home=true")- assert [row["name"] for row in response.json()["results"]] == ["Home"]-def test_partial_update_metadata(self):canvas_id = self._create_canvas()response = self.client.patch(diff --git a/products/canvas/frontend/generated/api.schemas.ts b/products/canvas/frontend/generated/api.schemas.tsindex 0f27a14afe0a..bf56caca63b6 100644--- a/products/canvas/frontend/generated/api.schemas.ts+++ b/products/canvas/frontend/generated/api.schemas.ts@@ -79,7 +79,6 @@ export interface CanvasApi {readonly pinned: boolean/** @nullable */readonly pinned_at: string | null- readonly is_home: boolean/*** Id of the live source version — pass as expected_current_version_id on publish. Null before the first publish.* @nullable@@ -120,8 +119,6 @@ export interface CanvasCreateApi {* @maxLength 64*/template_id?: string- /** Create the canvas as the channel's home board (at most one per channel). */- is_home?: boolean}/**@@ -625,10 +622,6 @@ export type CanvasesListParams = {* Only return canvases in this channel.*/channel?: string- /**- * Filter by channel-home status.- */- is_home?: boolean/*** Number of results to return per page.*/diff --git a/products/canvas/frontend/generated/api.zod.ts b/products/canvas/frontend/generated/api.zod.tsindex 220c83277d97..84718bed20d5 100644--- a/products/canvas/frontend/generated/api.zod.ts+++ b/products/canvas/frontend/generated/api.zod.ts@@ -17,8 +17,6 @@ export const canvasesCreateBodyNameMax = 400export const canvasesCreateBodyTemplateIdDefault = `freeform`export const canvasesCreateBodyTemplateIdMax = 64-export const canvasesCreateBodyIsHomeDefault = false-export const CanvasesCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(canvasesCreateBodyNameMax).describe('Display name for the canvas.'),@@ -28,10 +26,6 @@ export const CanvasesCreateBody = /* @__PURE__ */ zod.max(canvasesCreateBodyTemplateIdMax).default(canvasesCreateBodyTemplateIdDefault).describe('Canvas template identifier.'),- is_home: zod- .boolean()- .default(canvasesCreateBodyIsHomeDefault)- .describe("Create the canvas as the channel's home board (at most one per channel)."),}).describe('Payload for creating a new, empty canvas in a channel.')diff --git a/products/canvas/skills/building-react-quill-canvases/SKILL.md b/products/canvas/skills/building-react-quill-canvases/SKILL.mdindex 361ee58b0708..1a266cd23677 100644--- a/products/canvas/skills/building-react-quill-canvases/SKILL.md+++ b/products/canvas/skills/building-react-quill-canvases/SKILL.md@@ -61,12 +61,19 @@ text-card-foreground`; borders `border-border`. Never a hardcoded hex or light-o- Write Unicode glyphs (curly quotes, ellipsis, arrows, emoji) as literal characters in JSX —`\uXXXX` escapes render verbatim in JSX text.-## Loading states+## Loading, error, and empty statesEvery data point renders a skeleton in its own `Card` while loading or refreshing: `SkeletonText`(matching `lines` and text-size `className`) for text/number values, `Skeleton` for blocks/charts.Drive `isLoading` off the data calls and set it true again on refresh; never show a blank or a-jumping layout, and handle the empty/error case.+jumping layout.++A failed query and an empty result are different states — never let one render as the other.+`.catch` on every `ph.query`/`ph.loadInsight` must set an error state that renders visibly (the+message plus a Retry button wired to the refresh nonce, as in the starter scaffold), not fall+through to zeros, an empty chart, or a "no data yet" message. A query that silently swallows its+error makes real breakage (a missing table, an auth failure, a bad query) look like missing data.+Reserve the empty state for a query that succeeded with no rows.## Date windowdiff --git a/products/canvas/skills/building-react-quill-canvases/references/starter-scaffold.md b/products/canvas/skills/building-react-quill-canvases/references/starter-scaffold.mdindex 35be5b5bb9af..b0e15c9abf89 100644--- a/products/canvas/skills/building-react-quill-canvases/references/starter-scaffold.md+++ b/products/canvas/skills/building-react-quill-canvases/references/starter-scaffold.md@@ -36,6 +36,7 @@ export default function Canvas() {const [open, setOpen] = useState(false)const [loading, setLoading] = useState(true)+ const [error, setError] = useState(null)const [total, setTotal] = useState(0)const [series, setSeries] = useState([])// Refresh plumbing: bump this nonce to re-run the data effect on demand.@@ -44,6 +45,7 @@ export default function Canvas() {useEffect(() => {let cancelled = falsesetLoading(true)+ setError(null)// Typed query node, computed by PostHog's own runner so the numbers match// the UI exactly. `event: null` = all events (works on any project).ph.query({@@ -62,9 +64,12 @@ export default function Canvas() {setSeries((s.days ?? []).map((day, i) => ({ day, value: s.data?.[i] ?? 0 })))setLoading(false)})- .catch((error) => {- if (!cancelled) setLoading(false)- throw error+ .catch((err) => {+ if (cancelled) return+ setLoading(false)+ // A failed query must LOOK failed — falling through to zeros or an+ // empty chart reads as "no data" and hides real breakage.+ setError(String(err?.message ?? err))})return () => {cancelled = true@@ -101,6 +106,17 @@ export default function Canvas() {</div></div>+ {error && (+ <Card size="sm">+ <CardContent className="flex items-center justify-between gap-4">+ <p className="text-sm text-destructive">Couldn't load data: {error}</p>+ <Button variant="outline" size="sm" onClick={() => setNonce((n) => n + 1)}>+ Retry+ </Button>+ </CardContent>+ </Card>+ )}+<div className="grid gap-4 md:grid-cols-3"><Card size="sm"><CardHeader>@@ -109,6 +125,8 @@ export default function Canvas() {<CardContent>{loading ? (<SkeletonText lines={1} className="text-3xl" />+ ) : error ? (+ <p className="text-sm text-muted-foreground">—</p>) : (<Heading size="2xl">{total.toLocaleString()}</Heading>)}@@ -123,6 +141,8 @@ export default function Canvas() {<CardContent>{loading ? (<SkeletonText lines={6} />+ ) : error ? (+ <p className="text-sm text-muted-foreground">—</p>) : (<div className="h-[280px] w-full"><ResponsiveContainer>diff --git a/products/canvas/skills/querying-canvas-data/SKILL.md b/products/canvas/skills/querying-canvas-data/SKILL.mdindex 3c6f68f8a3f7..386c69baf30c 100644--- a/products/canvas/skills/querying-canvas-data/SKILL.md+++ b/products/canvas/skills/querying-canvas-data/SKILL.md@@ -48,8 +48,12 @@ calls at runtime, and validation fails on undeclared literals.- **SQL results**: `{ columns: string[], results: rows[][] }` — each row an array of cell values in`columns` order.-Load data in `useEffect` with `useState`, show a loading state, and handle empty/error. Aggregate-in the query; never fetch raw event dumps.+Load data in `useEffect` with `useState`, show a loading state, and aggregate in the query; never+fetch raw event dumps. Treat a rejected query and an empty result as different states: `.catch`+must set an error state that renders visibly (message + retry), never fall through to zeros, an+empty chart, or a "no data" message — a swallowed error makes real breakage (a missing table, an+auth failure) look like missing data. Reserve the empty state for a query that succeeded with no+rows.## Date windowsdiff --git a/products/desktop/packages/core/src/canvas/channelItems.test.ts b/products/desktop/packages/core/src/canvas/channelItems.test.tsindex cabe9efc8acd..bbb4a9a6a2f7 100644--- a/products/desktop/packages/core/src/canvas/channelItems.test.ts+++ b/products/desktop/packages/core/src/canvas/channelItems.test.ts@@ -32,7 +32,6 @@ function canvas(over: Partial<DashboardRecord> = {}): DashboardRecord {name: "Canvas",templateId: "freeform",context: "",- isHome: false,createdAt: 0,updatedAt: 1_000,...over,diff --git a/products/desktop/packages/core/src/canvas/dashboardSchemas.ts b/products/desktop/packages/core/src/canvas/dashboardSchemas.tsindex 48fb57947680..2d5fb978f1cb 100644--- a/products/desktop/packages/core/src/canvas/dashboardSchemas.ts+++ b/products/desktop/packages/core/src/canvas/dashboardSchemas.ts@@ -23,8 +23,6 @@ export const dashboardRecordSchema = z.object({updatedAt: z.number(),// Epoch ms the canvas was pinned to its channel; absent = not pinned.pinnedAt: z.number().optional(),- // Whether this is the channel's home board (at most one per channel).- isHome: z.boolean().default(false),// Head source version — pass as expected_current_version_id when publishing.currentVersionId: z.string().nullish(),// The live (last successful, still-eligible) build.@@ -95,10 +93,6 @@ export const saveContextInput = z.object({context: z.string(),});-export const ensureHomeCanvasInput = z.object({- channelId: z.string().min(1),-});-// Rename a canvas (its display title).export const renameDashboardInput = z.object({id: z.string().min(1),diff --git a/products/desktop/packages/core/src/canvas/dashboardsService.test.ts b/products/desktop/packages/core/src/canvas/dashboardsService.test.tsindex f2060ea381a8..9d13b489af6b 100644--- a/products/desktop/packages/core/src/canvas/dashboardsService.test.ts+++ b/products/desktop/packages/core/src/canvas/dashboardsService.test.ts@@ -1,7 +1,6 @@-import { transform } from "esbuild";import { describe, expect, it, vi } from "vitest";import { DashboardsService } from "./dashboardsService";-import { type ProjectApiClient, ProjectApiError } from "./projectApiClient";+import type { ProjectApiClient } from "./projectApiClient";// A canvas as the PostHog canvases API returns it.function apiCanvas(overrides: Record<string, unknown> = {}) {@@ -13,7 +12,6 @@ function apiCanvas(overrides: Record<string, unknown> = {}) {context: "",generation_task_id: null,pinned_at: null,- is_home: false,current_version_id: "v1",published_build_id: null,created_by: { first_name: "Ada", last_name: "L", email: "[email protected]" },@@ -71,213 +69,11 @@ describe("DashboardsService.list", () => {name: "Revenue board",createdBy: "Ada L",currentVersionId: "v1",- isHome: false,});expect(rows[0].createdAt).toBe(Date.parse("2026-07-01T00:00:00Z"));});});-describe("DashboardsService.ensureHomeCanvas", () => {- it("returns an existing seeded home canvas without creating another", async () => {- const home = apiCanvas({- id: "home-1",- is_home: true,- current_version_id: "v9",- });- const { api, calls } = fakeApi({- "canvases/?channel=chan-1&is_home=true": [home],- });- const service = new DashboardsService(api);-- const record = await service.ensureHomeCanvas("chan-1");-- expect(record.id).toBe("home-1");- expect(- calls.every((call) => !call.init || call.init.method === undefined),- ).toBe(true);- });-- it("creates and publish-seeds a home canvas when the channel has none", async () => {- const created = apiCanvas({- id: "home-1",- is_home: true,- current_version_id: null,- });- let published: Record<string, unknown> | null = null;- const { api } = fakeApi({- "canvases/?channel=chan-1&is_home=true": [],- "canvases/home-1/publish/": (init?: RequestInit) => {- published = JSON.parse(String(init?.body));- return { current_version_id: "v1" };- },- "canvases/home-1/": apiCanvas({- id: "home-1",- is_home: true,- current_version_id: "v1",- }),- "canvases/": created,- });- const service = new DashboardsService(api);-- const record = await service.ensureHomeCanvas("chan-1");-- expect(record.currentVersionId).toBe("v1");- expect(published).not.toBeNull();- const payload = published as unknown as {- project: {- files: Record<string, string>;- capabilities: { posthog: { inlineQueries: boolean } };- };- expected_current_version_id: string | null;- };- // The board queries system tables ad hoc, so the capability must be- // declared or view mode rejects every data request.- expect(payload.project.capabilities.posthog.inlineQueries).toBe(true);- expect(payload.expected_current_version_id).toBeNull();- expect(payload.project.files["src/canvas.tsx"]).toContain(- "system.canvases",- );- expect(payload.project.files["src/canvas.tsx"]).toContain("system.tasks");- });-- it("seeds source that transpiles as valid TSX", async () => {- const { api } = fakeApi({- "canvases/?channel=chan-1&is_home=true": [],- "canvases/home-1/publish/": { current_version_id: "v1" },- "canvases/home-1/": apiCanvas({- id: "home-1",- is_home: true,- current_version_id: "v1",- }),- "canvases/": apiCanvas({- id: "home-1",- is_home: true,- current_version_id: null,- }),- });- const service = new DashboardsService(api);-- await service.ensureHomeCanvas("chan-1");-- const publish = (api.json as ReturnType<typeof vi.fn>).mock.calls.find(- ([path]) => String(path).endsWith("/publish/"),- );- expect(publish).toBeDefined();- const body = JSON.parse(String(publish?.[2]?.body)) as {- project: { files: Record<string, string> };- };- await expect(- transform(body.project.files["src/canvas.tsx"], { loader: "tsx" }),- ).resolves.toBeDefined();- });-});--describe("DashboardsService.ensureHomeCanvas races", () => {- it("reuses the winner's canvas when create loses the is_home uniqueness race (409)", async () => {- let lookups = 0;- const { api } = fakeApi({- // First lookup: none. After the 409, the winner's home canvas exists.- "canvases/?channel=chan-1&is_home=true": () => {- lookups += 1;- return lookups === 1- ? []- : [- apiCanvas({- id: "home-winner",- is_home: true,- current_version_id: "v1",- }),- ];- },- "canvases/": () => {- throw new ProjectApiError("Failed to create canvas (409)", 409);- },- });- const service = new DashboardsService(api);-- const record = await service.ensureHomeCanvas("chan-1");-- expect(record.id).toBe("home-winner");- });-- it("rethrows a non-409 create failure instead of masking it as a race", async () => {- const { api } = fakeApi({- "canvases/?channel=chan-1&is_home=true": [],- "canvases/": () => {- throw new ProjectApiError("Failed to create canvas (403)", 403);- },- });- const service = new DashboardsService(api);-- await expect(service.ensureHomeCanvas("chan-1")).rejects.toMatchObject({- status: 403,- });- });-- it("retries the seed publish once on a 409 version conflict", async () => {- const home = apiCanvas({- id: "home-1",- is_home: true,- current_version_id: null,- });- let publishCalls = 0;- const { api } = fakeApi({- "canvases/?channel=chan-1&is_home=true": [home],- "canvases/home-1/publish/": (init?: RequestInit) => {- publishCalls += 1;- if (publishCalls === 1) {- throw new ProjectApiError("Failed to seed home canvas (409)", 409);- }- const body = JSON.parse(String(init?.body));- return { current_version_id: body.expected_current_version_id ?? "v1" };- },- "canvases/home-1/": apiCanvas({- id: "home-1",- is_home: true,- current_version_id: "v-fresh",- }),- });- const service = new DashboardsService(api);-- const record = await service.ensureHomeCanvas("chan-1");-- expect(publishCalls).toBe(2);- expect(record.id).toBe("home-1");- });-});--describe("DashboardsService.resetHomeCanvas", () => {- it("publishes a fresh default guarded on the current head", async () => {- const home = apiCanvas({- id: "home-1",- is_home: true,- current_version_id: "v3",- });- let published: Record<string, unknown> | null = null;- const { api } = fakeApi({- "canvases/?channel=chan-1&is_home=true": [home],- "canvases/home-1/publish/": (init?: RequestInit) => {- published = JSON.parse(String(init?.body));- return { current_version_id: "v4" };- },- "canvases/home-1/": apiCanvas({- id: "home-1",- is_home: true,- current_version_id: "v4",- }),- });- const service = new DashboardsService(api);-- const record = await service.resetHomeCanvas("chan-1");-- expect(record.currentVersionId).toBe("v4");- expect(- (published as unknown as { expected_current_version_id: string | null })- ?.expected_current_version_id,- ).toBe("v3");- });-});-describe("DashboardsService.getBuilds", () => {it("normalizes the lifecycle payload", async () => {const { api } = fakeApi({diff --git a/products/desktop/packages/core/src/canvas/dashboardsService.ts b/products/desktop/packages/core/src/canvas/dashboardsService.tsindex 32887daf9adf..2a6e186e75db 100644--- a/products/desktop/packages/core/src/canvas/dashboardsService.ts+++ b/products/desktop/packages/core/src/canvas/dashboardsService.ts@@ -1,9 +1,3 @@-import {- CANVAS_COMPONENT_PATH,- CANVAS_ENTRY_HTML,- CANVAS_PLATFORM_MANIFEST,- CANVAS_SOURCE_SCHEMA_VERSION,-} from "@posthog/shared";import { inject, injectable } from "inversify";import {type CanvasBuildActionInput,@@ -18,29 +12,7 @@ import type {DashboardRecord,} from "./dashboardSchemas";import { FREEFORM_TEMPLATE_ID } from "./freeformSchemas";-import {- apiErrorStatus,- PROJECT_API_CLIENT,- type ProjectApiClient,-} from "./projectApiClient";--// Display name (canvas h1) of a channel's auto-created home canvas.-const HOME_CANVAS_NAME = "Home";--// The entry shell for a client-authored single-file project (the home canvas-// seed): the runtime mounts the default export of the canvas component file.-const SINGLE_FILE_INDEX_HTML = `<!doctype html>-<html>- <head>- <meta charset="utf-8" />- <meta name="viewport" content="width=device-width, initial-scale=1" />- </head>- <body>- <div id="root"></div>- <script type="module" src="/${CANVAS_COMPONENT_PATH}"></script>- </body>-</html>-`;+import { PROJECT_API_CLIENT, type ProjectApiClient } from "./projectApiClient";// A canvas as the PostHog canvases API returns it.interface ApiCanvas {@@ -51,7 +23,6 @@ interface ApiCanvas {context: string;generation_task_id: string | null;pinned_at: string | null;- is_home: boolean;current_version_id: string | null;published_build_id: string | null;created_by?: {@@ -101,7 +72,6 @@ function toRecord(api: ApiCanvas): DashboardRecord {createdAt: toEpoch(api.created_at) ?? 0,updatedAt: toEpoch(api.updated_at) ?? 0,pinnedAt: toEpoch(api.pinned_at),- isHome: api.is_home,currentVersionId: api.current_version_id,publishedBuildId: api.published_build_id,};@@ -166,7 +136,6 @@ export class DashboardsService {channelId: string;name: string;templateId?: string;- isHome?: boolean;}): Promise<DashboardRecord> {const api = await this.api.json<ApiCanvas>(`canvases/`, "create canvas", {method: "POST",@@ -175,7 +144,6 @@ export class DashboardsService {channel_id: input.channelId,name: input.name,template_id: input.templateId ?? FREEFORM_TEMPLATE_ID,- is_home: input.isHome ?? false,}),});return toRecord(api);@@ -321,104 +289,6 @@ export class DashboardsService {return toBuildRecord(build);}- // Ensure the channel has a home canvas: the freeform board shown when the- // channel opens. Idempotent — reuses the channel's existing home canvas, and- // seeds its source (via a real publish, so it gets built) when empty.- async ensureHomeCanvas(channelId: string): Promise<DashboardRecord> {- let record = await this.findHomeCanvas(channelId);- if (!record) {- try {- record = await this.create({- channelId,- name: HOME_CANVAS_NAME,- templateId: FREEFORM_TEMPLATE_ID,- isHome: true,- });- } catch (error) {- // Only the is_home uniqueness race (409) means another client created- // it; reuse theirs. Any other failure (auth, capacity, network) must- // surface, not be masked as a race.- if (apiErrorStatus(error) !== 409) throw error;- record = await this.findHomeCanvas(channelId);- if (!record) throw new Error("Failed to create home canvas");- }- }- if (!record.currentVersionId) {- record = await this.publishHomeSeed(record, channelId);- }- return record;- }-- // Rebuild a channel's home canvas from the default template. Non-destructive:- // the pre-reset source stays in the version history, so a revert restores it.- async resetHomeCanvas(channelId: string): Promise<DashboardRecord> {- const record = await this.findHomeCanvas(channelId);- if (!record) return this.ensureHomeCanvas(channelId);- return this.publishHomeSeed(record, channelId);- }-- private async findHomeCanvas(- channelId: string,- ): Promise<DashboardRecord | null> {- const rows = await this.api.listPaginated<ApiCanvas>(- `canvases/?channel=${encodeURIComponent(channelId)}&is_home=true`,- "find home canvas",- { limit: 200 },- );- return rows.length ? toRecord(rows[0]) : null;- }-- // Publish the generated home board as the canvas's new head version. The- // board queries system.canvases/system.tasks ad hoc, so inline queries are- // declared as a capability.- private async publishHomeSeed(- record: DashboardRecord,- channelId: string,- ): Promise<DashboardRecord> {- const project = {- schemaVersion: CANVAS_SOURCE_SCHEMA_VERSION,- files: {- [CANVAS_ENTRY_HTML]: SINGLE_FILE_INDEX_HTML,- [CANVAS_COMPONENT_PATH]: buildHomeCanvasCode(channelId, record.id),- },- entryHtml: CANVAS_ENTRY_HTML,- dependencies: {- react: CANVAS_PLATFORM_MANIFEST.dependencies.react.version,- },- canvasSdkVersion: CANVAS_PLATFORM_MANIFEST.canvasSdkVersion,- capabilities: {- posthog: { insights: [], inlineQueries: true, captureEvents: [] },- network: { origins: [] },- },- };- const publish = (expectedVersionId: string | null) =>- this.api.json<unknown>(- `canvases/${encodeURIComponent(record.id)}/publish/`,- "seed home canvas",- {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify({- project,- prompt: "Default home board",- expected_current_version_id: expectedVersionId,- }),- },- );- try {- await publish(record.currentVersionId ?? null);- } catch (error) {- // A concurrent seed can win the guarded publish between our read and- // POST. On the 409 version conflict, re-read the head and retry once- // against the fresh version id rather than failing the channel open.- if (apiErrorStatus(error) !== 409) throw error;- const conflicted = await this.get(record.id);- await publish(conflicted?.currentVersionId ?? null);- }- const fresh = await this.get(record.id);- return fresh ?? record;- }-async delete(id: string): Promise<void> {const res = await this.api.fetch(`canvases/${encodeURIComponent(id)}/`, {method: "DELETE",@@ -429,395 +299,3 @@ export class DashboardsService {}}}--// The seeded React source for a channel's home canvas. It runs in the freeform-// sandbox (null-origin iframe), so its only data avenue is `window.ph.query`-// (HogQL). It reads its lists from the `system.canvases`/`system.tasks` HogQL tables:-// - Canvases: this channel's canvases (excluding the home canvas).-// - Inbox / to-dos: stubbed (no data source yet) with an assignee filter.-// - Tasks: this channel's tasks, newest first.-// Each list shows a page at a time and loads more as its own box is scrolled.-// Rows and the "New" buttons drive host routing via the allowlisted-// `ph.navigate` bridge (toTask/toNewTask/toCanvas/toNewCanvas); the Inbox stub-// stays a no-op until it has a data source. channelId is host-supplied, so the-// canvas can only navigate within its own channel; homeCanvasId lets the-// Canvases list exclude this board.-function buildHomeCanvasCode(channelId: string, homeCanvasId: string): string {- const cid = JSON.stringify(channelId);- const hid = JSON.stringify(homeCanvasId);- return `import { useCallback, useEffect, useRef, useState } from "react";--const CHANNEL_ID = ${cid};-const HOME_CANVAS_ID = ${hid};-const PAGE_SIZE = 10;--const ph = (window as any).ph;--// Single-quote a value for inlining into a HogQL string literal.-function sql(v: string): string {- return "'" + String(v).replace(/'/g, "''") + "'";-}--type Row = { id: string; title: string; createdAt: string };--// Paginated reader for the channel's canvases or tasks, newest first.-function useChannelRows(kind: "dashboard" | "task") {- const [rows, setRows] = useState<Row[]>([]);- const [loading, setLoading] = useState(false);- const [done, setDone] = useState(false);- const offsetRef = useRef(0);- const busyRef = useRef(false);-- const loadMore = useCallback(async () => {- if (busyRef.current || done) return;- busyRef.current = true;- setLoading(true);- try {- const page = " ORDER BY created_at DESC LIMIT " + PAGE_SIZE + " OFFSET " + offsetRef.current;- const query =- kind === "dashboard"- ? "SELECT id, name, created_at FROM system.canvases" +- " WHERE channel_id = " + sql(CHANNEL_ID) +- " AND id != " + sql(HOME_CANVAS_ID) + page- : "SELECT id, title, created_at FROM system.tasks" +- " WHERE channel_id = " + sql(CHANNEL_ID) + page;- const res = await ph.query(query);- const batch: Row[] = ((res && res.results) || []).map((r: any[]) => ({- id: String(r[0]),- title: String(r[1]),- createdAt: String(r[2]),- }));- offsetRef.current += batch.length;- setRows((prev) => prev.concat(batch));- if (batch.length < PAGE_SIZE) setDone(true);- } catch (err) {- // Stop paging on error (e.g. the system table isn't available yet) rather- // than spinning; the section just shows what it has.- setDone(true);- } finally {- busyRef.current = false;- setLoading(false);- }- }, [kind, done]);-- useEffect(() => {- void loadMore();- // Load the first page once on mount.- // eslint-disable-next-line react-hooks/exhaustive-deps- }, []);-- return { rows, loadMore, loading, done };-}--// A fixed-height, scrollable section card. A sentinel at the bottom (observed-// against THIS box, not the page) fires onLoadMore as the user scrolls near the-// end. Styled to match the PostHog app: greenish-gray neutrals, soft-// shadow, ~16px radius, a per-section accent dot.-function Section(props: {- title: string;- accent: string;- onNew: () => void;- loading: boolean;- done: boolean;- onLoadMore: () => void;- children: any;- // A "+ New" that isn't wired yet: disable it and explain via tooltip rather- // than offering a button that silently does nothing.- newDisabled?: boolean;- newTooltip?: string;-}) {- const scrollRef = useRef<HTMLDivElement | null>(null);- const sentinelRef = useRef<HTMLDivElement | null>(null);-- useEffect(() => {- const root = scrollRef.current;- const target = sentinelRef.current;- if (!root || !target) return;- const io = new IntersectionObserver(- (entries) => {- if (entries.some((e) => e.isIntersecting)) props.onLoadMore();- },- { root, rootMargin: "120px" },- );- io.observe(target);- return () => io.disconnect();- }, [props.onLoadMore]);-- return (- <section- style={{- flex: "1 1 0",- minWidth: 0,- maxWidth: 380,- height: 460,- display: "flex",- flexDirection: "column",- background: "var(--card-bg)",- border: "1px solid var(--card-border)",- borderRadius: 16,- overflow: "hidden",- boxShadow:- "0 1px 2px rgba(13,13,13,0.04), 0 12px 32px rgba(13,13,13,0.06)",- }}- >- <header- style={{- display: "flex",- alignItems: "center",- justifyContent: "space-between",- padding: "14px 16px",- borderBottom: "1px solid var(--header-border)",- }}- >- <div style={{ display: "flex", alignItems: "center", gap: 8 }}>- <span- style={{- width: 8,- height: 8,- borderRadius: 999,- background: props.accent,- boxShadow: "0 0 0 3px " + props.accent + "22",- }}- />- <h2- style={{- margin: 0,- fontSize: 15,- fontWeight: 600,- color: "var(--title)",- letterSpacing: "-0.01em",- }}- >- {props.title}- </h2>- </div>- <button- type="button"- className="ph-btn"- onClick={props.onNew}- disabled={props.newDisabled}- title={props.newTooltip}- style={{- fontSize: 12,- fontWeight: 500,- padding: "4px 10px",- borderRadius: 8,- border: "1px solid var(--btn-border)",- background: "var(--btn-bg)",- color: "var(--btn-color)",- cursor: props.newDisabled ? "not-allowed" : "pointer",- opacity: props.newDisabled ? 0.5 : 1,- }}- >- + New- </button>- </header>- <div ref={scrollRef} style={{ flex: 1, overflowY: "auto", padding: 8 }}>- {props.children}- {!props.done ? (- <div ref={sentinelRef} style={{ height: 1 }} />- ) : null}- {props.loading ? (- <div style={{ padding: 8, fontSize: 12, color: "var(--meta)" }}>Loading…</div>- ) : null}- </div>- </section>- );-}--function ListRow(props: { title: string; meta?: string; onClick?: () => void }) {- return (- <div- className="ph-row"- role={props.onClick ? "button" : undefined}- tabIndex={props.onClick ? 0 : undefined}- onClick={props.onClick}- onKeyDown={(e) => {- if (props.onClick && (e.key === "Enter" || e.key === " ")) {- e.preventDefault();- props.onClick();- }- }}- style={{- padding: "8px 10px",- borderRadius: 8,- fontSize: 13,- color: "var(--row-color)",- display: "flex",- justifyContent: "space-between",- gap: 8,- cursor: props.onClick ? "pointer" : "default",- }}- >- <span style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>- {props.title}- </span>- {props.meta ? (- <span style={{ color: "var(--meta)", fontSize: 11, flexShrink: 0 }}>{props.meta}</span>- ) : null}- </div>- );-}--function Empty(props: { label: string }) {- return (- <div- style={{- display: "flex",- height: "100%",- minHeight: 120,- alignItems: "center",- justifyContent: "center",- textAlign: "center",- padding: 16,- fontSize: 12,- color: "var(--empty)",- }}- >- {props.label}- </div>- );-}--function CanvasesSection() {- const { rows, loadMore, loading, done } = useChannelRows("dashboard");- return (- <Section- title="Canvases"- accent="#f54d00"- onNew={() => ph.navigate?.toNewCanvas()}- loading={loading}- done={done}- onLoadMore={loadMore}- >- {rows.length === 0 && done ? <Empty label="No canvases yet." /> : null}- {rows.map((r) => (- <ListRow key={r.id} title={r.title} onClick={() => ph.navigate?.toCanvas(r.id)} />- ))}- </Section>- );-}--function TasksSection() {- const { rows, loadMore, loading, done } = useChannelRows("task");- return (- <Section- title="Tasks"- accent="#f8be2a"- onNew={() => ph.navigate?.toNewTask()}- loading={loading}- done={done}- onLoadMore={loadMore}- >- {rows.length === 0 && done ? <Empty label="No tasks yet." /> : null}- {rows.map((r) => (- <ListRow- key={r.id}- title={r.title}- meta={r.createdAt.slice(0, 10)}- onClick={() => ph.navigate?.toTask(r.id)}- />- ))}- </Section>- );-}--// Inbox / to-dos: there's no data source for these yet, so this is a stub. The-// assignee toggle and "New" button are placeholders the host will wire up later.-function InboxSection() {- const [scope, setScope] = useState<"me" | "team">("me");- const accent = "#1d4aff";- return (- <Section title="Inbox" accent={accent} onNew={() => {}} loading={false} done={true} onLoadMore={() => {}} newDisabled={true} newTooltip="Coming soon">- <div style={{ display: "flex", gap: 6, padding: "2px 2px 10px" }}>- {(["me", "team"] as const).map((s) => {- const active = scope === s;- return (- <button- key={s}- type="button"- className="ph-btn"- onClick={() => setScope(s)}- style={{- fontSize: 12,- fontWeight: 500,- padding: "4px 10px",- borderRadius: 8,- border: "1px solid " + (active ? accent : "var(--btn-border)"),- background: active ? accent + "14" : "var(--btn-bg)",- color: active ? accent : "var(--btn-color)",- cursor: "pointer",- }}- >- {s === "me" ? "Assigned to me" : "Teammates"}- </button>- );- })}- </div>- <Empty label={"No " + (scope === "me" ? "items assigned to you" : "teammate items") + " yet."} />- </Section>- );-}--// Colors are CSS variables so the canvas follows the user's PostHog theme. The-// iframe loader toggles a \`dark\` class on <html> (sandboxRuntime.applyTheme);-// \`html.dark\` overrides win on specificity, so every value flips with no JS.-const STYLE_TEXT =- ":root{" +- "--bg-from:#f4f5f0;--bg-to:#eceee8;--card-bg:#ffffff;--card-border:#e4e5de;" +- "--header-border:#eceee8;--title:#0d0d0d;--btn-border:#d8dbd1;--btn-bg:#f2f3ee;" +- "--btn-color:#3a4036;--btn-hover-bg:#eceee8;--btn-hover-border:#cbd0c3;" +- "--row-color:#3a4036;--row-hover-bg:#f2f3ee;--meta:#93998a;--empty:#a9af9f;" +- "--page-color:#3a4036;--scroll-thumb:#cbd0c3;--scroll-thumb-hover:#a9af9f}" +- "html.dark{" +- "--bg-from:#1b1d1a;--bg-to:#141613;--card-bg:#202220;--card-border:#33362e;" +- "--header-border:#2b2e27;--title:#f3f4ef;--btn-border:#3a3e34;--btn-bg:#2a2d26;" +- "--btn-color:#d4d7cd;--btn-hover-bg:#34372f;--btn-hover-border:#474c3f;" +- "--row-color:#d4d7cd;--row-hover-bg:#2a2d26;--meta:#8a917e;--empty:#6f7567;" +- "--page-color:#d4d7cd;--scroll-thumb:#3a3e34;--scroll-thumb-hover:#4a4f42}" +- ".ph-btn{transition:background .15s ease,border-color .15s ease,color .15s ease}" +- ".ph-btn:hover{background:var(--btn-hover-bg);border-color:var(--btn-hover-border)}" +- ".ph-row{transition:background .12s ease}" +- ".ph-row:hover{background:var(--row-hover-bg)}" +- "*::-webkit-scrollbar{width:10px;height:10px}" +- "*::-webkit-scrollbar-thumb{background:var(--scroll-thumb);border-radius:8px;border:2px solid transparent;background-clip:padding-box}" +- "*::-webkit-scrollbar-thumb:hover{background:var(--scroll-thumb-hover);background-clip:padding-box}";--export default function ChannelHome() {- return (- <div- style={{- minHeight: "100vh",- boxSizing: "border-box",- display: "flex",- alignItems: "center",- justifyContent: "center",- padding: 40,- background:- "linear-gradient(180deg, var(--bg-from) 0%, var(--bg-to) 100%)",- fontFamily:- '"Open Runde", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',- color: "var(--page-color)",- }}- >- <style>{STYLE_TEXT}</style>- <div- style={{- display: "flex",- alignItems: "stretch",- justifyContent: "center",- gap: 20,- width: "100%",- maxWidth: 1200,- flexWrap: "wrap",- }}- >- <CanvasesSection />- <InboxSection />- <TasksSection />- </div>- </div>- );-}-`;-}diff --git a/products/desktop/packages/core/src/canvas/services.ts b/products/desktop/packages/core/src/canvas/services.tsindex 2f77302f6622..640344b6253e 100644--- a/products/desktop/packages/core/src/canvas/services.ts+++ b/products/desktop/packages/core/src/canvas/services.ts@@ -61,11 +61,6 @@ export interface IDashboardsService {getBuilds(id: string): Promise<CanvasBuildLifecycle>;actOnBuild(input: CanvasBuildActionInput): Promise<CanvasBuildRecord>;rename(input: { id: string; name: string }): Promise<DashboardRecord>;- // Idempotently create + seed a channel's home canvas, returning it.- ensureHomeCanvas(channelId: string): Promise<DashboardRecord>;- // Publish a fresh template version to the home canvas (non-destructive; the- // prior version stays in history so the edit can be restored via revert).- resetHomeCanvas(channelId: string): Promise<DashboardRecord>;delete(id: string): Promise<void>;}diff --git a/products/desktop/packages/host-router/src/routers/dashboards.router.ts b/products/desktop/packages/host-router/src/routers/dashboards.router.tsindex 6821c98d6efd..7603b889ea0d 100644--- a/products/desktop/packages/host-router/src/routers/dashboards.router.ts+++ b/products/desktop/packages/host-router/src/routers/dashboards.router.ts@@ -10,7 +10,6 @@ import {createDashboardInput,dashboardIdInput,dashboardRecordSchema,- ensureHomeCanvasInput,listDashboardsInput,renameDashboardInput,revertCanvasInput,@@ -114,22 +113,6 @@ export const dashboardsRouter = router({.mutation(({ ctx, input }) =>ctx.container.get<IDashboardsService>(DASHBOARDS_SERVICE).rename(input),),- ensureHomeCanvas: publicProcedure- .input(ensureHomeCanvasInput)- .output(dashboardRecordSchema)- .mutation(({ ctx, input }) =>- ctx.container- .get<IDashboardsService>(DASHBOARDS_SERVICE)- .ensureHomeCanvas(input.channelId),- ),- resetHomeCanvas: publicProcedure- .input(ensureHomeCanvasInput)- .output(dashboardRecordSchema)- .mutation(({ ctx, input }) =>- ctx.container- .get<IDashboardsService>(DASHBOARDS_SERVICE)- .resetHomeCanvas(input.channelId),- ),delete: publicProcedure.input(dashboardIdInput).mutation(({ ctx, input }) =>diff --git a/products/desktop/packages/ui/src/features/canvas/freeform/FreeformCanvasView.tsx b/products/desktop/packages/ui/src/features/canvas/freeform/FreeformCanvasView.tsxindex b46bc101d254..427638f9f1b2 100644--- a/products/desktop/packages/ui/src/features/canvas/freeform/FreeformCanvasView.tsx+++ b/products/desktop/packages/ui/src/features/canvas/freeform/FreeformCanvasView.tsx@@ -1,5 +1,4 @@import {- ArrowCounterClockwiseIcon,ArrowUUpLeftIcon,ArrowUUpRightIcon,ClockCounterClockwiseIcon,@@ -72,7 +71,7 @@ import {shouldClearCanvasBrowse,} from "./canvasVersionNavigation";import { handleFreeformDataRequest } from "./freeformDataBridge";-import { useCanvasNavigation, useHomeCanvasReset } from "./useHomeCanvasView";+import { useCanvasNavigation } from "./useCanvasNavigation";import { usePinnedArtifact } from "./usePinnedArtifact";// A freeform (React-in-iframe) canvas. The rendered output is, in priority@@ -145,13 +144,6 @@ export function FreeformCanvasView({[channels, channelId],);- // The "Reset to default" affordance, shown only on a channel's home canvas.- const {- isHomeCanvas,- isResetting,- reset: onResetToDefault,- } = useHomeCanvasReset({ channelId, dashboardId, threadId });-// Run status derivation (cloud vs local) lives in a pure, tested helper; a// terminal run record always ends "running" so a stale session can't strand// the canvas on "Generating".@@ -487,18 +479,6 @@ export function FreeformCanvasView({{isReverting ? "Reverting…" : "Revert to this version"}</Button>)}- {isHomeCanvas && (- <Button- size="sm"- variant="default"- className="ml-1"- disabled={isGenerating || isResetting}- onClick={onResetToDefault}- >- <ArrowCounterClockwiseIcon size={14} />- {isResetting ? "Resetting…" : "Reset to default"}- </Button>- )}</>)}</Flex>diff --git a/products/desktop/packages/ui/src/features/canvas/freeform/useCanvasNavigation.ts b/products/desktop/packages/ui/src/features/canvas/freeform/useCanvasNavigation.tsnew file mode 100644index 000000000000..ed45b5977842--- /dev/null+++ b/products/desktop/packages/ui/src/features/canvas/freeform/useCanvasNavigation.ts@@ -0,0 +1,39 @@+import type { CanvasNavIntent } from "@posthog/core/canvas/freeformSchemas";+import { useCreateAndOpenDashboard } from "@posthog/ui/features/canvas/hooks/useDashboards";+import {+ navigateToChannelDashboard,+ navigateToChannelTask,+} from "@posthog/ui/router/navigationBridge";+import { openTaskInput } from "@posthog/ui/router/useOpenTask";+import { useCallback } from "react";++/**+ * Routes a canvas's allowlisted nav intent to real host navigation. channelId is+ * host-supplied (never from the iframe), so the canvas can only move within its+ * own channel. The returned callback switches exhaustively over the intent union.+ */+export function useCanvasNavigation(+ channelId: string,+): (intent: CanvasNavIntent) => void {+ const createAndOpen = useCreateAndOpenDashboard(channelId);+ return useCallback(+ (intent: CanvasNavIntent) => {+ switch (intent.target) {+ case "task":+ navigateToChannelTask(channelId, intent.taskId);+ break;+ case "new-task":+ // Via openTaskInput so a stale prefill can't leak into the composer.+ openTaskInput({ channelId });+ break;+ case "canvas":+ navigateToChannelDashboard(channelId, intent.dashboardId);+ break;+ case "new-canvas":+ void createAndOpen();+ break;+ }+ },+ [channelId, createAndOpen],+ );+}diff --git a/products/desktop/packages/ui/src/features/canvas/freeform/useHomeCanvasView.ts b/products/desktop/packages/ui/src/features/canvas/freeform/useHomeCanvasView.tsdeleted file mode 100644index 7404b28b034c..000000000000--- a/products/desktop/packages/ui/src/features/canvas/freeform/useHomeCanvasView.ts+++ /dev/null@@ -1,106 +0,0 @@-import type { CanvasNavIntent } from "@posthog/core/canvas/freeformSchemas";-import { useHostTRPC } from "@posthog/host-router/react";-import { invalidateCanvasLifecycle } from "@posthog/ui/features/canvas/hooks/invalidateCanvasLifecycle";-import {- useCreateAndOpenDashboard,- useDashboard,-} from "@posthog/ui/features/canvas/hooks/useDashboards";-import { useFreeformChatStore } from "@posthog/ui/features/canvas/stores/freeformChatStore";-import { toast } from "@posthog/ui/primitives/toast";-import {- navigateToChannelDashboard,- navigateToChannelTask,-} from "@posthog/ui/router/navigationBridge";-import { openTaskInput } from "@posthog/ui/router/useOpenTask";-import { useMutation, useQueryClient } from "@tanstack/react-query";-import { useCallback, useState } from "react";--/**- * Routes a canvas's allowlisted nav intent to real host navigation. channelId is- * host-supplied (never from the iframe), so the canvas can only move within its- * own channel. The returned callback switches exhaustively over the intent union.- */-export function useCanvasNavigation(- channelId: string,-): (intent: CanvasNavIntent) => void {- const createAndOpen = useCreateAndOpenDashboard(channelId);- return useCallback(- (intent: CanvasNavIntent) => {- switch (intent.target) {- case "task":- navigateToChannelTask(channelId, intent.taskId);- break;- case "new-task":- // Via openTaskInput so a stale prefill can't leak into the composer.- openTaskInput({ channelId });- break;- case "canvas":- navigateToChannelDashboard(channelId, intent.dashboardId);- break;- case "new-canvas":- void createAndOpen();- break;- }- },- [channelId, createAndOpen],- );-}--/**- * The home-canvas "Reset to default" affordance. Only a channel's home canvas- * has a default template to reset to, so `isHomeCanvas` (from the canvas- * record's own flag) gates the button. `reset` regenerates the source- * server-side — the host publishes the template as a new head version and- * queues its rebuild — so afterwards it drops any version browse and refetches- * the record, version history, source, and build lifecycle. The prior version- * stays in history, so undo can still browse (and revert to) it.- */-export function useHomeCanvasReset(args: {- channelId: string;- dashboardId: string;- threadId: string;-}): {- isHomeCanvas: boolean;- isResetting: boolean;- reset: () => Promise<void>;-} {- const { channelId, dashboardId, threadId } = args;- const trpc = useHostTRPC();- const queryClient = useQueryClient();- const { dashboard } = useDashboard(dashboardId);- const setBrowseVersion = useFreeformChatStore((s) => s.setBrowseVersion);- const resetMutation = useMutation(- trpc.dashboards.resetHomeCanvas.mutationOptions(),- );- const [isResetting, setIsResetting] = useState(false);-- const isHomeCanvas = dashboard?.isHome ?? false;-- const reset = useCallback(async () => {- setIsResetting(true);- try {- await resetMutation.mutateAsync({ channelId });- setBrowseVersion(threadId, null);- await invalidateCanvasLifecycle(queryClient, trpc, dashboardId);- toast.success("Canvas reset to default", {- description: "Undo to browse your previous version.",- });- } catch (error) {- toast.error("Couldn't reset canvas", {- description: error instanceof Error ? error.message : String(error),- });- } finally {- setIsResetting(false);- }- }, [- channelId,- dashboardId,- threadId,- resetMutation,- setBrowseVersion,- queryClient,- trpc,- ]);-- return { isHomeCanvas, isResetting, reset };-}diff --git a/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.ts b/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.tsindex beb642f05d10..2cf3fb0b0b40 100644--- a/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.ts+++ b/products/desktop/packages/ui/src/features/canvas/hooks/useDashboards.ts@@ -170,11 +170,6 @@ export function useDashboardMutations() {const setPinned = useMutation(trpc.dashboards.setPinned.mutationOptions({ onSuccess: invalidate }),);- const ensureHome = useMutation(- trpc.dashboards.ensureHomeCanvas.mutationOptions({- onSuccess: invalidate,- }),- );return {// Refresh the canvas queries after a mutation that didn't go through this@@ -205,10 +200,6 @@ export function useDashboardMutations() {// shows in the channel's Pinned menu for every member.setPinned: (id: string, pinned: boolean) =>setPinned.mutateAsync({ id, pinned }),- // Ensure a channel has its home canvas (creating + seeding it if absent).- // Idempotent server-side; returns the home canvas record.- ensureHomeCanvas: (channelId: string) =>- ensureHome.mutateAsync({ channelId }),isCreating: create.isPending,isDeleting: remove.isPending,isSavingContext: saveContext.isPending,@@ -216,48 +207,6 @@ export function useDashboardMutations() {};}-/**- * Open a channel's home canvas in the main content pane. The home canvas is- * resolved (and created on first open) by the dashboards service, which is- * idempotent server-side.- */-export function useOpenHomeCanvas(): (channel: {- id: string;-}) => Promise<void> {- const navigate = useNavigate();- const trpc = useHostTRPC();- const queryClient = useQueryClient();- const { ensureHomeCanvas } = useDashboardMutations();-- return useCallback(- async (channel) => {- try {- // The channel's dashboards list is usually already cached; a seeded- // home canvas found there can be opened without a server round trip.- // Only when none exists (or it's unseeded) does the idempotent- // ensureHomeCanvas create/seed it.- const cachedHome = queryClient- .getQueryData<DashboardRecord[]>(- trpc.dashboards.list.queryKey({ channelId: channel.id }),- )- ?.find((d) => d.isHome && d.currentVersionId);- const dashboardId =- cachedHome?.id ?? (await ensureHomeCanvas(channel.id)).id;- await navigate({- to: "/website/$channelId/dashboards/$dashboardId",- params: { channelId: channel.id, dashboardId },- });- } catch (error) {- log.error("Failed to open home canvas", { error });- toast.error("Couldn't open channel home", {- description: error instanceof Error ? error.message : String(error),- });- }- },- [navigate, ensureHomeCanvas, queryClient, trpc],- );-}-/*** Create an empty canvas in a channel, enter edit mode, and navigate to it.* `opts.channelId` overrides the bound channel, for callers whose channel isdiff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex d972fcbb3bee..32ab4899ae88 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -13317,7 +13317,6 @@ export namespace Schemas {readonly pinned: boolean;/** @nullable */readonly pinned_at: string | null;- readonly is_home: boolean;/*** Id of the live source version — pass as expected_current_version_id on publish. Null before the first publish.* @nullable@@ -13522,8 +13521,6 @@ export namespace Schemas {* @maxLength 64*/template_id?: string;- /** Create the canvas as the channel's home board (at most one per channel). */- is_home?: boolean;}/**@@ -77917,10 +77914,6 @@ export namespace Schemas {* Only return canvases in this channel.*/channel?: string;- /**- * Filter by channel-home status.- */- is_home?: boolean;/*** Number of results to return per page.*/diff --git a/services/mcp/src/generated/canvas/api.ts b/services/mcp/src/generated/canvas/api.tsindex 69791f43d550..041cb68f9ee4 100644--- a/services/mcp/src/generated/canvas/api.ts+++ b/services/mcp/src/generated/canvas/api.ts@@ -24,7 +24,6 @@ export const CanvasesListParams = /* @__PURE__ */ zod.object({export const CanvasesListQueryParams = /* @__PURE__ */ zod.object({channel: zod.string().optional().describe('Only return canvases in this channel.'),- is_home: zod.boolean().optional().describe('Filter by channel-home status.'),limit: zod.number().optional().describe('Number of results to return per page.'),offset: zod.number().optional().describe('The initial index from which to return the results.'),})@@ -45,8 +44,6 @@ export const canvasesCreateBodyNameMax = 400export const canvasesCreateBodyTemplateIdDefault = `freeform`export const canvasesCreateBodyTemplateIdMax = 64-export const canvasesCreateBodyIsHomeDefault = false-export const CanvasesCreateBody = /* @__PURE__ */ zod.object({name: zod.string().max(canvasesCreateBodyNameMax).describe('Display name for the canvas.'),@@ -56,10 +53,6 @@ export const CanvasesCreateBody = /* @__PURE__ */ zod.max(canvasesCreateBodyTemplateIdMax).default(canvasesCreateBodyTemplateIdDefault).describe('Canvas template identifier.'),- is_home: zod- .boolean()- .default(canvasesCreateBodyIsHomeDefault)- .describe("Create the canvas as the channel's home board (at most one per channel)."),}).describe('Payload for creating a new, empty canvas in a channel.')diff --git a/services/mcp/src/tools/generated/canvas.ts b/services/mcp/src/tools/generated/canvas.tsindex 38a6d8c6c160..b48dd0750788 100644--- a/services/mcp/src/tools/generated/canvas.ts+++ b/services/mcp/src/tools/generated/canvas.ts@@ -55,9 +55,6 @@ const canvasCreate = (): ToolBase<typeof CanvasCreateSchema, Schemas.Canvas> =>if (params.template_id !== undefined) {body['template_id'] = params.template_id}- if (params.is_home !== undefined) {- body['is_home'] = params.is_home- }const result = await context.api.request<Schemas.Canvas>({method: 'POST',path: `/api/projects/${encodeURIComponent(String(projectId))}/canvases/`,@@ -112,7 +109,6 @@ const canvasList = (): ToolBase<typeof CanvasListSchema, Schemas.PaginatedCanvaspath: `/api/projects/${encodeURIComponent(String(projectId))}/canvases/`,query: {channel: params.channel,- is_home: params.is_home,limit: params.limit,offset: params.offset,},diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-create.jsonindex b0e0da4550d9..b508c82437ca 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-create.json@@ -5,11 +5,6 @@"description": "Id of the channel to create the canvas in (resolve it with channel-list).","type": "string"},- "is_home": {- "default": false,- "description": "Create the canvas as the channel's home board (at most one per channel).",- "type": "boolean"- },"name": {"description": "Display name for the canvas.","maxLength": 400,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-list.jsonindex 3d9647f99d72..6789377efd3a 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-list.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/canvas-list.json@@ -5,10 +5,6 @@"description": "Only return canvases in this channel (channel id).","type": "string"},- "is_home": {- "description": "Filter by channel-home status.",- "type": "boolean"- },"limit": {"description": "Number of results to return per page.","type": "number"