yarramate 1.4.0 → 1.4.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.
@@ -58,7 +58,14 @@ export const buildVisualSessionRequest = (options) => {
58
58
  const workspace = loaded.workspace;
59
59
  // Same order the session's own recompile uses, so the request's graph and
60
60
  // every graph the session rebuilds after a commit come from one input list.
61
- const sourcePaths = [...workspace.profiles, ...workspace.documents];
61
+ // Patterns are compiler input like profiles (#268). Omitting them compiled a
62
+ // different workspace than the manifest describes, and an instance binding
63
+ // parts then failed YM419 for a pattern the manifest declared.
64
+ const sourcePaths = [
65
+ ...workspace.profiles,
66
+ ...workspace.patterns,
67
+ ...workspace.documents,
68
+ ];
62
69
  const sources = [];
63
70
  for (const path of sourcePaths) {
64
71
  try {
@@ -504,6 +504,13 @@ export const startVisualServer = async (options) => {
504
504
  try {
505
505
  return [
506
506
  ...resolvedWorkspace.profiles,
507
+ // Patterns are compiler input like profiles (#268). Without them a
508
+ // session recompiles a workspace the manifest does not describe: an
509
+ // instance binding parts fails YM419, `compiledWorkspace` becomes
510
+ // undefined, and every view's filter then matches nothing while the
511
+ // rail still shows the initial model - which reads as a filter bug
512
+ // rather than as a compile that failed.
513
+ ...resolvedWorkspace.patterns,
507
514
  ...resolvedWorkspace.documents,
508
515
  ].map((path) => ({
509
516
  path,
@@ -719,6 +719,10 @@ export const applyOperations = (input) => {
719
719
  // single byte is written; any diagnostic rejects the entire batch.
720
720
  const compiled = [
721
721
  ...resolvedWorkspace.profiles,
722
+ // Without patterns this gate compiles a workspace the manifest does not
723
+ // describe, so every commit against a workspace holding pattern instances
724
+ // was refused with YM419 for a pattern that was declared (#268).
725
+ ...resolvedWorkspace.patterns,
722
726
  ...resolvedWorkspace.documents,
723
727
  ].map((path) => ({
724
728
  path,
@@ -832,6 +836,9 @@ export const planOperations = (store, input) => {
832
836
  // workspace that declares a profile died on it. No operation can target a
833
837
  // profile, so they are read to be COMPILED against, never to be written.
834
838
  ...input.workspace.profiles,
839
+ // Patterns are compiled against too, and are no more writable than a
840
+ // profile: no operation can target one.
841
+ ...input.workspace.patterns,
835
842
  ...input.workspace.documents,
836
843
  ...input.workspace.projections,
837
844
  ...input.workspace.evidence,
@@ -432,7 +432,11 @@ export function runAskCommand(options, cwd) {
432
432
  return emit(result, `Workspace ${workspace.id}: check failing\n` +
433
433
  `Diagnostics: ${plural(checkPayload.diagnostics.length, 'error')}; run \`yarramate check ${workspacePath}\` for details\n`, 1);
434
434
  }
435
- const compilation = compileWorkspaceWithProfileContext([...workspace.profiles, ...workspace.documents].map((path) => ({
435
+ const compilation = compileWorkspaceWithProfileContext([
436
+ ...workspace.profiles,
437
+ ...workspace.patterns,
438
+ ...workspace.documents,
439
+ ].map((path) => ({
436
440
  path,
437
441
  source: readFileSync(resolve(cwd, path), 'utf8'),
438
442
  })));
@@ -514,7 +518,11 @@ export function runAskCommand(options, cwd) {
514
518
  return emit(result, `${lines.join('\n')}\n`);
515
519
  }
516
520
  // Every other mode reads the compiled model directly.
517
- const compilation = compileWorkspaceWithProfileContext([...workspace.profiles, ...workspace.documents].map((path) => ({
521
+ const compilation = compileWorkspaceWithProfileContext([
522
+ ...workspace.profiles,
523
+ ...workspace.patterns,
524
+ ...workspace.documents,
525
+ ].map((path) => ({
518
526
  path,
519
527
  source: readFileSync(resolve(cwd, path), 'utf8'),
520
528
  })));
@@ -274,7 +274,11 @@ export function runCheckCommand(options, cwd) {
274
274
  if (ok && result.ok) {
275
275
  const successfulCounts = counted;
276
276
  const documentCount = result.graph.documents.length;
277
- const profileCount = coreSources.length - documentCount;
277
+ const patternCount = resolved.patterns.length;
278
+ // Everything in `coreSources` that is not a document was a profile until
279
+ // patterns joined the source list (#268), and counting them as profiles
280
+ // said "2 profiles" about a workspace with one.
281
+ const profileCount = coreSources.length - documentCount - patternCount;
278
282
  const mappingCount = mappingSources.length;
279
283
  const projectionCount = resolved.projections.length;
280
284
  const evidenceCount = resolved.evidence.length;
@@ -286,6 +290,11 @@ export function runCheckCommand(options, cwd) {
286
290
  `${profileCount} ${profileCount === 1 ? 'profile' : 'profiles'}`,
287
291
  ]
288
292
  : []),
293
+ ...(patternCount > 0
294
+ ? [
295
+ `${patternCount} ${patternCount === 1 ? 'pattern' : 'patterns'}`,
296
+ ]
297
+ : []),
289
298
  ...(mappingCount > 0
290
299
  ? [
291
300
  `${mappingCount} ${mappingCount === 1 ? 'adapter mapping' : 'adapter mappings'}`,
@@ -28,6 +28,8 @@ export declare const resolveCliWorkspaceSources: (paths: readonly string[], cwd:
28
28
  readonly projections: readonly string[];
29
29
  readonly evidence: readonly string[];
30
30
  readonly contracts: readonly string[];
31
+ /** Pattern documents, which ride in `paths` and are not documents. */
32
+ readonly patterns: readonly string[];
31
33
  } | {
32
34
  readonly ok: false;
33
35
  readonly diagnostics: readonly Diagnostic[];
@@ -50,6 +50,7 @@ export const resolveCliWorkspaceSources = (paths, cwd, options = {}) => {
50
50
  projections: [],
51
51
  evidence: [],
52
52
  contracts: [],
53
+ patterns: [],
53
54
  };
54
55
  }
55
56
  const manifestPath = paths[0];
@@ -60,6 +61,7 @@ export const resolveCliWorkspaceSources = (paths, cwd, options = {}) => {
60
61
  projections: [],
61
62
  evidence: [],
62
63
  contracts: [],
64
+ patterns: [],
63
65
  };
64
66
  }
65
67
  const source = readFileSync(resolve(cwd, manifestPath), 'utf8');
@@ -70,6 +72,7 @@ export const resolveCliWorkspaceSources = (paths, cwd, options = {}) => {
70
72
  projections: [],
71
73
  evidence: [],
72
74
  contracts: [],
75
+ patterns: [],
73
76
  };
74
77
  }
75
78
  const loaded = loadWorkspaceManifest({ path: manifestPath, source }, cwd);
@@ -78,6 +81,15 @@ export const resolveCliWorkspaceSources = (paths, cwd, options = {}) => {
78
81
  ok: true,
79
82
  paths: [
80
83
  ...loaded.workspace.profiles,
84
+ // Patterns are compiler input like profiles, and were resolved from
85
+ // the manifest without ever being handed over (#268): a pattern
86
+ // document a workspace declared was silently ignored by every verb,
87
+ // and an instance binding parts then failed YM419 for a pattern that
88
+ // was sitting right there in the manifest. Every test passed because
89
+ // each hands the compiler an explicit source list rather than
90
+ // resolving a workspace - the check that passes was not the check
91
+ // that mattered.
92
+ ...loaded.workspace.patterns,
81
93
  ...loaded.workspace.documents,
82
94
  ...(options.includeAdapterMappings === true
83
95
  ? loaded.workspace.adapterMappings
@@ -86,6 +98,7 @@ export const resolveCliWorkspaceSources = (paths, cwd, options = {}) => {
86
98
  projections: loaded.workspace.projections,
87
99
  evidence: loaded.workspace.evidence,
88
100
  contracts: loaded.workspace.contracts,
101
+ patterns: loaded.workspace.patterns,
89
102
  }
90
103
  : { ok: false, diagnostics: loaded.diagnostics };
91
104
  };
package/dist/cli.js CHANGED
@@ -37,6 +37,7 @@ const runReconciliation = (options, cwd) => {
37
37
  }
38
38
  const sourcePaths = [
39
39
  ...loadedWorkspace.workspace.profiles,
40
+ ...loadedWorkspace.workspace.patterns,
40
41
  ...loadedWorkspace.workspace.documents,
41
42
  ];
42
43
  const compilation = compileWorkspace(sourcePaths.map((path) => ({
@@ -197,7 +197,11 @@ export function runDesignCommand(options, cwd) {
197
197
  });
198
198
  if (!loadedCatalogue.ok)
199
199
  return failed(loadedCatalogue.diagnostics);
200
- const compilation = compileWorkspaceWithProfileContext([...workspace.profiles, ...workspace.documents].map((path) => ({
200
+ const compilation = compileWorkspaceWithProfileContext([
201
+ ...workspace.profiles,
202
+ ...workspace.patterns,
203
+ ...workspace.documents,
204
+ ].map((path) => ({
201
205
  path,
202
206
  source: readFileSync(resolve(cwd, path), 'utf8'),
203
207
  })));
@@ -273,8 +277,19 @@ export function runDesignCommand(options, cwd) {
273
277
  stderr: '',
274
278
  };
275
279
  }
276
- const waveSummary = result.progress.waves
277
- .map(({ id, open }) => `${id} ${open} open`)
280
+ // Read from the REPORT rather than from `progress`, because a wave that
281
+ // has not opened and one with nothing outstanding both count zero (#334).
282
+ // "implementation 0 open" about a gated wave is the same empty-set
283
+ // flattery as the completion sentence below it - which was fixed while
284
+ // this line, directly above it, was not. `progress` keeps its shape: a
285
+ // consumer wanting wave state reads an interrogation report, and a third
286
+ // required field on a published format for a convenience summary is not
287
+ // worth the constructor break.
288
+ const waveSummary = report.waves
289
+ .map((wave) => {
290
+ const open = result.progress.waves.find(({ id }) => id === wave.id)?.open ?? 0;
291
+ return wave.opened ? `${wave.id} ${open} open` : `${wave.id} not yet`;
292
+ })
278
293
  .join(' · ');
279
294
  const lines = [
280
295
  `Design interview — workspace ${workspace.id} · catalogue ${report.catalogue}`,
@@ -149,7 +149,11 @@ export function runExportCommand(options, cwd) {
149
149
  if (!loadedWorkspace.ok)
150
150
  return failed(loadedWorkspace.diagnostics);
151
151
  const workspace = loadedWorkspace.workspace;
152
- const compilation = compileWorkspaceWithProfileContext([...workspace.profiles, ...workspace.documents].map((path) => ({
152
+ const compilation = compileWorkspaceWithProfileContext([
153
+ ...workspace.profiles,
154
+ ...workspace.patterns,
155
+ ...workspace.documents,
156
+ ].map((path) => ({
153
157
  path,
154
158
  source: readFileSync(resolve(cwd, path), 'utf8'),
155
159
  })));
@@ -91847,7 +91847,11 @@ var kC = [
91847
91847
  });
91848
91848
  if (s.length > 0) return a(s);
91849
91849
  }
91850
- let b = [...t.profiles, ...t.documents].map((e) => ({
91850
+ let b = [
91851
+ ...t.profiles,
91852
+ ...t.patterns,
91853
+ ...t.documents
91854
+ ].map((e) => ({
91851
91855
  path: e,
91852
91856
  source: m.get(e) ?? i(e)
91853
91857
  })), x = dC(b);
@@ -91909,6 +91913,7 @@ var kC = [
91909
91913
  let n = /* @__PURE__ */ new Map(), r = [];
91910
91914
  for (let i of [
91911
91915
  ...t.workspace.profiles,
91916
+ ...t.workspace.patterns,
91912
91917
  ...t.workspace.documents,
91913
91918
  ...t.workspace.projections,
91914
91919
  ...t.workspace.evidence,
@@ -92998,7 +93003,11 @@ var uce = (e) => [...e.keys()].map((t) => ({
92998
93003
  }, o = n.projections.flatMap((e) => {
92999
93004
  let t = a(e);
93000
93005
  return t === void 0 ? [] : [t];
93001
- }), s, c = () => [...n.profiles, ...n.documents].flatMap((e) => {
93006
+ }), s, c = () => [
93007
+ ...n.profiles,
93008
+ ...n.patterns,
93009
+ ...n.documents
93010
+ ].flatMap((e) => {
93002
93011
  let n = t.read(e);
93003
93012
  return n === void 0 ? [] : [{
93004
93013
  path: e,
@@ -93020,7 +93029,11 @@ var uce = (e) => [...e.keys()].map((t) => ({
93020
93029
  initialView: o[0]?.id ?? "",
93021
93030
  documents: n.documents,
93022
93031
  layouts: i.layouts,
93023
- sourceDigests: l([...n.profiles, ...n.documents]),
93032
+ sourceDigests: l([
93033
+ ...n.profiles,
93034
+ ...n.patterns,
93035
+ ...n.documents
93036
+ ]),
93024
93037
  projectionDigests: l(o.map(({ path: e }) => e))
93025
93038
  }, e.catalogue ?? Bw, e.dismissed);
93026
93039
  return o = s.views, i = s.model, !0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yarramate",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Tool-neutral semantic architecture engine and guided methodology",
5
5
  "license": "MIT",
6
6
  "repository": {