From 1a62a72091e79dcd4b456dfb343b47fcb0d49701 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Tejero=20Cantero?= Date: Fri, 7 Aug 2026 02:44:30 +0200 Subject: [PATCH] :recycle: Rename app.graph.project to app.graph.projection `project` is a Penpot noun: a team holds projects and a project holds files, and the graph will carry a `Project` node table. A namespace called `app.graph.project.document` therefore reads as "the graph of a Penpot project" and means the opposite. `projection` is the word the rest of the subsystem already uses for the operation: `projection-data`, `load-projection!`, `:projection` in the ingest report, and `app.graph.schema.projection`. Pure rename. Both namespaces and every alias move; nothing else changes. AI-assisted-by: mixed models --- backend/src/app/graph/ingest.clj | 8 ++++---- .../src/app/graph/{project => projection}/document.clj | 2 +- .../app/graph/{project => projection}/transforms.clj | 4 ++-- backend/src/app/graph/schema/nodes.clj | 2 +- backend/src/app/graph/sync.clj | 8 ++++---- backend/test/backend_tests/graph_sync_parity_test.clj | 10 +++++----- 6 files changed, 17 insertions(+), 17 deletions(-) rename backend/src/app/graph/{project => projection}/document.clj (99%) rename backend/src/app/graph/{project => projection}/transforms.clj (98%) diff --git a/backend/src/app/graph/ingest.clj b/backend/src/app/graph/ingest.clj index cf13d91559..af0644ee4d 100644 --- a/backend/src/app/graph/ingest.clj +++ b/backend/src/app/graph/ingest.clj @@ -15,8 +15,8 @@ [app.graph.arrow :as graph.arrow] [app.graph.ladybug :as ladybug] [app.graph.meta :as graph.meta] - [app.graph.project.document :as project.document] - [app.graph.project.transforms :as project.transforms] + [app.graph.projection.document :as projection.document] + [app.graph.projection.transforms :as projection.transforms] [app.graph.schema :as schema] [app.graph.stats :as stats] [app.srepl.helpers :as h]) @@ -54,11 +54,11 @@ :schema schema/schema-version) (let [ddl (schema/ddl-statements) {:keys [nodes edges stats]} - (project.document/projection-data data file)] + (projection.document/projection-data data file)] (ladybug/exec-on-connection! conn ddl) (graph.arrow/load-projection! conn {:nodes nodes :edges edges} allocator) (ladybug/exec-on-connection! conn ["CHECKPOINT;"]) - (let [transforms (project.transforms/apply-transforms! system conn data file)] + (let [transforms (projection.transforms/apply-transforms! system conn data file)] ;; Written last: its presence doubles as the build-complete marker. (graph.meta/write! conn {:file-id file-id :revn (:revn file)}) diff --git a/backend/src/app/graph/project/document.clj b/backend/src/app/graph/projection/document.clj similarity index 99% rename from backend/src/app/graph/project/document.clj rename to backend/src/app/graph/projection/document.clj index edf47ccbec..9d0eec6851 100644 --- a/backend/src/app/graph/project/document.clj +++ b/backend/src/app/graph/projection/document.clj @@ -4,7 +4,7 @@ ;; ;; Copyright (c) KALEIDOS INC Sucursal en España SL -(ns app.graph.project.document +(ns app.graph.projection.document "Project a Penpot file-data map into Ladybug nodes and structural edges. Projects Document, Page, Component, the full shape tree (skipping the root diff --git a/backend/src/app/graph/project/transforms.clj b/backend/src/app/graph/projection/transforms.clj similarity index 98% rename from backend/src/app/graph/project/transforms.clj rename to backend/src/app/graph/projection/transforms.clj index 4ef97328ec..dc87392983 100644 --- a/backend/src/app/graph/project/transforms.clj +++ b/backend/src/app/graph/projection/transforms.clj @@ -4,7 +4,7 @@ ;; ;; Copyright (c) KALEIDOS INC Sucursal en España SL -(ns app.graph.project.transforms +(ns app.graph.projection.transforms "Derived graph links: edges a reader could compute from the projected columns, materialized once at build time so a query does not have to. @@ -32,7 +32,7 @@ `component-file` is what makes a head a head here, not `component-id` alone. `app.common.types.component/instance-of?` requires both, and the projection denormalizes `component-id` down the shape tree - (`app.graph.project.document`), so on its own it no longer distinguishes a + (`app.graph.projection.document`), so on its own it no longer distinguishes a head from a shape that merely lives inside one. `component-file` is not denormalized and remains the head marker Penpot itself uses." [^Connection conn] diff --git a/backend/src/app/graph/schema/nodes.clj b/backend/src/app/graph/schema/nodes.clj index 5946fa5c8d..c81802415d 100644 --- a/backend/src/app/graph/schema/nodes.clj +++ b/backend/src/app/graph/schema/nodes.clj @@ -44,7 +44,7 @@ ;; A projection `:extra` is local to the graph and cannot reach a write. ;; ;; `:options` is lifted out of `:data` before the blob is dropped - ;; (`app.graph.project.document/document-attrs`); the rest come off the file + ;; (`app.graph.projection.document/document-attrs`); the rest come off the file ;; map as `get-file` returns it. :extra [:map [:options {:optional true} [:maybe :map]] diff --git a/backend/src/app/graph/sync.clj b/backend/src/app/graph/sync.clj index eec5a8c166..cb32fe2d47 100644 --- a/backend/src/app/graph/sync.clj +++ b/backend/src/app/graph/sync.clj @@ -10,7 +10,7 @@ [app.common.logging :as l] [app.common.uuid :as uuid] [app.graph.ladybug :as ladybug] - [app.graph.project.document :as project.document] + [app.graph.projection.document :as projection.document] [app.graph.schema.nodes :as nodes] [clojure.string :as str]) (:import @@ -355,7 +355,7 @@ "A container's stored `shapes` list, rebuilt from the index. `IsChildOf.position` counts from the last entry of that list - (`app.graph.project.document/child-shape-ids` reverses it), so reversing the + (`app.graph.projection.document/child-shape-ids` reverses it), so reversing the children ordered by position gives the list back." [index parent-id] (->> (get-in index [:children parent-id] #{}) @@ -568,7 +568,7 @@ (when (= parent-table "Page") parent-id) (get-in index [:shapes parent-id :page-id])) parent-ctx (get-in index [:shapes parent-id :component-ctx]) - shape (project.document/denormalized-shape + shape (projection.document/denormalized-shape (assoc obj :id id) resolved-page-id parent-ctx) attrs (nodes/project-attrs table shape) edge {:from-table table @@ -588,7 +588,7 @@ :parent-table parent-table :position position :frame-id (:frame-id attrs) - :component-ctx (project.document/descend-component-ctx + :component-ctx (projection.document/descend-component-ctx table shape parent-ctx) :page-id resolved-page-id})] {:index index' diff --git a/backend/test/backend_tests/graph_sync_parity_test.clj b/backend/test/backend_tests/graph_sync_parity_test.clj index f9de78d831..c7eff4c34e 100644 --- a/backend/test/backend_tests/graph_sync_parity_test.clj +++ b/backend/test/backend_tests/graph_sync_parity_test.clj @@ -8,7 +8,7 @@ "Cold projection and incremental sync are two implementations of one mapping, and this namespace holds them to it. - `app.graph.project.document/projection-data` reads a whole file and produces + `app.graph.projection.document/projection-data` reads a whole file and produces the whole graph. `app.graph.sync/apply-changes!` takes the change vocabulary the editor emits and mutates an already open graph. A graph the second one maintained must equal a graph the first one would build from the same file, @@ -26,8 +26,8 @@ [app.common.uuid :as uuid] [app.graph.arrow :as arrow] [app.graph.ladybug :as ladybug] - [app.graph.project.document :as project.document] - [app.graph.project.transforms :as project.transforms] + [app.graph.projection.document :as projection.document] + [app.graph.projection.transforms :as projection.transforms] [app.graph.schema.nodes :as nodes] [app.graph.sync :as sync] [clojure.test :as t])) @@ -133,11 +133,11 @@ Returns the projection, which is also what the sync index is built from." [conn data file] - (let [projection (project.document/projection-data data file)] + (let [projection (projection.document/projection-data data file)] (ladybug/exec-on-connection! conn (nodes/ddl-statements)) (arrow/with-allocator! (fn [allocator] (arrow/load-projection! conn projection allocator))) - (project.transforms/apply-transforms! nil conn data file) + (projection.transforms/apply-transforms! nil conn data file) projection)) (defn- rel-tables