♻️ 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
This commit is contained in:
Álvaro Tejero Cantero 2026-08-07 02:44:30 +02:00
parent dbbd70e68e
commit 1a62a72091
No known key found for this signature in database
6 changed files with 17 additions and 17 deletions

View File

@ -15,8 +15,8 @@
[app.graph.arrow :as graph.arrow] [app.graph.arrow :as graph.arrow]
[app.graph.ladybug :as ladybug] [app.graph.ladybug :as ladybug]
[app.graph.meta :as graph.meta] [app.graph.meta :as graph.meta]
[app.graph.project.document :as project.document] [app.graph.projection.document :as projection.document]
[app.graph.project.transforms :as project.transforms] [app.graph.projection.transforms :as projection.transforms]
[app.graph.schema :as schema] [app.graph.schema :as schema]
[app.graph.stats :as stats] [app.graph.stats :as stats]
[app.srepl.helpers :as h]) [app.srepl.helpers :as h])
@ -54,11 +54,11 @@
:schema schema/schema-version) :schema schema/schema-version)
(let [ddl (schema/ddl-statements) (let [ddl (schema/ddl-statements)
{:keys [nodes edges stats]} {:keys [nodes edges stats]}
(project.document/projection-data data file)] (projection.document/projection-data data file)]
(ladybug/exec-on-connection! conn ddl) (ladybug/exec-on-connection! conn ddl)
(graph.arrow/load-projection! conn {:nodes nodes :edges edges} allocator) (graph.arrow/load-projection! conn {:nodes nodes :edges edges} allocator)
(ladybug/exec-on-connection! conn ["CHECKPOINT;"]) (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. ;; Written last: its presence doubles as the build-complete marker.
(graph.meta/write! conn {:file-id file-id (graph.meta/write! conn {:file-id file-id
:revn (:revn file)}) :revn (:revn file)})

View File

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) KALEIDOS INC Sucursal en España SL ;; 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. "Project a Penpot file-data map into Ladybug nodes and structural edges.
Projects Document, Page, Component, the full shape tree (skipping the root Projects Document, Page, Component, the full shape tree (skipping the root

View File

@ -4,7 +4,7 @@
;; ;;
;; Copyright (c) KALEIDOS INC Sucursal en España SL ;; 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 "Derived graph links: edges a reader could compute from the projected
columns, materialized once at build time so a query does not have to. 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. `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 `app.common.types.component/instance-of?` requires both, and the projection
denormalizes `component-id` down the shape tree 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 head from a shape that merely lives inside one. `component-file` is not
denormalized and remains the head marker Penpot itself uses." denormalized and remains the head marker Penpot itself uses."
[^Connection conn] [^Connection conn]

View File

@ -44,7 +44,7 @@
;; A projection `:extra` is local to the graph and cannot reach a write. ;; A projection `:extra` is local to the graph and cannot reach a write.
;; ;;
;; `:options` is lifted out of `:data` before the blob is dropped ;; `: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. ;; map as `get-file` returns it.
:extra [:map :extra [:map
[:options {:optional true} [:maybe :map]] [:options {:optional true} [:maybe :map]]

View File

@ -10,7 +10,7 @@
[app.common.logging :as l] [app.common.logging :as l]
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.graph.ladybug :as ladybug] [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] [app.graph.schema.nodes :as nodes]
[clojure.string :as str]) [clojure.string :as str])
(:import (:import
@ -355,7 +355,7 @@
"A container's stored `shapes` list, rebuilt from the index. "A container's stored `shapes` list, rebuilt from the index.
`IsChildOf.position` counts from the last entry of that list `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." children ordered by position gives the list back."
[index parent-id] [index parent-id]
(->> (get-in index [:children parent-id] #{}) (->> (get-in index [:children parent-id] #{})
@ -568,7 +568,7 @@
(when (= parent-table "Page") parent-id) (when (= parent-table "Page") parent-id)
(get-in index [:shapes parent-id :page-id])) (get-in index [:shapes parent-id :page-id]))
parent-ctx (get-in index [:shapes parent-id :component-ctx]) 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) (assoc obj :id id) resolved-page-id parent-ctx)
attrs (nodes/project-attrs table shape) attrs (nodes/project-attrs table shape)
edge {:from-table table edge {:from-table table
@ -588,7 +588,7 @@
:parent-table parent-table :parent-table parent-table
:position position :position position
:frame-id (:frame-id attrs) :frame-id (:frame-id attrs)
:component-ctx (project.document/descend-component-ctx :component-ctx (projection.document/descend-component-ctx
table shape parent-ctx) table shape parent-ctx)
:page-id resolved-page-id})] :page-id resolved-page-id})]
{:index index' {:index index'

View File

@ -8,7 +8,7 @@
"Cold projection and incremental sync are two implementations of one mapping, "Cold projection and incremental sync are two implementations of one mapping,
and this namespace holds them to it. 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 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 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, maintained must equal a graph the first one would build from the same file,
@ -26,8 +26,8 @@
[app.common.uuid :as uuid] [app.common.uuid :as uuid]
[app.graph.arrow :as arrow] [app.graph.arrow :as arrow]
[app.graph.ladybug :as ladybug] [app.graph.ladybug :as ladybug]
[app.graph.project.document :as project.document] [app.graph.projection.document :as projection.document]
[app.graph.project.transforms :as project.transforms] [app.graph.projection.transforms :as projection.transforms]
[app.graph.schema.nodes :as nodes] [app.graph.schema.nodes :as nodes]
[app.graph.sync :as sync] [app.graph.sync :as sync]
[clojure.test :as t])) [clojure.test :as t]))
@ -133,11 +133,11 @@
Returns the projection, which is also what the sync index is built from." Returns the projection, which is also what the sync index is built from."
[conn data file] [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)) (ladybug/exec-on-connection! conn (nodes/ddl-statements))
(arrow/with-allocator! (arrow/with-allocator!
(fn [allocator] (arrow/load-projection! conn projection 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)) projection))
(defn- rel-tables (defn- rel-tables