@synap-core/workspace-templates 0.75.0 → 0.76.1

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/src/crm.yaml CHANGED
@@ -2662,7 +2662,8 @@ playbooks:
2662
2662
  documents.get, lens.page, sessions.get, playbook.process,
2663
2663
  playbook.scorecard, project.pillars, views.get, views.execute,
2664
2664
  profiles.get, propertyDefs.list, lifecycle.get, graph.of,
2665
- automations.list, automations.runs, playbooks.list, surfaces.of) and only that
2665
+ automations.list, automations.runs, playbooks.list, surfaces.of,
2666
+ connections.list, capabilities.list) and only that
2666
2667
  op's params; the host stamps the space, so never put a workspaceId, a token, a pod URL
2667
2668
  or a fetch in the page. What the bridge reads stays live: query it in
2668
2669
  the page, never
@@ -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
+ });
@@ -3,4 +3,4 @@ export declare const FRAME_HOST_MODULES: readonly string[];
3
3
  export declare const FRAME_HOST_MODULE_RE: RegExp;
4
4
  export declare function hostRequiresIn(code: string): string[];
5
5
  export declare const FRAME_KIT_MODULE: string;
6
- export declare function kitImportsIn(code: string): string[];
6
+ export declare function kitImportsIn(code: string, specifier?: string): string[];
@@ -24,10 +24,13 @@ export const FRAME_KIT_MODULE = '@synap/kit';
24
24
  * Every name a bundle imports from the kit: `import{A as b,C}from"@synap/kit"`
25
25
  * → `['A', 'C']`. A namespace or default import of the kit is returned as
26
26
  * `*` / `default` so the build can refuse it (its names cannot be checked).
27
+ * `specifier`: another host module read the same way (a kit layer,
28
+ * `@synap/kit/editor`).
27
29
  */
