@synap-core/workspace-templates 0.76.0 → 0.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +219 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__fixtures__/dev-facts.merged.json +87 -0
- package/src/builder.yaml +80 -0
- package/src/content-os.relations.template.test.ts +83 -0
- package/src/content-os.yaml +66 -0
- package/src/dev-flow-change.template.test.ts +129 -0
- package/src/templates.ts +219 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synap-core/workspace-templates",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Canonical workspace definitions — YAML source + typed exports for browser, backend, CLI, and marketplace",
|
|
6
6
|
"license": "PolyForm-Noncommercial-1.0.0",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_about": "Recorded 3 Dec 2026 (lane R3, session 1286c739). merged = the dev.pr_merged fact the org flow 'GitHub pull requests and checks -> dev-loop facts' (43ae349d, node pr-merged) records for Synap-core/backend#1530, its mapping applied to GitHub's real payload (read 15:40 UTC), body cut to its first line; the pod recorded this fact at 11:21:20 UTC, 68 s after the merge (get_timeline). changes = six change entities on the pod read between 15:20 and 15:25 UTC: backend#1530 Checks running (merged 11:20:12, its run of 'A pull request moves its change' at 11:22:37 linked it and moved nothing), #1540 Ready to merge (merged 14:59:27, moved to Merged at 15:28:38), #1536 Checks running (merged 15:24:50, Merged at 15:53:13), synap-bridge#4 Checks running (merged 15:00:26, Merged at 15:30:44), #1538 Merged, #1532 Checks running (open then).",
|
|
3
|
+
"facts": {
|
|
4
|
+
"merged": {
|
|
5
|
+
"eventType": "dev.pr_merged",
|
|
6
|
+
"data": {
|
|
7
|
+
"repo": "Synap-core/backend",
|
|
8
|
+
"number": 1530,
|
|
9
|
+
"url": "https://github.com/Synap-core/backend/pull/1530",
|
|
10
|
+
"sha": "1afe5c6cb939730dfa47912b58e8f51ac92f11f5",
|
|
11
|
+
"branch": "feat/proposed-entity-layer",
|
|
12
|
+
"base": "main",
|
|
13
|
+
"intoDefault": true,
|
|
14
|
+
"title": "feat(pod-admin): a pending entity request draws the entity, its change marked on it",
|
|
15
|
+
"body": "Pod session: 4b724dc3-8d8f-403f-90e2-c256cf775d9c (wave 7 slice 2; design fe9803a4 §2.4, §6.3, §6.4; F1-F8 founder-validated 1 Dec 2026)",
|
|
16
|
+
"action": "closed",
|
|
17
|
+
"merged": true,
|
|
18
|
+
"headSha": "11db4c9a26c9faa3aa4d9b578d09efc51089daad",
|
|
19
|
+
"author": "Antoinesrvt",
|
|
20
|
+
"source": "github-webhook",
|
|
21
|
+
"subjectRef": "Synap-core/backend#1530"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"changes": [
|
|
26
|
+
{
|
|
27
|
+
"id": "a0fe8e2e-1033-41c8-90a4-a6fb8d8d5d4f",
|
|
28
|
+
"properties": {
|
|
29
|
+
"prRef": "Synap-core/backend#1530",
|
|
30
|
+
"repo": "Synap-core/backend",
|
|
31
|
+
"number": 1530,
|
|
32
|
+
"headSha": "11db4c9a26c9faa3aa4d9b578d09efc51089daad",
|
|
33
|
+
"changeStatus": "checks"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "f778b630-6dec-4dba-84f0-254db4bb321c",
|
|
38
|
+
"properties": {
|
|
39
|
+
"prRef": "Synap-core/backend#1532",
|
|
40
|
+
"repo": "Synap-core/backend",
|
|
41
|
+
"number": 1532,
|
|
42
|
+
"headSha": "b92dfcc687f713d0d94d4e360038185faab00b75",
|
|
43
|
+
"changeStatus": "checks"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "862bf8be-5d4a-4f74-8701-73125a287cf4",
|
|
48
|
+
"properties": {
|
|
49
|
+
"prRef": "Synap-core/backend#1536",
|
|
50
|
+
"repo": "Synap-core/backend",
|
|
51
|
+
"number": 1536,
|
|
52
|
+
"headSha": "5bc481c67775b1f0d3f23925db3a41b75b672e30",
|
|
53
|
+
"changeStatus": "checks"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"id": "eb92ff8e-f17b-4e54-8710-1bd3dc91e411",
|
|
58
|
+
"properties": {
|
|
59
|
+
"prRef": "Synap-core/backend#1538",
|
|
60
|
+
"repo": "Synap-core/backend",
|
|
61
|
+
"number": 1538,
|
|
62
|
+
"headSha": "83c920fd27845a5380ec2ceb08bb76e47e27b8a2",
|
|
63
|
+
"changeStatus": "merged"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"id": "bf55fb27-f8e6-47d3-82ba-964ff8798c91",
|
|
68
|
+
"properties": {
|
|
69
|
+
"prRef": "Synap-core/backend#1540",
|
|
70
|
+
"repo": "Synap-core/backend",
|
|
71
|
+
"number": 1540,
|
|
72
|
+
"headSha": "64440901fb81a3057850dcc4aa093e1f38dd2ded",
|
|
73
|
+
"changeStatus": "ready"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"id": "e5eee4d5-db18-4506-ac0c-2f0d0715248e",
|
|
78
|
+
"properties": {
|
|
79
|
+
"prRef": "Synap-core/synap-bridge#4",
|
|
80
|
+
"repo": "Synap-core/synap-bridge",
|
|
81
|
+
"number": 4,
|
|
82
|
+
"headSha": "af018bee8c6fa15931087e2adcedf5a46c1ae07c",
|
|
83
|
+
"changeStatus": "checks"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
package/src/builder.yaml
CHANGED
|
@@ -1619,6 +1619,7 @@ profiles:
|
|
|
1619
1619
|
label: App
|
|
1620
1620
|
valueType: entity_id
|
|
1621
1621
|
targetProfileSlug: devplane_app
|
|
1622
|
+
relation: belongs_to
|
|
1622
1623
|
inputType: entity_select
|
|
1623
1624
|
description: The app this design is for (one devplane_app, filed into the design's project). The Design app lists an app's designs by it; target-surface stays the screen's name.
|
|
1624
1625
|
- slug: design-scope
|
|
@@ -1663,6 +1664,7 @@ profiles:
|
|
|
1663
1664
|
label: Screenshot
|
|
1664
1665
|
valueType: entity_id
|
|
1665
1666
|
targetProfileSlug: file
|
|
1667
|
+
relation: references
|
|
1666
1668
|
inputType: entity_select
|
|
1667
1669
|
description: A render of the design, for review at a glance.
|
|
1668
1670
|
- slug: motion
|
|
@@ -1764,6 +1766,7 @@ profiles:
|
|
|
1764
1766
|
label: Screenshot
|
|
1765
1767
|
valueType: entity_id
|
|
1766
1768
|
targetProfileSlug: file
|
|
1769
|
+
relation: references
|
|
1767
1770
|
inputType: entity_select
|
|
1768
1771
|
description: A render of its main story, for review at a glance.
|
|
1769
1772
|
- slug: props-summary
|
|
@@ -1785,6 +1788,7 @@ profiles:
|
|
|
1785
1788
|
label: App
|
|
1786
1789
|
valueType: entity_id
|
|
1787
1790
|
targetProfileSlug: devplane_app
|
|
1791
|
+
relation: belongs_to
|
|
1788
1792
|
inputType: entity_select
|
|
1789
1793
|
description: The app (devplane_app) whose Storybook it comes from.
|
|
1790
1794
|
- slug: source-hash
|
|
@@ -4448,6 +4452,82 @@ automations:
|
|
|
4448
4452
|
- { id: has-change--no-session-yet, source: has-change, target: no-session-yet, sourceHandle: "yes" }
|
|
4449
4453
|
- { id: no-session-yet--name-session, source: no-session-yet, target: name-session, sourceHandle: "yes" }
|
|
4450
4454
|
|
|
4455
|
+
# A merged pull request settles its change, whatever happened to its run of
|
|
4456
|
+
# "A pull request moves its change" (lane R3, 3 Dec 2026, session 1286c739).
|
|
4457
|
+
# Measured that day: backend#1530 merged at 11:20 and its change stayed
|
|
4458
|
+
# Checks running (the run of its merge event linked the change and moved
|
|
4459
|
+
# nothing). So the merge reaches the change a second, independent way: the
|
|
4460
|
+
# `dev.pr_merged` fact the org-wide source "GitHub" (github-pr-events)
|
|
4461
|
+
# records, the fact the Ship page folds (`GET /work-release`). It only ever
|
|
4462
|
+
# writes Merged, on a change not already Merged; a pull request with no
|
|
4463
|
+
# change moves nothing. Every "nothing to do" ends on a condition, never a
|
|
4464
|
+
# guard (a guard stop posts a run summary). It listens to `dev.pr_merged`
|
|
4465
|
+
# only (a few dozen runs a day), never `dev.*`: each run of a flow that
|
|
4466
|
+
# writes an entity opens a session and waits on the pod's one automation
|
|
4467
|
+
# queue, which already ran up to ~30 min late that afternoon.
|
|
4468
|
+
- key: merged-pull-request-settles-change
|
|
4469
|
+
name: A merged pull request settles its change
|
|
4470
|
+
description: >-
|
|
4471
|
+
A dev.pr_merged fact into the default branch moves the pull request's
|
|
4472
|
+
change to Merged when GitHub's own event did not: a change already
|
|
4473
|
+
Merged, or a pull request with no change, moves nothing.
|
|
4474
|
+
triggerType: event
|
|
4475
|
+
triggerConfig:
|
|
4476
|
+
eventPattern: dev.pr_merged
|
|
4477
|
+
status: active
|
|
4478
|
+
flow:
|
|
4479
|
+
nodes:
|
|
4480
|
+
- id: t
|
|
4481
|
+
type: trigger
|
|
4482
|
+
position: { x: 0, y: 0 }
|
|
4483
|
+
data:
|
|
4484
|
+
label: A pull request merged
|
|
4485
|
+
triggerType: event
|
|
4486
|
+
config:
|
|
4487
|
+
eventPattern: dev.pr_merged
|
|
4488
|
+
- id: into-default
|
|
4489
|
+
type: condition
|
|
4490
|
+
position: { x: 0, y: 120 }
|
|
4491
|
+
data:
|
|
4492
|
+
label: It merged into the default branch
|
|
4493
|
+
expression: trigger.payload.data.intoDefault == "true"
|
|
4494
|
+
- id: find
|
|
4495
|
+
type: query
|
|
4496
|
+
position: { x: 0, y: 240 }
|
|
4497
|
+
data:
|
|
4498
|
+
label: Its change
|
|
4499
|
+
profileSlug: change
|
|
4500
|
+
limit: 1
|
|
4501
|
+
filter: '{"prRef": "{{trigger.payload.data.repo}}#{{trigger.payload.data.number}}"}'
|
|
4502
|
+
- id: has-change
|
|
4503
|
+
type: condition
|
|
4504
|
+
position: { x: 0, y: 360 }
|
|
4505
|
+
data:
|
|
4506
|
+
label: It has a change
|
|
4507
|
+
expression: steps.find.output.count >= 1
|
|
4508
|
+
- id: not-merged
|
|
4509
|
+
type: condition
|
|
4510
|
+
position: { x: 0, y: 480 }
|
|
4511
|
+
data:
|
|
4512
|
+
label: Its change is not Merged yet
|
|
4513
|
+
expression: steps.find.output.entities[0].properties.changeStatus != "merged"
|
|
4514
|
+
- id: settle
|
|
4515
|
+
type: output
|
|
4516
|
+
position: { x: 0, y: 600 }
|
|
4517
|
+
data:
|
|
4518
|
+
label: The change is Merged
|
|
4519
|
+
outputType: entity_update
|
|
4520
|
+
config:
|
|
4521
|
+
entityId: "{{steps.find.output.entities[0].id}}"
|
|
4522
|
+
properties:
|
|
4523
|
+
changeStatus: merged
|
|
4524
|
+
edges:
|
|
4525
|
+
- { id: t--into-default, source: t, target: into-default }
|
|
4526
|
+
- { id: into-default--find, source: into-default, target: find, sourceHandle: "yes" }
|
|
4527
|
+
- { id: find--has-change, source: find, target: has-change }
|
|
4528
|
+
- { id: has-change--not-merged, source: has-change, target: not-merged, sourceHandle: "yes" }
|
|
4529
|
+
- { id: not-merged--settle, source: not-merged, target: settle, sourceHandle: "yes" }
|
|
4530
|
+
|
|
4451
4531
|
# The skills every AI working in Dev is told exist (installed by the
|
|
4452
4532
|
# `require` dependencies above; this is the LINK, that is the INSTALL).
|
|
4453
4533
|
skills:
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every entity-id property of Content OS declares the relation it creates (REL1,
|
|
3
|
+
* 4 Dec 2026; backend#1498: a template property's `relation` makes writing it a
|
|
4
|
+
* link, and the space health read flags `relation-as-property` for one that does
|
|
5
|
+
* not). Read from the YAML SOURCE.
|
|
6
|
+
*
|
|
7
|
+
* The six left without a relation are NAMED here, each because no existing
|
|
8
|
+
* relation type fits (extend, never twin: a new type is the founder's call) or
|
|
9
|
+
* because two properties of one kind would need the same type (one property per
|
|
10
|
+
* relation per kind). Adding a relation to one removes it from this list: the
|
|
11
|
+
* test fails until it does, so the list can only shrink.
|
|
12
|
+
*/
|
|
13
|
+
import { describe, expect, it } from "vitest";
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { load } from "js-yaml";
|
|
18
|
+
import type { WorkspaceYaml } from "./types.js";
|
|
19
|
+
|
|
20
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
21
|
+
const read = (f: string) => load(readFileSync(join(dir, f), "utf8")) as WorkspaceYaml;
|
|
22
|
+
const contentOs = read("content-os.yaml");
|
|
23
|
+
const builder = read("builder.yaml");
|
|
24
|
+
|
|
25
|
+
const entityIdProps = (t: WorkspaceYaml) =>
|
|
26
|
+
t.profiles.flatMap((p) =>
|
|
27
|
+
p.properties
|
|
28
|
+
.filter((pr) => pr.valueType === "entity_id")
|
|
29
|
+
.map((pr) => ({ at: `${p.slug}.${pr.slug}`, relation: (pr as { relation?: string }).relation }))
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const QUESTIONS = [
|
|
33
|
+
"post.post-account", // post -> platform: no `published_on` type
|
|
34
|
+
"post.post-copy-of", // post -> post: `derived_from` is taken by post.derived-from (one per kind)
|
|
35
|
+
"pillar.pillar-pain-ref", // pillar -> pain-point: no `addresses` type
|
|
36
|
+
"offer.offer-positioning", // offer -> positioning: no type
|
|
37
|
+
"content-composition.project-zip", // composition -> file twice (zip, mp4): needs two types
|
|
38
|
+
"content-composition.render-mp4",
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
describe("Content OS: a property that holds an entity id creates a link", () => {
|
|
42
|
+
const props = entityIdProps(contentOs);
|
|
43
|
+
|
|
44
|
+
it("finds the properties it guards (non-vacuity)", () => {
|
|
45
|
+
expect(props.length).toBeGreaterThanOrEqual(28);
|
|
46
|
+
expect(props.filter((p) => p.relation).length).toBeGreaterThanOrEqual(22);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("leaves only the named questions without a relation", () => {
|
|
50
|
+
expect(props.filter((p) => !p.relation).map((p) => p.at).sort()).toEqual([...QUESTIONS].sort());
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("each relation names an edge the template declares or a dependency's type", () => {
|
|
54
|
+
const own = new Set((contentOs.entityLinks ?? []).map((l) => l.type));
|
|
55
|
+
for (const p of props.filter((x) => x.relation))
|
|
56
|
+
expect(
|
|
57
|
+
own.has(p.relation!) || ["targets", "affects", "uses", "derived_from", "references"].includes(p.relation!),
|
|
58
|
+
p.at
|
|
59
|
+
).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("the edge each property creates is declared as a link between its kinds", () => {
|
|
63
|
+
const links = new Set((contentOs.entityLinks ?? []).map((l) => `${l.sourceProfileSlug}>${l.targetProfileSlug}:${l.type}`));
|
|
64
|
+
for (const at of [
|
|
65
|
+
"newsletter>campaign:part_of_campaign",
|
|
66
|
+
"newsletter>pillar:belongs_to_pillar",
|
|
67
|
+
"newsletter>sponsor:sponsored_by",
|
|
68
|
+
"series>pillar:belongs_to_pillar",
|
|
69
|
+
"idea>journey-stage:at_journey_stage",
|
|
70
|
+
])
|
|
71
|
+
expect(links.has(at), at).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
describe("Builder: the design's app and screenshot create links", () => {
|
|
76
|
+
it("ui-design and ui-component declare belongs_to (app) and references (screenshot)", () => {
|
|
77
|
+
const by = Object.fromEntries(entityIdProps(builder).map((p) => [p.at, p.relation]));
|
|
78
|
+
expect(by["ui-design.design-app"]).toBe("belongs_to");
|
|
79
|
+
expect(by["ui-design.screenshot"]).toBe("references");
|
|
80
|
+
expect(by["ui-component.design-app"]).toBe("belongs_to");
|
|
81
|
+
expect(by["ui-component.screenshot"]).toBe("references");
|
|
82
|
+
});
|
|
83
|
+
});
|
package/src/content-os.yaml
CHANGED
|
@@ -343,6 +343,7 @@ profiles:
|
|
|
343
343
|
label: Sponsor
|
|
344
344
|
valueType: entity_id
|
|
345
345
|
targetProfileSlug: sponsor
|
|
346
|
+
relation: sponsored_by
|
|
346
347
|
inputType: entity_select
|
|
347
348
|
# ── The journey layer — BOTH axes optional, and independent ────────────
|
|
348
349
|
# `post-stage` is the AUDIENCE axis (unordered: where is the reader), and
|
|
@@ -355,6 +356,7 @@ profiles:
|
|
|
355
356
|
label: Journey Stage
|
|
356
357
|
valueType: entity_id
|
|
357
358
|
targetProfileSlug: journey-stage
|
|
359
|
+
relation: at_journey_stage
|
|
358
360
|
inputType: entity_select
|
|
359
361
|
- slug: post-series
|
|
360
362
|
label: Series
|
|
@@ -382,6 +384,7 @@ profiles:
|
|
|
382
384
|
label: Offer
|
|
383
385
|
valueType: entity_id
|
|
384
386
|
targetProfileSlug: offer
|
|
387
|
+
relation: teaches_toward
|
|
385
388
|
inputType: entity_select
|
|
386
389
|
- slug: publish-date
|
|
387
390
|
label: Publish Date
|
|
@@ -423,6 +426,7 @@ profiles:
|
|
|
423
426
|
label: Repurposed From
|
|
424
427
|
valueType: entity_id
|
|
425
428
|
targetProfileSlug: post
|
|
429
|
+
relation: derived_from
|
|
426
430
|
inputType: entity_select
|
|
427
431
|
# The person's own words, verbatim (B7). Stored by capture before it was
|
|
428
432
|
# declared; declared so it can be queried and validated.
|
|
@@ -607,6 +611,7 @@ profiles:
|
|
|
607
611
|
label: Journey Stage
|
|
608
612
|
valueType: entity_id
|
|
609
613
|
targetProfileSlug: journey-stage
|
|
614
|
+
relation: at_journey_stage
|
|
610
615
|
inputType: entity_select
|
|
611
616
|
# Where it came from (`source:dump`, `source:interview`, …), as on `post-tags`.
|
|
612
617
|
- slug: idea-tags
|
|
@@ -667,6 +672,7 @@ profiles:
|
|
|
667
672
|
label: Audience
|
|
668
673
|
valueType: entity_id
|
|
669
674
|
targetProfileSlug: audience
|
|
675
|
+
relation: targets
|
|
670
676
|
inputType: entity_select
|
|
671
677
|
- slug: pillar-pain-ref
|
|
672
678
|
label: Pain Addressed
|
|
@@ -755,6 +761,7 @@ profiles:
|
|
|
755
761
|
label: Audience
|
|
756
762
|
valueType: entity_id
|
|
757
763
|
targetProfileSlug: audience
|
|
764
|
+
relation: targets
|
|
758
765
|
inputType: entity_select
|
|
759
766
|
- slug: belief-installed
|
|
760
767
|
label: Now Believes
|
|
@@ -821,6 +828,7 @@ profiles:
|
|
|
821
828
|
label: Pillar
|
|
822
829
|
valueType: entity_id
|
|
823
830
|
targetProfileSlug: pillar
|
|
831
|
+
relation: belongs_to_pillar
|
|
824
832
|
inputType: entity_select
|
|
825
833
|
|
|
826
834
|
# `platform` is the ONE pod-wide publishing-account *vocabulary*. `scope: shared`
|
|
@@ -1023,16 +1031,19 @@ profiles:
|
|
|
1023
1031
|
label: Sponsor
|
|
1024
1032
|
valueType: entity_id
|
|
1025
1033
|
targetProfileSlug: sponsor
|
|
1034
|
+
relation: sponsored_by
|
|
1026
1035
|
inputType: entity_select
|
|
1027
1036
|
- slug: newsletter-campaign
|
|
1028
1037
|
label: Campaign
|
|
1029
1038
|
valueType: entity_id
|
|
1030
1039
|
targetProfileSlug: campaign
|
|
1040
|
+
relation: part_of_campaign
|
|
1031
1041
|
inputType: entity_select
|
|
1032
1042
|
- slug: newsletter-pillar
|
|
1033
1043
|
label: Primary Pillar
|
|
1034
1044
|
valueType: entity_id
|
|
1035
1045
|
targetProfileSlug: pillar
|
|
1046
|
+
relation: belongs_to_pillar
|
|
1036
1047
|
inputType: entity_select
|
|
1037
1048
|
- slug: newsletter-tags
|
|
1038
1049
|
label: Tags
|
|
@@ -1225,6 +1236,7 @@ profiles:
|
|
|
1225
1236
|
label: Audience
|
|
1226
1237
|
valueType: entity_id
|
|
1227
1238
|
targetProfileSlug: audience
|
|
1239
|
+
relation: affects
|
|
1228
1240
|
inputType: entity_select
|
|
1229
1241
|
- slug: evidence
|
|
1230
1242
|
label: Evidence
|
|
@@ -1318,6 +1330,7 @@ profiles:
|
|
|
1318
1330
|
label: Audience
|
|
1319
1331
|
valueType: entity_id
|
|
1320
1332
|
targetProfileSlug: audience
|
|
1333
|
+
relation: targets
|
|
1321
1334
|
inputType: entity_select
|
|
1322
1335
|
- slug: offer-positioning
|
|
1323
1336
|
label: Positioning
|
|
@@ -1503,6 +1516,7 @@ profiles:
|
|
|
1503
1516
|
label: Template
|
|
1504
1517
|
valueType: entity_id
|
|
1505
1518
|
targetProfileSlug: brand-template
|
|
1519
|
+
relation: uses
|
|
1506
1520
|
inputType: entity_select
|
|
1507
1521
|
description: The reusable brand-template shell this started from.
|
|
1508
1522
|
- slug: recipe-ref
|
|
@@ -1659,6 +1673,7 @@ profiles:
|
|
|
1659
1673
|
label: Cut from take
|
|
1660
1674
|
valueType: entity_id
|
|
1661
1675
|
targetProfileSlug: content-asset
|
|
1676
|
+
relation: derived_from
|
|
1662
1677
|
inputType: entity_select
|
|
1663
1678
|
- slug: source-start
|
|
1664
1679
|
label: Starts at (s)
|
|
@@ -1718,6 +1733,7 @@ profiles:
|
|
|
1718
1733
|
label: Output
|
|
1719
1734
|
valueType: entity_id
|
|
1720
1735
|
targetProfileSlug: file
|
|
1736
|
+
relation: references
|
|
1721
1737
|
inputType: entity_select
|
|
1722
1738
|
- slug: output-url
|
|
1723
1739
|
label: Output URL
|
|
@@ -2035,6 +2051,56 @@ profileEntityBentoTemplates:
|
|
|
2035
2051
|
|
|
2036
2052
|
# Editorial graph: connect posts to campaign / pillar / sponsor
|
|
2037
2053
|
entityLinks:
|
|
2054
|
+
# REL1 (4 Dec 2026): the edges the properties above create (each property
|
|
2055
|
+
# declares its relation; the pair is declared here so the graph knows it).
|
|
2056
|
+
- sourceProfileSlug: idea
|
|
2057
|
+
targetProfileSlug: journey-stage
|
|
2058
|
+
type: at_journey_stage
|
|
2059
|
+
label: Journey Stage
|
|
2060
|
+
- sourceProfileSlug: pillar
|
|
2061
|
+
targetProfileSlug: audience
|
|
2062
|
+
type: targets
|
|
2063
|
+
label: Audience
|
|
2064
|
+
- sourceProfileSlug: journey-stage
|
|
2065
|
+
targetProfileSlug: audience
|
|
2066
|
+
type: targets
|
|
2067
|
+
label: Audience
|
|
2068
|
+
- sourceProfileSlug: series
|
|
2069
|
+
targetProfileSlug: pillar
|
|
2070
|
+
type: belongs_to_pillar
|
|
2071
|
+
label: Pillar
|
|
2072
|
+
- sourceProfileSlug: newsletter
|
|
2073
|
+
targetProfileSlug: sponsor
|
|
2074
|
+
type: sponsored_by
|
|
2075
|
+
label: Sponsor
|
|
2076
|
+
- sourceProfileSlug: newsletter
|
|
2077
|
+
targetProfileSlug: campaign
|
|
2078
|
+
type: part_of_campaign
|
|
2079
|
+
label: Campaign
|
|
2080
|
+
- sourceProfileSlug: newsletter
|
|
2081
|
+
targetProfileSlug: pillar
|
|
2082
|
+
type: belongs_to_pillar
|
|
2083
|
+
label: Pillar
|
|
2084
|
+
- sourceProfileSlug: offer
|
|
2085
|
+
targetProfileSlug: audience
|
|
2086
|
+
type: targets
|
|
2087
|
+
label: Audience
|
|
2088
|
+
- sourceProfileSlug: content-composition
|
|
2089
|
+
targetProfileSlug: brand-template
|
|
2090
|
+
type: uses
|
|
2091
|
+
label: Template
|
|
2092
|
+
- sourceProfileSlug: content-asset
|
|
2093
|
+
targetProfileSlug: content-asset
|
|
2094
|
+
type: derived_from
|
|
2095
|
+
label: Taken from
|
|
2096
|
+
- sourceProfileSlug: pain-point
|
|
2097
|
+
targetProfileSlug: audience
|
|
2098
|
+
type: affects
|
|
2099
|
+
label: Audience
|
|
2100
|
+
- sourceProfileSlug: render-job
|
|
2101
|
+
targetProfileSlug: file
|
|
2102
|
+
type: references
|
|
2103
|
+
label: Output file
|
|
2038
2104
|
- sourceProfileSlug: post
|
|
2039
2105
|
targetProfileSlug: campaign
|
|
2040
2106
|
type: part_of_campaign
|
|
@@ -360,3 +360,132 @@ describe("A pull request names its change's session", () => {
|
|
|
360
360
|
expect(runFlow(without("has-change"), recorded.facts.namesSession, none)).not.toEqual([]);
|
|
361
361
|
});
|
|
362
362
|
});
|
|
363
|
+
|
|
364
|
+
describe("A merged pull request settles its change", () => {
|
|
365
|
+
const settles = (builder.automations ?? []).find((a: any) => a.key === "merged-pull-request-settles-change");
|
|
366
|
+
type Flow = { nodes: FlowNode[]; edges: FlowEdge[] };
|
|
367
|
+
type Fact = { eventType: string; data: Record<string, any> };
|
|
368
|
+
type Change = { id: string; properties: Record<string, unknown> };
|
|
369
|
+
const flow: Flow = settles?.flow;
|
|
370
|
+
const recorded = JSON.parse(
|
|
371
|
+
readFileSync(new URL("./__fixtures__/dev-facts.merged.json", import.meta.url), "utf8")
|
|
372
|
+
) as { facts: { merged: Fact }; changes: Change[] };
|
|
373
|
+
const fact = recorded.facts.merged;
|
|
374
|
+
const change1530 = recorded.changes.find((c) => c.properties.prRef === "Synap-core/backend#1530")!;
|
|
375
|
+
|
|
376
|
+
/** `{{a.b[0].c}}` read the way the pod reads it: a miss or a null renders "". */
|
|
377
|
+
function lookup(path: string, ctx: Record<string, unknown>): unknown {
|
|
378
|
+
let cur: any = ctx;
|
|
379
|
+
for (const part of path.trim().replace(/\[(\d+)\]/g, ".$1").split(".")) {
|
|
380
|
+
if (cur == null || typeof cur !== "object") return undefined;
|
|
381
|
+
cur = cur[part];
|
|
382
|
+
}
|
|
383
|
+
return cur;
|
|
384
|
+
}
|
|
385
|
+
const render = (t: string, ctx: Record<string, unknown>) =>
|
|
386
|
+
t.replace(/\{\{(.+?)\}\}/g, (_, p: string) => {
|
|
387
|
+
const v = lookup(p, ctx);
|
|
388
|
+
return v == null ? "" : typeof v === "object" ? JSON.stringify(v) : String(v);
|
|
389
|
+
});
|
|
390
|
+
/** The pod's condition grammar (condition-eval.ts) for the operators this flow uses: the left side renders to a string. */
|
|
391
|
+
function condition(expr: string, ctx: Record<string, unknown>): boolean {
|
|
392
|
+
const [, leftPath, op, rightRaw] = /^(.+?)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/.exec(expr)!;
|
|
393
|
+
const r = rightRaw.trim();
|
|
394
|
+
const right: string | number = /^(["']).*\1$/.test(r) ? r.slice(1, -1) : r !== "" && !isNaN(Number(r)) ? Number(r) : r;
|
|
395
|
+
const leftStr = render(`{{${leftPath}}}`, ctx);
|
|
396
|
+
const left = typeof right === "number" ? (leftStr === "" ? NaN : Number(leftStr)) : leftStr;
|
|
397
|
+
switch (op) {
|
|
398
|
+
case "==": case "===": return left === right;
|
|
399
|
+
case "!=": case "!==": return left !== right;
|
|
400
|
+
case ">=": return Number(left) >= Number(right);
|
|
401
|
+
default: throw new Error(`operator ${op} is not simulated`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
/** Walk the flow on one fact: what it writes (entity_update), given the changes on the pod. */
|
|
405
|
+
function runFlow(f: Flow, input: Fact, changes: Change[]) {
|
|
406
|
+
const ctx: Record<string, any> = { trigger: { payload: { eventType: input.eventType, data: input.data } }, steps: {} };
|
|
407
|
+
const writes: { entityId: string; properties: Record<string, string> }[] = [];
|
|
408
|
+
const queue = f.nodes.filter((n) => n.type === "trigger").map((n) => n.id);
|
|
409
|
+
while (queue.length) {
|
|
410
|
+
const next = queue.shift()!;
|
|
411
|
+
const n = f.nodes.find((x) => x.id === next)!;
|
|
412
|
+
let handle: string | undefined;
|
|
413
|
+
if (n.type === "condition") {
|
|
414
|
+
handle = condition(n.data.expression, ctx) ? "yes" : "no";
|
|
415
|
+
ctx.steps[n.id] = { output: { result: handle === "yes" } };
|
|
416
|
+
} else if (n.type === "query") {
|
|
417
|
+
const filter = JSON.parse(render(n.data.filter, ctx)) as Record<string, string>;
|
|
418
|
+
const hits = changes.filter((c) => Object.entries(filter).every(([k, v]) => String(c.properties[k]) === v));
|
|
419
|
+
const entities = hits.slice(0, n.data.limit);
|
|
420
|
+
ctx.steps[n.id] = { output: { count: entities.length, entities } };
|
|
421
|
+
} else if (n.type === "output") {
|
|
422
|
+
expect(n.data.outputType).toBe("entity_update");
|
|
423
|
+
const props = Object.fromEntries(
|
|
424
|
+
Object.entries(n.data.config.properties as Record<string, string>).map(([k, v]) => [k, render(v, ctx)])
|
|
425
|
+
);
|
|
426
|
+
writes.push({ entityId: render(n.data.config.entityId, ctx), properties: props });
|
|
427
|
+
} else if (n.type !== "trigger") {
|
|
428
|
+
throw new Error(`node type ${n.type} is not simulated`);
|
|
429
|
+
}
|
|
430
|
+
for (const e of f.edges.filter((e) => e.source === n.id)) {
|
|
431
|
+
if (e.sourceHandle === undefined || e.sourceHandle === handle) queue.push(e.target);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return writes;
|
|
435
|
+
}
|
|
436
|
+
/** The flow with one node cut out, its predecessor wired straight to its successors. */
|
|
437
|
+
function without(id: string): Flow {
|
|
438
|
+
const into = flow.edges.filter((e) => e.target === id);
|
|
439
|
+
const out = flow.edges.filter((e) => e.source === id);
|
|
440
|
+
const kept = flow.edges.filter((e) => e.source !== id && e.target !== id);
|
|
441
|
+
const bridged = into.flatMap((i) => out.map((o) => ({ ...i, id: `${i.id}~${o.id}`, target: o.target })));
|
|
442
|
+
return { nodes: flow.nodes.filter((n) => n.id !== id), edges: [...kept, ...bridged] };
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
it("listens to dev.pr_merged only, passes the flow validator, and writes only Merged", () => {
|
|
446
|
+
expect(settles.triggerType).toBe("event");
|
|
447
|
+
// Not dev.*: every run of an entity-writing flow opens a session on the pod's one automation queue.
|
|
448
|
+
expect(settles.triggerConfig).toEqual({ eventPattern: "dev.pr_merged" });
|
|
449
|
+
expect(flow.nodes.find((n) => n.type === "trigger")!.data.config).toEqual({ eventPattern: "dev.pr_merged" });
|
|
450
|
+
expect(validateFlowDefinition(flow).errors).toEqual([]);
|
|
451
|
+
const outs = flow.nodes.filter((n) => n.type === "output");
|
|
452
|
+
expect(outs.map((n) => [n.data.outputType, n.data.config.properties])).toEqual([
|
|
453
|
+
["entity_update", { changeStatus: "merged" }],
|
|
454
|
+
]);
|
|
455
|
+
expect(options).toContain("merged");
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
it("finds the change by the prRef 'A pull request moves its change' writes", () => {
|
|
459
|
+
const find = flow.nodes.find((n) => n.type === "query")!;
|
|
460
|
+
expect(find.data.profileSlug).toBe("change");
|
|
461
|
+
expect(typeof find.data.filter).toBe("string");
|
|
462
|
+
const written = (node("upsert").data.config.properties.prRef as string).replace(/\{\{[^}]*\}\}/g, "x");
|
|
463
|
+
expect((JSON.parse(find.data.filter).prRef as string).replace(/\{\{[^}]*\}\}/g, "x")).toBe(written);
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
it("the recorded merge of backend#1530 settles its change, stuck in Checks running, and only it", () => {
|
|
467
|
+
expect(fact.eventType).toBe("dev.pr_merged");
|
|
468
|
+
expect(change1530.properties.changeStatus).toBe("checks");
|
|
469
|
+
expect(runFlow(flow, fact, recorded.changes)).toEqual([
|
|
470
|
+
{ entityId: change1530.id, properties: { changeStatus: "merged" } },
|
|
471
|
+
]);
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
it("a change already Merged moves nothing (and the case rules out dropping that condition)", () => {
|
|
475
|
+
const done = recorded.changes.map((c) => ({ ...c, properties: { ...c.properties, changeStatus: "merged" } }));
|
|
476
|
+
expect(runFlow(flow, fact, done)).toEqual([]);
|
|
477
|
+
expect(runFlow(without("not-merged"), fact, done)).not.toEqual([]);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
it("a pull request with no change moves nothing (and the case rules out dropping that condition)", () => {
|
|
481
|
+
const none = recorded.changes.filter((c) => c.id !== change1530.id);
|
|
482
|
+
expect(runFlow(flow, fact, none)).toEqual([]);
|
|
483
|
+
expect(runFlow(without("has-change"), fact, none)).not.toEqual([]);
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
it("a merge into another branch moves nothing (and the case rules out dropping that condition)", () => {
|
|
487
|
+
const elsewhere = { ...fact, data: { ...fact.data, base: "release", intoDefault: false } };
|
|
488
|
+
expect(runFlow(flow, elsewhere, recorded.changes)).toEqual([]);
|
|
489
|
+
expect(runFlow(without("into-default"), elsewhere, recorded.changes)).not.toEqual([]);
|
|
490
|
+
});
|
|
491
|
+
});
|