@alterset/alterspec-client 0.29.0 → 0.30.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/developer-guide.md +12 -0
- package/dist/cli.js +88 -4
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/developer-guide.md
CHANGED
|
@@ -251,6 +251,18 @@ When the brief says "Start from `task/chg-012-be`", a task yours waited for was
|
|
|
251
251
|
yet: fetch it and base your branch on it, not on main (`git fetch origin task/chg-012-be`, then branch from
|
|
252
252
|
`origin/task/chg-012-be`). The teams merge a change's branches together once every track is done.
|
|
253
253
|
|
|
254
|
+
When another track has finished the same change, the brief says so near its top: "**BE has shipped this change**"
|
|
255
|
+
with its commit and branch (from the dispatcher's `task`, which names the change's other tasks). The server already
|
|
256
|
+
behaves as the change says, so your tests of what the change removes or narrows fail until your task is done:
|
|
257
|
+
updating them is part of your task, not a broken dependency. A track still at work is named as "building this change
|
|
258
|
+
now". The dispatcher offers a shipped change's other tasks first.
|
|
259
|
+
|
|
260
|
+
When the change keeps a **compatibility** (its proposal's "Compatibility" section: what the server keeps accepting
|
|
261
|
+
from the apps as they are today), the brief says that instead of "tests will fail": on the backend, which tracks
|
|
262
|
+
still build the change and which later task ends the compatibility; on an app, that the server keeps the old
|
|
263
|
+
behaviour until your task is done. The task that ends a compatibility waits for every app task of the change that
|
|
264
|
+
kept it; when to deploy it is the team's call, since old app versions stay in use after a task is done.
|
|
265
|
+
|
|
254
266
|
### A brief that doesn't move under you
|
|
255
267
|
|
|
256
268
|
The spec keeps changing while you build: a rule your task names may be edited by three later changes before you are
|
package/dist/cli.js
CHANGED
|
@@ -727,6 +727,13 @@ function exportChange(e) {
|
|
|
727
727
|
return "not in the export";
|
|
728
728
|
}
|
|
729
729
|
|
|
730
|
+
// ../src/changes/compatibility.ts
|
|
731
|
+
var COMPATIBILITY_SECTION = "Compatibility";
|
|
732
|
+
function compatibilityText(sectionText2) {
|
|
733
|
+
const text = sectionText2?.trim();
|
|
734
|
+
return text && !/^none\b/i.test(text) ? text : void 0;
|
|
735
|
+
}
|
|
736
|
+
|
|
730
737
|
// ../src/changes/data-change.ts
|
|
731
738
|
var DATA_CHANGE_SECTION = "One-time data change";
|
|
732
739
|
var DATA_CHANGE_ITEM = "data-change";
|
|
@@ -1593,6 +1600,29 @@ function answersSection(answers) {
|
|
|
1593
1600
|
// src/context.ts
|
|
1594
1601
|
var ContextError = class extends Error {
|
|
1595
1602
|
};
|
|
1603
|
+
function parseSiblings(value) {
|
|
1604
|
+
if (!Array.isArray(value)) return void 0;
|
|
1605
|
+
const str = (v) => typeof v === "string" && v ? v : void 0;
|
|
1606
|
+
return value.flatMap((v) => {
|
|
1607
|
+
const id = str(v?.id);
|
|
1608
|
+
const track = str(v?.track) ?? id?.split("/")[1];
|
|
1609
|
+
const status = str(v?.status);
|
|
1610
|
+
if (!id || !track || !status) return [];
|
|
1611
|
+
const commit = str(v.commit);
|
|
1612
|
+
const branch = str(v.branch);
|
|
1613
|
+
const inMain = str(v.in_main_at);
|
|
1614
|
+
return [
|
|
1615
|
+
{
|
|
1616
|
+
id,
|
|
1617
|
+
track,
|
|
1618
|
+
status,
|
|
1619
|
+
...commit ? { commit } : {},
|
|
1620
|
+
...branch ? { branch } : {},
|
|
1621
|
+
...inMain ? { in_main_at: inMain } : {}
|
|
1622
|
+
}
|
|
1623
|
+
];
|
|
1624
|
+
});
|
|
1625
|
+
}
|
|
1596
1626
|
function startFrom(track, after2) {
|
|
1597
1627
|
if (!Array.isArray(after2)) return [];
|
|
1598
1628
|
const out = [];
|
|
@@ -1903,6 +1933,26 @@ function reachOf(x, id, kind, changed) {
|
|
|
1903
1933
|
screens: screens.map((s) => piece(s.id, s.title))
|
|
1904
1934
|
};
|
|
1905
1935
|
}
|
|
1936
|
+
function compatibilityOf(x, change, work, proposal) {
|
|
1937
|
+
const text = compatibilityText(sectionText(x, x.sectionShard(proposal, COMPATIBILITY_SECTION)));
|
|
1938
|
+
const crosses = (owner, ownerChange, a) => a.change !== ownerChange && a.track !== owner.track;
|
|
1939
|
+
const endedBy = x.work.changes.flatMap(
|
|
1940
|
+
(other) => other.tasks.filter((t) => t.after.some((a) => a.change === change.id && crosses(t, other.id, a))).map((t) => `${other.id}/${t.track}`)
|
|
1941
|
+
);
|
|
1942
|
+
const kept = text ? { text, tracks: change.tasks.filter((t) => t.track !== "BE").map((t) => t.track), endedBy } : void 0;
|
|
1943
|
+
const byChange = /* @__PURE__ */ new Map();
|
|
1944
|
+
for (const a of work.after)
|
|
1945
|
+
if (crosses(work, change.id, a)) byChange.set(a.change, [...byChange.get(a.change) ?? [], a.track]);
|
|
1946
|
+
const ends = [...byChange].map(([c, tracks]) => ({ change: c, tracks }));
|
|
1947
|
+
return kept || ends.length ? { compatibility: { ...kept ? { kept } : {}, ...ends.length ? { ends } : {} } } : {};
|
|
1948
|
+
}
|
|
1949
|
+
function removedByOf(x, change, key) {
|
|
1950
|
+
if (x.sources.has(key)) return {};
|
|
1951
|
+
const h = history(x, key);
|
|
1952
|
+
const at = h.findIndex((e) => e.change === change);
|
|
1953
|
+
const gone = h.slice(at + 1).reverse().find((e) => e.entry.exported.before && !e.entry.exported.after);
|
|
1954
|
+
return gone && gone.change !== change ? { removedBy: gone.change } : {};
|
|
1955
|
+
}
|
|
1906
1956
|
function taskContext(current, task, exportDir2, state = {}, questions, opts = {}) {
|
|
1907
1957
|
const x = pinnedReader(current, task.change);
|
|
1908
1958
|
const at = (path) => opts.pins && x.isPinned(path) ? `${opts.pins}/${path}` : path;
|
|
@@ -1955,7 +2005,8 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
1955
2005
|
what: itemWhat(x, item, entries.get(itemObject(item)), task.track),
|
|
1956
2006
|
...covered ? { covered } : {},
|
|
1957
2007
|
...weight === void 0 ? {} : { weight },
|
|
1958
|
-
...labelOf(item) ? { label: labelOf(item) } : {}
|
|
2008
|
+
...labelOf(item) ? { label: labelOf(item) } : {},
|
|
2009
|
+
...weight === 0 ? removedByOf(current, task.change, itemObject(item)) : {}
|
|
1959
2010
|
};
|
|
1960
2011
|
}),
|
|
1961
2012
|
known: state.covered !== void 0,
|
|
@@ -1973,6 +2024,8 @@ function taskContext(current, task, exportDir2, state = {}, questions, opts = {}
|
|
|
1973
2024
|
track,
|
|
1974
2025
|
after: work.after,
|
|
1975
2026
|
...state.startFrom?.length ? { startFrom: state.startFrom } : {},
|
|
2027
|
+
...state.siblings?.length ? { siblings: state.siblings } : {},
|
|
2028
|
+
...compatibilityOf(x, change, work, proposal),
|
|
1976
2029
|
proposal: {
|
|
1977
2030
|
path: proposal,
|
|
1978
2031
|
why: sectionText(x, x.sectionShard(proposal, "Why")),
|
|
@@ -2265,7 +2318,7 @@ function checklistSection(c) {
|
|
|
2265
2318
|
...list2.note ? ["", `Covered items unknown: ${list2.note}`] : [],
|
|
2266
2319
|
"",
|
|
2267
2320
|
...list2.items.map(
|
|
2268
|
-
(i) => `- [${i.weight === 0 ? "-" : i.covered ? "x" : " "}] \`${i.item}\`${i.weight === void 0 ? "" : i.weight === 0 ? " (w 0, nothing to build on this track)" : ` (w ${i.weight})`}: ${i.label ? `**${i.label}** \u2014 ` : ""}${i.what}${i.covered ? ` (covered by ${i.covered.slice(0, 12)})` : ""}`
|
|
2321
|
+
(i) => `- [${i.weight === 0 ? "-" : i.covered ? "x" : " "}] \`${i.item}\`${i.weight === void 0 ? "" : i.weight === 0 ? i.removedBy ? ` (w 0, removed by ${i.removedBy})` : " (w 0, nothing to build on this track)" : ` (w ${i.weight})`}: ${i.label ? `**${i.label}** \u2014 ` : ""}${i.what}${i.covered ? ` (covered by ${i.covered.slice(0, 12)})` : ""}`
|
|
2269
2322
|
)
|
|
2270
2323
|
);
|
|
2271
2324
|
}
|
|
@@ -2277,6 +2330,7 @@ function renderChecklist(c) {
|
|
|
2277
2330
|
"",
|
|
2278
2331
|
...c.summary ? [c.summary, ""] : [],
|
|
2279
2332
|
...c.weight === void 0 ? [] : [`Task weight ${c.weight} of 100.`, ""],
|
|
2333
|
+
...shippedLines(c),
|
|
2280
2334
|
...c.questions?.length ? questionsSection(c.questions) : [],
|
|
2281
2335
|
...c.answers?.length ? answersSection(c.answers) : [],
|
|
2282
2336
|
...checklistSection(c),
|
|
@@ -2285,6 +2339,34 @@ function renderChecklist(c) {
|
|
|
2285
2339
|
];
|
|
2286
2340
|
return out.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n";
|
|
2287
2341
|
}
|
|
2342
|
+
function shippedLines(c) {
|
|
2343
|
+
const out = [];
|
|
2344
|
+
const kept = c.compatibility?.kept;
|
|
2345
|
+
for (const s of c.siblings ?? []) {
|
|
2346
|
+
if (s.status === "done") {
|
|
2347
|
+
const where = [s.commit?.slice(0, 12), s.in_main_at ? "in main" : s.branch ?? "main"].filter(Boolean).join(", ");
|
|
2348
|
+
out.push(
|
|
2349
|
+
`**${s.track} has shipped this change** (${where})` + (kept ? ": the server keeps the old behaviour this change\u2019s Compatibility names until the other tracks\u2019 tasks are done (below)." : ": tests that check the behaviour it removes or changes are expected to fail until this task is done; updating them is part of this task."),
|
|
2350
|
+
""
|
|
2351
|
+
);
|
|
2352
|
+
} else if (s.status === "in_progress") out.push(`${s.track} is building this change now.`, "");
|
|
2353
|
+
}
|
|
2354
|
+
if (kept) {
|
|
2355
|
+
const ended = kept.endedBy.length ? `${kept.endedBy.join(", ")} ends it.` : "The change that ends it is not signed off yet.";
|
|
2356
|
+
out.push(
|
|
2357
|
+
c.track.kind === "backend" ? `**Compatibility**: ${kept.tracks.join(", ")} build this change too; the server keeps what the proposal\u2019s Compatibility says until their tasks are done. ${ended}` : `**Compatibility**: the server keeps the old behaviour (${c.change.id}\u2019s Compatibility) until this task is done. ${ended}`,
|
|
2358
|
+
"",
|
|
2359
|
+
kept.text,
|
|
2360
|
+
""
|
|
2361
|
+
);
|
|
2362
|
+
}
|
|
2363
|
+
for (const e of c.compatibility?.ends ?? [])
|
|
2364
|
+
out.push(
|
|
2365
|
+
`**Ends a compatibility**: this task ends the compatibility ${e.change} kept for ${e.tracks.join(", ")}; it is available once their tasks are done. When to deploy it is the team\u2019s call: old app versions stay in use after a task is done.`,
|
|
2366
|
+
""
|
|
2367
|
+
);
|
|
2368
|
+
return out;
|
|
2369
|
+
}
|
|
2288
2370
|
function renderContext(c) {
|
|
2289
2371
|
const out = [
|
|
2290
2372
|
`# ${c.task}: ${c.title ?? c.change.title}`,
|
|
@@ -2310,7 +2392,7 @@ function renderContext(c) {
|
|
|
2310
2392
|
"",
|
|
2311
2393
|
`Start from ${c.startFrom.map((s) => `\`${s.branch}\` (${s.id}${s.commit ? ` done at ${s.commit.slice(0, 12)}` : ""})`).join(", then ")}, not from the main branch: the predecessor's work is pushed there and not merged yet (fetch it and base your branch on \`origin/${c.startFrom[c.startFrom.length - 1].branch}\`).`
|
|
2312
2394
|
);
|
|
2313
|
-
out.push("");
|
|
2395
|
+
out.push("", ...shippedLines(c));
|
|
2314
2396
|
if (c.questions?.length) out.push(...questionsSection(c.questions));
|
|
2315
2397
|
if (c.answers?.length) out.push(...answersSection(c.answers));
|
|
2316
2398
|
out.push(...checklistSection(c));
|
|
@@ -3780,6 +3862,7 @@ async function coveredState(loaded, task) {
|
|
|
3780
3862
|
const items = answer.items ?? [];
|
|
3781
3863
|
const answers = parseAnswers(answer.answers);
|
|
3782
3864
|
const from = startFrom(task.track, answer.after);
|
|
3865
|
+
const siblings = parseSiblings(answer.siblings);
|
|
3783
3866
|
return {
|
|
3784
3867
|
covered: new Map(items.flatMap((i) => i.covered_commit ? [[i.item, i.covered_commit]] : [])),
|
|
3785
3868
|
// The dispatcher's list is the checklist: its first item list stands (its spec, section 9), so the brief and
|
|
@@ -3792,7 +3875,8 @@ async function coveredState(loaded, task) {
|
|
|
3792
3875
|
}))
|
|
3793
3876
|
} : {},
|
|
3794
3877
|
...answers ? { answers } : {},
|
|
3795
|
-
...from.length ? { startFrom: from } : {}
|
|
3878
|
+
...from.length ? { startFrom: from } : {},
|
|
3879
|
+
...siblings?.length ? { siblings } : {}
|
|
3796
3880
|
};
|
|
3797
3881
|
} catch (e) {
|
|
3798
3882
|
return { unknown: e.message.split("\n")[0] };
|