28
- export function kitImportsIn(code) {
30
+ export function kitImportsIn(code, specifier = FRAME_KIT_MODULE) {
29
31
  const names = new Set();
30
- for (const m of code.matchAll(/import\s*([^;'"]*?)\s*from\s*["']@synap\/kit["']/g)) {
32
+ const quoted = specifier.replace(/[/.\-]/g, '\\$&');
33
+ for (const m of code.matchAll(new RegExp(`import\\s*([^;'"]*?)\\s*from\\s*["']${quoted}["']`, 'g'))) {
31
34
  const clause = m[1];
32
35
  const braces = /\{([^}]*)\}/.exec(clause);
33
36
  for (const part of braces ? braces[1].split(',') : []) {
@@ -303,6 +303,7 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
303
303
  "brand-library:brand-asset.deprecated",
304
304
  "brand-library:brand-voice-guide.approved",
305
305
  "brand-library:brand-voice-guide.deprecated",
306
+ "brand-library:content-guideline.approved",
306
307
  "brand-library:content-guideline.deprecated",
307
308
  "builder-workspace:devplane_feature.cancelled",
308
309
  "builder-workspace:devplane_story.dropped",
@@ -320,6 +321,8 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
320
321
  "content-os:content-composition.approved",
321
322
  "content-os:newsletter.Archived",
322
323
  "content-os:post.Archived",
324
+ "content-os:post.Idea",
325
+ "content-os:post.Scheduled",
323
326
  "crm:campaign.cancelled",
324
327
  "crm:campaign.paused",
325
328
  "crm:deal.lost",
@@ -340,6 +343,8 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
340
343
  "operations:engagement.cancelled",
341
344
  "operations:engagement.on-hold",
342
345
  "social:post.Archived",
346
+ "social:post.Idea",
347
+ "social:post.Scheduled",
343
348
  ];
344
349
 
345
350
  it("humanOnly sits on the kind's lifecycle, exactly the ledger", () => {
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The declared requests of a space (`onboarding.intents`, space contract L3,
3
+ * backend #1521) are checked at authoring time with the pod's own caps, because
4
+ * the pod CLIPS, DROPS or never MATCHES what breaks them, silently:
5
+ * - more than 8 phrases: the first 8 are kept;
6
+ * - a phrase over 80 characters: clipped;
7
+ * - a phrase of fewer than two meaningful words: routes nothing (the pod's
8
+ * matcher needs two shared words, or the whole phrase);
9
+ * - a locale that is not a BCP 47 language: dropped;
10
+ * - a repeat: dropped.
11
+ *
12
+ * Each rule has a failing fixture built by mutating ONE field of a clean one,
13
+ * and the clean one is asserted clean, so a fixture that fails for another
14
+ * reason cannot pass for the wrong one. Does NOT cover what `find` does with
15
+ * the phrases at run time (the pod's own tests).
16
+ */
17
+
18
+ import { describe, expect, it } from "vitest";
19
+ import {
20
+ SPACE_INTENT_COUNT_CAP,
21
+ SPACE_INTENT_PHRASE_CAP,
22
+ intentMeaningfulWords,
23
+ validateTemplate,
24
+ } from "./validate.js";
25
+ import type { WorkspaceYaml } from "./types.js";
26
+
27
+ const tplWith = (intents: unknown): WorkspaceYaml =>
28
+ ({
29
+ meta: {
30
+ slug: "intents-fixture",
31
+ name: "Intents fixture",
32
+ description: "Validation fixture",
33
+ icon: "circle",
34
+ color: "blue",
35
+ },
36
+ workspace: { name: "Intents fixture", description: "Validation fixture" },
37
+ profiles: [{ slug: "record", displayName: "Record", properties: [] }],
38
+ onboarding: { purpose: "Keep records.", intents },
39
+ }) as unknown as WorkspaceYaml;
40
+
41
+ const rulesOf = (intents: unknown) =>
42
+ validateTemplate(tplWith(intents), {})
43
+ .errors.filter((e) => e.rule.startsWith("onboarding-intent"))
44
+ .map((e) => e.rule);
45
+
46
+ const CLEAN = [
47
+ { phrase: "write a LinkedIn post", locale: "en" },
48
+ { phrase: "rédiger un post LinkedIn", locale: "fr" },
49
+ ];
50
+
51
+ describe("onboarding.intents", () => {
52
+ it("mirrors the pod's caps (8 phrases of 80 characters)", () => {
53
+ expect(SPACE_INTENT_COUNT_CAP).toBe(8);
54
+ expect(SPACE_INTENT_PHRASE_CAP).toBe(80);
55
+ });
56
+
57
+ it("a clean list is clean (so each fixture below fails for its own reason)", () => {
58
+ expect(rulesOf(CLEAN)).toEqual([]);
59
+ expect(rulesOf(undefined)).toEqual([]);
60
+ });
61
+
62
+ it("more than 8 phrases", () => {
63
+ const nine = Array.from({ length: 9 }, (_, i) => ({ phrase: `plan thing number${i}`, locale: "en" }));
64
+ expect(rulesOf(nine)).toEqual(["onboarding-intents-too-many"]);
65
+ });
66
+
67
+ it("a phrase over 80 characters", () => {
68
+ expect(rulesOf([{ phrase: `write ${"x".repeat(80)}` }])).toEqual(["onboarding-intent-too-long"]);
69
+ });
70
+
71
+ it("a phrase of one meaningful word, or only glue words, routes nothing", () => {
72
+ expect(rulesOf([{ phrase: "write" }])).toEqual(["onboarding-intent-words"]);
73
+ expect(rulesOf([{ phrase: "how do I" }])).toEqual(["onboarding-intent-words"]);
74
+ expect(rulesOf([{ phrase: "pour le de" }])).toEqual(["onboarding-intent-words"]);
75
+ expect(intentMeaningfulWords("rédiger un post LinkedIn")).toBe(3);
76
+ expect(intentMeaningfulWords("écrire l’histoire de notre marque")).toBe(3);
77
+ });
78
+
79
+ it("a locale that is not a language, a bare string, a repeat, a non-list", () => {
80
+ expect(rulesOf([{ phrase: "write a post", locale: "english" }])).toEqual(["onboarding-intent-locale"]);
81
+ expect(rulesOf(["write a post"])).toEqual(["onboarding-intent-invalid"]);
82
+ expect(rulesOf([{ phrase: "write a post" }, { phrase: "Write A Post" }])).toEqual(["onboarding-intent-duplicate"]);
83
+ expect(rulesOf("write a post")).toEqual(["onboarding-intents-invalid"]);
84
+ });
85
+ });
@@ -0,0 +1,218 @@
1
+ /**
2
+ * A template property's `relation` is checked at authoring time
3
+ * (`checkPropertyRelations` in validate.ts) because the pod door
4
+ * (`resolvePropertyRelationDefs`, backend#1498) refuses the same four mistakes
5
+ * only as a report entry at apply time: the relation is then never set and no
6
+ * link is ever made.
7
+ *
8
+ * Each rule has a failing fixture built by mutating ONE field of a clean
9
+ * fixture, and the clean fixture is asserted clean, so a fixture that fails for
10
+ * an unrelated reason cannot pass for the wrong one.
11
+ */
12
+ import { describe, expect, it } from "vitest";
13
+ import { validateTemplate } from "./validate.js";
14
+ import { getWorkspaceTemplate, WORKSPACE_TEMPLATES } from "./templates.js";
15
+ import type { WorkspaceYaml } from "./types.js";
16
+
17
+ const RULES = new Set([
18
+ "property-relation-invalid",
19
+ "property-relation-exposure",
20
+ "property-relation-not-entity-id",
21
+ "property-relation-unknown",
22
+ "property-relation-duplicate",
23
+ ]);
24
+
25
+ const relErrors = (tpl: WorkspaceYaml, opts = {}) =>
26
+ validateTemplate(tpl, opts).errors.filter((e) => RULES.has(e.rule));
27
+
28
+ function fixture(
29
+ mutate: (
30
+ profiles: Record<string, any>[],
31
+ t: Record<string, any>
32
+ ) => void = () => {}
33
+ ): WorkspaceYaml {
34
+ const t: Record<string, any> = {
35
+ meta: {
36
+ slug: "rel",
37
+ name: "Rel",
38
+ description: "d",
39
+ icon: "x",
40
+ color: "gray",
41
+ },
42
+ workspace: { name: "Rel", description: "d" },
43
+ profiles: [
44
+ {
45
+ slug: "task",
46
+ displayName: "Task",
47
+ properties: [
48
+ {
49
+ slug: "task-project",
50
+ label: "Project",
51
+ valueType: "entity_id",
52
+ targetProfileSlug: "project",
53
+ inputType: "entity_select",
54
+ relation: "part_of_project",
55
+ },
56
+ {
57
+ slug: "task-owner",
58
+ label: "Owner",
59
+ valueType: "entity_id",
60
+ targetProfileSlug: "project",
61
+ inputType: "entity_select",
62
+ },
63
+ ],
64
+ },
65
+ { slug: "project", displayName: "Project", properties: [] },
66
+ ],
67
+ entityLinks: [
68
+ {
69
+ sourceProfileSlug: "task",
70
+ targetProfileSlug: "project",
71
+ type: "part_of_project",
72
+ label: "Project",
73
+ },
74
+ ],
75
+ relationDefs: [{ slug: "owned_by", displayName: "Owned by" }],
76
+ };
77
+ mutate(t.profiles, t);
78
+ return t as unknown as WorkspaceYaml;
79
+ }
80
+
81
+ describe("property.relation validation", () => {
82
+ it("accepts a relation an entityLink defines, and one only relationDefs defines", () => {
83
+ expect(relErrors(fixture())).toEqual([]);
84
+ expect(
85
+ relErrors(
86
+ fixture((p) => {
87
+ p[0].properties[1].relation = "owned_by";
88
+ })
89
+ )
90
+ ).toEqual([]);
91
+ });
92
+
93
+ it("rejects a relation no entityLinks / relationDefs defines", () => {
94
+ const errs = relErrors(
95
+ fixture((p) => {
96
+ p[0].properties[0].relation = "nope";
97
+ })
98
+ );
99
+ expect(errs.map((e) => e.rule)).toEqual(["property-relation-unknown"]);
100
+ });
101
+
102
+ it("rejects an exposure relation", () => {
103
+ const errs = relErrors(
104
+ fixture((p) => {
105
+ p[0].properties[0].relation = "visible_to";
106
+ })
107
+ );
108
+ expect(errs.map((e) => e.rule)).toEqual(["property-relation-exposure"]);
109
+ });
110
+
111
+ it("rejects a relation declared by two properties of one kind", () => {
112
+ const errs = relErrors(
113
+ fixture((p) => {
114
+ p[0].properties[1].relation = "part_of_project";
115
+ })
116
+ );
117
+ expect(errs.map((e) => e.rule)).toEqual(["property-relation-duplicate"]);
118
+ expect(errs[0].path).toBe("profiles.task.task-owner.relation");
119
+ });
120
+
121
+ it("accepts one relation declared by two properties of DIFFERENT kinds", () => {
122
+ // The sync is keyed on the source entity's profile: a task and a note
123
+ // pointing at a project through `part_of_project` write different rows.
124
+ expect(
125
+ relErrors(
126
+ fixture((p) => {
127
+ p[1].properties = [
128
+ {
129
+ slug: "project-parent",
130
+ label: "Parent",
131
+ valueType: "entity_id",
132
+ targetProfileSlug: "project",
133
+ inputType: "entity_select",
134
+ relation: "part_of_project",
135
+ },
136
+ ];
137
+ })
138
+ )
139
+ ).toEqual([]);
140
+ });
141
+
142
+ it("rejects a relation on a property that is not an entity_id", () => {
143
+ const errs = relErrors(
144
+ fixture((p) => {
145
+ p[0].properties[0].valueType = "string";
146
+ })
147
+ );
148
+ expect(errs.map((e) => e.rule)).toEqual([
149
+ "property-relation-not-entity-id",
150
+ ]);
151
+ });
152
+
153
+ it("rejects an empty relation", () => {
154
+ const errs = relErrors(
155
+ fixture((p) => {
156
+ p[0].properties[0].relation = "";
157
+ })
158
+ );
159
+ expect(errs.map((e) => e.rule)).toEqual(["property-relation-invalid"]);
160
+ });
161
+ });
162
+
163
+ describe("Content OS: the post's references declare the relation they create", () => {
164
+ const tpl = getWorkspaceTemplate("content-os")!;
165
+ const rel = (slug: string) =>
166
+ tpl.profiles
167
+ .find((p) => p.slug === "post")
168
+ ?.properties.find((d) => d.slug === slug);
169
+
170
+ it("post-campaign, post-pillar and post-series name the edge the template declares", () => {
171
+ expect(rel("post-campaign")?.relation).toBe("part_of_campaign");
172
+ expect(rel("post-pillar")?.relation).toBe("belongs_to_pillar");
173
+ expect(rel("post-series")?.relation).toBe("part_of_series");
174
+ });
175
+
176
+ it("an idea's pillar and campaign and a piece's campaign reuse the post's edges, one property per kind", () => {
177
+ const prop = (kind: string, slug: string) =>
178
+ tpl.profiles
179
+ .find((p) => p.slug === kind)
180
+ ?.properties.find((d) => d.slug === slug);
181
+ expect(prop("idea", "idea-pillar")?.relation).toBe("belongs_to_pillar");
182
+ expect(prop("idea", "idea-campaign")?.relation).toBe("part_of_campaign");
183
+ expect(prop("content-composition", "composition-campaign")?.relation).toBe(
184
+ "part_of_campaign"
185
+ );
186
+ });
187
+
188
+ it("no kind declares one relation on two of its properties", () => {
189
+ for (const p of tpl.profiles) {
190
+ const rels = p.properties.flatMap((d) =>
191
+ d.relation ? [d.relation] : []
192
+ );
193
+ expect(new Set(rels).size, p.slug).toBe(rels.length);
194
+ }
195
+ });
196
+
197
+ it("every relation property is an entity_id whose entityLink goes to the property's target", () => {
198
+ for (const p of tpl.profiles)
199
+ for (const d of p.properties) {
200
+ if (!d.relation) continue;
201
+ expect(d.valueType).toBe("entity_id");
202
+ expect(
203
+ (tpl.entityLinks ?? []).some(
204
+ (l) =>
205
+ l.sourceProfileSlug === p.slug &&
206
+ l.type === d.relation &&
207
+ l.targetProfileSlug === d.targetProfileSlug
208
+ ),
209
+ `${p.slug}.${d.slug}`
210
+ ).toBe(true);
211
+ }
212
+ });
213
+
214
+ it("validates clean against the whole corpus", () => {
215
+ const corpus = Object.values(WORKSPACE_TEMPLATES) as WorkspaceYaml[];
216
+ expect(relErrors(tpl as WorkspaceYaml, { corpus })).toEqual([]);
217
+ });
218
+ });
package/src/social.yaml CHANGED
@@ -162,13 +162,15 @@ profiles:
162
162
  lifecycle:
163
163
  property: post-status
164
164
  options:
165
- - { key: Idea, category: open }
165
+ # Byte-identical to content-os's lifecycle (one declaration per kind).
166
+ - { key: Idea, category: open, humanOnly: true }
166
167
  - { key: Briefed, category: active }
167
168
  - { key: Scripted, category: active }
168
169
  - { key: "In Draft", category: active }
169
170
  - { key: Review, category: active }
170
- - { key: Scheduled, category: active }
171
+ - { key: Scheduled, category: active, humanOnly: true }
171
172
  - { key: Published, category: done }
173
+ - { key: Measured, category: done }
172
174
  - { key: Archived, category: lost, humanOnly: true }
173
175
  # How it renders (entity rendering, decision 8): @synap-core/types/presentation.
174
176
  presentation:
@@ -187,6 +189,7 @@ profiles:
187
189
  "Review",
188
190
  "Scheduled",
189
191
  "Published",
192
+ "Measured",
190
193
  "Archived",
191
194
  ]
192
195
  - slug: post-account