dreamteamer 0.39.0 → 0.39.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/package.json +1 -1
- package/src/check.js +8 -1
- package/src/collections-cli.js +6 -2
- package/src/commit.js +5 -0
- package/src/relations.js +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dreamteamer",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.1",
|
|
4
4
|
"description": "A workspace compiler for coding agents — schema-validated records as plain files over git, compiled into every harness",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Gilad Khen <giladkhen@gmail.com>",
|
package/src/check.js
CHANGED
|
@@ -9,7 +9,7 @@ import addFormats from 'ajv-formats';
|
|
|
9
9
|
import { parseRecord, patternRe, fmtAjvError, unknownFields, walk, idFromRecordPath, MAX_RECORD_BYTES } from './records.js';
|
|
10
10
|
import { NO_RUNTIME, loadDescriptors, runtimeDir, namespaces as compiledNamespaces } from './runtime.js';
|
|
11
11
|
import { parseRef } from './namespace.js';
|
|
12
|
-
import { relationsOf, expectedMirrors } from './relations.js';
|
|
12
|
+
import { relationsOf, expectedMirrors, ownersReadIn } from './relations.js';
|
|
13
13
|
import { placementOf, placedRecords, ownerIdOf, symlinkedChildRoots } from './placement.js';
|
|
14
14
|
|
|
15
15
|
import { storageOf, jsonSchemaOf, fieldsOf, unresolvedPeersOf, bodyFieldOf, targetsOf, isSoft, idsOf } from './descriptor.js';
|
|
@@ -184,6 +184,10 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
184
184
|
flag(file, `unknown field "${k}" (not in the ${name} schema)`);
|
|
185
185
|
}
|
|
186
186
|
for (const [fieldPath, target, soft] of refFields) {
|
|
187
|
+
// a layer's MIRROR whose owners this workspace does not read from that layer names
|
|
188
|
+
// records of the layer's repo — not dangling, only out of sight (see ownersReadIn)
|
|
189
|
+
if (fileLayer.has(file) && fieldPath.length === 1 && fieldsOf(d)[fieldPath[0]]?.mirror_of !== undefined
|
|
190
|
+
&& Array.isArray(target) && descriptors.has(target[0]) && !ownersReadIn(descriptors.get(target[0]), fileRepo.get(file))) continue;
|
|
187
191
|
for (const value of valuesAt(fields, fieldPath)) {
|
|
188
192
|
checkRef(file, fieldPath, value, target, softTargets, soft);
|
|
189
193
|
}
|
|
@@ -256,7 +260,10 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
256
260
|
}
|
|
257
261
|
}
|
|
258
262
|
|
|
263
|
+
const ownerD = descriptors.get(relation.owner);
|
|
259
264
|
for (const [id, fields] of parsed.get(relation.target) ?? []) {
|
|
265
|
+
const tfile = index.get(relation.target).get(id);
|
|
266
|
+
if (fileLayer.has(tfile) && !ownersReadIn(ownerD, fileRepo.get(tfile))) continue; // the layer's own check judges it
|
|
260
267
|
const actual = fields?.[relation.mirror];
|
|
261
268
|
const expected = expByRepo.get(fileRepo.get(index.get(relation.target).get(id)))?.get(id);
|
|
262
269
|
// a unique relation mirrors to a scalar, everything else to a sorted array — compare in
|
package/src/collections-cli.js
CHANGED
|
@@ -26,7 +26,7 @@ import { baseNameOf, defaultStoragePath } from './namespace.js';
|
|
|
26
26
|
import { sortRows } from './temporal.js';
|
|
27
27
|
import { keyBetween, placementKey } from './fractional-index.js';
|
|
28
28
|
import { ensureRepo, ensureAllRepos } from './init.js';
|
|
29
|
-
import { expectedMirrors } from './relations.js';
|
|
29
|
+
import { expectedMirrors, ownersReadIn } from './relations.js';
|
|
30
30
|
import { parseRecord } from './records.js';
|
|
31
31
|
|
|
32
32
|
import { storageOf, jsonSchemaOf, recordTitleOf, positionFieldOf, fieldsOf, displayOf, storedFieldsOf, targetsOf } from './descriptor.js';
|
|
@@ -1025,8 +1025,12 @@ function relationsRebuild(store, flags, pos) {
|
|
|
1025
1025
|
store.withWriteLock(() => {
|
|
1026
1026
|
for (const { id, file, fields } of parseEach(store, collection, (f) => console.warn(`⚠ ${rel(store.root, f)}: parse error, skipped — \`dreamteamer check\` reports it`))) {
|
|
1027
1027
|
let changed = false;
|
|
1028
|
+
const repo = store.repoOfFile(d, file);
|
|
1028
1029
|
for (const { r, exp } of expected) {
|
|
1029
|
-
|
|
1030
|
+
// a layer's mirror justified by owners this workspace does not read from that layer is
|
|
1031
|
+
// left exactly as the layer wrote it — rebuilding it from here deleted it (ownersReadIn)
|
|
1032
|
+
if (store.layerOfFile(d, file) && !ownersReadIn(store.descriptor(r.owner), repo)) continue;
|
|
1033
|
+
const want = exp.get(repo)?.get(id);
|
|
1030
1034
|
const have = fields[r.mirror];
|
|
1031
1035
|
// ⚠ COERCE THE WAY AJV DOES. `check` validates with `coerceTypes: 'array'`, which mutates
|
|
1032
1036
|
// the record in place BEFORE its relation pass — so it compares a coerced value while this
|
package/src/commit.js
CHANGED
|
@@ -489,6 +489,11 @@ function commitPlan(store, { only = [], message, dryRun = false } = {}) {
|
|
|
489
489
|
// repo's rows before it can tell a renamed record from a concurrent deletion.
|
|
490
490
|
const sampled = [];
|
|
491
491
|
for (const [repo, dirs] of byRepo) {
|
|
492
|
+
// A declared record layer not cloned yet — a fresh checkout before `dt install` — has nothing
|
|
493
|
+
// pending by construction. Spawning git in a folder that does not exist threw ENOENT out of
|
|
494
|
+
// the WHOLE verb, so not one record of this workspace could be published; check and status
|
|
495
|
+
// already say the layer is not installed.
|
|
496
|
+
if (repo !== '.' && !fs.existsSync(path.resolve(store.root, repo))) continue;
|
|
492
497
|
const { cwd, rows } = sample(store.root, repo, dirs, store.descriptors);
|
|
493
498
|
sampled.push({ repo, cwd, rows });
|
|
494
499
|
}
|
package/src/relations.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Relations, decoded ONCE. A relation is a mirror field (`mirror_of: <owner field>`) in the compiled
|
|
2
2
|
// runtime, so check, the store's mirror maintenance, `dt relations`, rebuild and presentation all
|
|
3
3
|
// read through here and can never disagree about what a relation is.
|
|
4
|
-
import { fieldsOf, targetsOf } from './descriptor.js';
|
|
4
|
+
import { fieldsOf, targetsOf, storageOf } from './descriptor.js';
|
|
5
5
|
|
|
6
6
|
export function relationsOf(descriptors) {
|
|
7
7
|
const out = [];
|
|
@@ -29,6 +29,15 @@ export function relationsOf(descriptors) {
|
|
|
29
29
|
return out;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/** Can this workspace JUDGE a mirror held in `repo`? A mirror is kept between records of one repo, so
|
|
33
|
+
* its truth is the owners in THAT repo — which a reader here sees only when it reads the owner
|
|
34
|
+
* collection from that repo too. A record layer that contributes `projects` but not `tasks` holds
|
|
35
|
+
* mirrors justified by tasks this workspace never reads: judged from here they all look stale, and
|
|
36
|
+
* `relations rebuild` once deleted them inside the layer's clone. Those are the layer's own check's. */
|
|
37
|
+
export function ownersReadIn(ownerDescriptor, repo) {
|
|
38
|
+
return storageOf(ownerDescriptor).roots.some((r) => r.repo === repo);
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
/** What each target record's mirror SHOULD hold, computed from the owning side.
|
|
33
42
|
* Sorted arrays (ids are usually date-prefixed, so that reads chronological); a scalar for unique. */
|
|
34
43
|
export function expectedMirrors(rel, ownerRecords) {
|