@intentius/chant 0.85.0 → 0.87.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/cli/main.d.ts.map +1 -1
- package/dist/cli/registry.d.ts +13 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.d.ts +13 -0
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/workspace/__fixtures__/sessions.d.ts +23 -0
- package/dist/workspace/__fixtures__/sessions.d.ts.map +1 -0
- package/dist/workspace/checks/records.d.ts +1 -0
- package/dist/workspace/checks/records.d.ts.map +1 -1
- package/dist/workspace/checks.d.ts +4 -0
- package/dist/workspace/checks.d.ts.map +1 -1
- package/dist/workspace/composites.d.ts +14 -1
- package/dist/workspace/composites.d.ts.map +1 -1
- package/dist/workspace/conformance/index.d.ts +211 -0
- package/dist/workspace/conformance/index.d.ts.map +1 -0
- package/dist/workspace/conformance/vitest.d.ts +11 -0
- package/dist/workspace/conformance/vitest.d.ts.map +1 -0
- package/dist/workspace/declaration.d.ts +28 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.schema.json +40 -0
- package/dist/workspace/declared-kinds.d.ts +43 -0
- package/dist/workspace/declared-kinds.d.ts.map +1 -0
- package/dist/workspace/graph-cli.d.ts +11 -0
- package/dist/workspace/graph-cli.d.ts.map +1 -1
- package/dist/workspace/intent-cli.d.ts +2 -1
- package/dist/workspace/intent-cli.d.ts.map +1 -1
- package/dist/workspace/intent-joins.d.ts +45 -8
- package/dist/workspace/intent-joins.d.ts.map +1 -1
- package/dist/workspace/intent.d.ts +71 -7
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/ls.d.ts +31 -1
- package/dist/workspace/ls.d.ts.map +1 -1
- package/dist/workspace/reason-codes.d.ts +47 -4
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/record-sessions.d.ts +51 -0
- package/dist/workspace/record-sessions.d.ts.map +1 -0
- package/dist/workspace/record-source.d.ts +2 -0
- package/dist/workspace/record-source.d.ts.map +1 -1
- package/dist/workspace/records-cli.d.ts +71 -4
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/dist/workspace/records-since.d.ts +90 -0
- package/dist/workspace/records-since.d.ts.map +1 -0
- package/dist/workspace/records-write.d.ts +171 -0
- package/dist/workspace/records-write.d.ts.map +1 -0
- package/dist/workspace/records.d.ts +244 -15
- package/dist/workspace/records.d.ts.map +1 -1
- package/dist/workspace/runtimes.d.ts +60 -0
- package/dist/workspace/runtimes.d.ts.map +1 -0
- package/dist/workspace/status-gates.d.ts +90 -0
- package/dist/workspace/status-gates.d.ts.map +1 -0
- package/dist/workspace/status.d.ts +17 -0
- package/dist/workspace/status.d.ts.map +1 -1
- package/dist/workspace/trust/seal.d.ts +85 -0
- package/dist/workspace/trust/seal.d.ts.map +1 -0
- package/dist/workspace/trust/ssh-commit.d.ts +7 -0
- package/dist/workspace/trust/ssh-commit.d.ts.map +1 -1
- package/dist/workspace/work.d.ts +56 -0
- package/dist/workspace/work.d.ts.map +1 -0
- package/package.json +19 -1
- package/src/cli/main.ts +55 -3
- package/src/cli/registry.ts +13 -1
- package/src/lifecycle/gate-ledger.ts +14 -0
- package/src/workspace/__fixtures__/sessions.ts +66 -0
- package/src/workspace/checks/records.ts +19 -0
- package/src/workspace/checks.test.ts +2 -0
- package/src/workspace/checks.ts +7 -1
- package/src/workspace/composites.schema.json +65 -3
- package/src/workspace/composites.test.ts +95 -5
- package/src/workspace/composites.ts +28 -7
- package/src/workspace/conformance/__fixture__/app/package.json +7 -0
- package/src/workspace/conformance/__fixture__/app/src/server.mjs +29 -0
- package/src/workspace/conformance/__fixture__/decisions/decision.kind.mjs +32 -0
- package/src/workspace/conformance/__fixture__/decisions/decision.schema.json +376 -0
- package/src/workspace/conformance/__fixture__/decisions/fix-001-how-the-app-is-deployed.md +40 -0
- package/src/workspace/conformance/__fixture__/delivery/chant.config.ts +7 -0
- package/src/workspace/conformance/__fixture__/delivery/lexicon/index.ts +26 -0
- package/src/workspace/conformance/__fixture__/delivery/package.json +7 -0
- package/src/workspace/conformance/__fixture__/delivery/src/app.component.ts +14 -0
- package/src/workspace/conformance/__fixture__/delivery/src/app.ts +4 -0
- package/src/workspace/conformance/conformance.test.ts +149 -0
- package/src/workspace/conformance/index.mjs +31 -0
- package/src/workspace/conformance/index.ts +453 -0
- package/src/workspace/conformance/vitest.ts +62 -0
- package/src/workspace/declaration.schema.json +40 -0
- package/src/workspace/declaration.ts +62 -0
- package/src/workspace/declared-kinds.test.ts +321 -0
- package/src/workspace/declared-kinds.ts +76 -0
- package/src/workspace/graph-cli.ts +8 -0
- package/src/workspace/intent-cli.ts +29 -6
- package/src/workspace/intent-gaps.test.ts +217 -0
- package/src/workspace/intent-joins.test.ts +60 -0
- package/src/workspace/intent-joins.ts +71 -19
- package/src/workspace/intent.schema.json +304 -7
- package/src/workspace/intent.test.ts +99 -0
- package/src/workspace/intent.ts +365 -46
- package/src/workspace/ls.schema.json +34 -0
- package/src/workspace/ls.ts +69 -4
- package/src/workspace/read-contract.test.ts +30 -9
- package/src/workspace/reason-codes.test.ts +16 -4
- package/src/workspace/reason-codes.ts +55 -4
- package/src/workspace/record-assets.test.ts +3 -1
- package/src/workspace/record-sessions.ts +105 -0
- package/src/workspace/record-source.ts +14 -5
- package/src/workspace/records-amend.schema.json +167 -0
- package/src/workspace/records-cli.ts +308 -19
- package/src/workspace/records-contract.test.ts +57 -2
- package/src/workspace/records-formats.test.ts +640 -0
- package/src/workspace/records-new.schema.json +158 -0
- package/src/workspace/records-quorum.test.ts +196 -0
- package/src/workspace/records-review.schema.json +227 -0
- package/src/workspace/records-sessions.test.ts +108 -0
- package/src/workspace/records-since.schema.json +193 -0
- package/src/workspace/records-since.test.ts +174 -0
- package/src/workspace/records-since.ts +259 -0
- package/src/workspace/records-write-contract.test.ts +125 -0
- package/src/workspace/records-write.test.ts +373 -0
- package/src/workspace/records-write.ts +765 -0
- package/src/workspace/records.schema.json +202 -9
- package/src/workspace/records.ts +700 -41
- package/src/workspace/runtimes.ts +107 -0
- package/src/workspace/status-contract.test.ts +163 -0
- package/src/workspace/status-gates.ts +215 -0
- package/src/workspace/status.schema.json +69 -3
- package/src/workspace/status.ts +35 -2
- package/src/workspace/trust/seal.test.ts +232 -0
- package/src/workspace/trust/seal.ts +195 -0
- package/src/workspace/trust/ssh-commit.ts +2 -2
- package/src/workspace/work.test.ts +390 -0
- package/src/workspace/work.ts +163 -0
|
@@ -11,7 +11,8 @@ import { join } from "node:path";
|
|
|
11
11
|
import Ajv2020 from "ajv/dist/2020";
|
|
12
12
|
import { afterAll, describe, expect, test } from "vitest";
|
|
13
13
|
import { queryRecords, RECORDS_CONTRACT_VERSION, RECORDS_OUTPUT_SCHEMA_ID, type RecordsDocument } from "./records-cli";
|
|
14
|
-
import { READ_ERROR_CODES, RECORD_REASON_CODES, RECORD_WARNING_CODES } from "./records";
|
|
14
|
+
import { READ_ERROR_CODES, RECORD_REASON_CODES, RECORD_WARNING_CODES, recordTextDigest, REVIEW_REASON_CODES } from "./records";
|
|
15
|
+
import { WORK_WARNING_CODES } from "./work";
|
|
15
16
|
import schema from "./records.schema.json";
|
|
16
17
|
import { PROVENANCE_LEVELS } from "./trust/attestor";
|
|
17
18
|
|
|
@@ -93,8 +94,62 @@ describe("records output schema", () => {
|
|
|
93
94
|
expect(r?.warnings?.map((w) => w.code)).toEqual(["record-no-evidence"]);
|
|
94
95
|
});
|
|
95
96
|
|
|
97
|
+
test("lists exactly the codes a verdict is not counted for (#2671)", () => {
|
|
98
|
+
expect(schema.$defs.verdict.properties.reason.properties.code.enum).toEqual([...REVIEW_REASON_CODES]);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("every record carries its digest and quorum, and the chant repo's decisions need the default two (#2671, #2672)", async () => {
|
|
102
|
+
const doc = await queryRecords({ kind: KIND, current: true, cwd: REPO });
|
|
103
|
+
if ("error" in doc) throw new Error(doc.error.message);
|
|
104
|
+
for (const r of doc.records) {
|
|
105
|
+
expect(r.digest).toMatch(/^[0-9a-f]{64}$/);
|
|
106
|
+
expect(r.quorum).toMatchObject({ need: 2, needFrom: "default", agreed: 0, met: false, metWithObjections: false });
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test("a decision with verdicts validates, with each verdict counted or not and why (#2671, #2672)", async () => {
|
|
111
|
+
const root = copyDecisions();
|
|
112
|
+
const dir = join(root, "docs", "design", "decisions");
|
|
113
|
+
writeFileSync(
|
|
114
|
+
join(root, "chant.workspace.json"),
|
|
115
|
+
JSON.stringify({ name: "w", schema: 1, quorum: 1, members: [{ name: "docs", dir: "docs", kind: "other", because: "decisions only" }] }),
|
|
116
|
+
);
|
|
117
|
+
const base = readFileSync(join(dir, "ws-003-seal-scope.md"), "utf-8").replace(/^id: .*$/m, 'id: "ws-900"');
|
|
118
|
+
const digest = recordTextDigest(base);
|
|
119
|
+
const entry = (reviewer: string, verdict: string, extra = "") => ` - reviewer: "${reviewer}"\n verdict: "${verdict}"\n on: "2026-09-24"${extra}`;
|
|
120
|
+
const reviews = [
|
|
121
|
+
entry("alice", "agree", `\n digest: "${digest}"`),
|
|
122
|
+
entry("Alice ", "agree", `\n digest: "${digest}"`),
|
|
123
|
+
entry("lex00", "agree"),
|
|
124
|
+
entry("bob", "dissent", `\n note: "a case is missing"\n digest: "${"0".repeat(64)}"`),
|
|
125
|
+
];
|
|
126
|
+
writeFileSync(join(dir, "ws-900-extra.md"), base.replace(/^reviews: \[\]$/m, `reviews:\n${reviews.join("\n")}`));
|
|
127
|
+
const doc = await queryRecords({ kind: KIND, current: true, cwd: root });
|
|
128
|
+
expectValid(doc);
|
|
129
|
+
if ("error" in doc) throw new Error(doc.error.message);
|
|
130
|
+
const r = doc.records.find((x) => x.id === "ws-900")!;
|
|
131
|
+
expect(r.valid).toBe(true);
|
|
132
|
+
expect(r.digest).toBe(digest);
|
|
133
|
+
expect(r.warnings.map((w) => w.code)).toEqual(["review-undigested"]);
|
|
134
|
+
const q = r.quorum!;
|
|
135
|
+
expect(q).toMatchObject({ need: 1, needFrom: "declaration", agreed: 1, met: true, metWithObjections: true });
|
|
136
|
+
expect(q.counted.map((v) => v.reviewer)).toEqual(["Alice "]);
|
|
137
|
+
expect(q.notCounted.map((v) => [v.reviewer, v.reason?.code])).toEqual([
|
|
138
|
+
["alice", "review-duplicate"],
|
|
139
|
+
["lex00", "review-decider"],
|
|
140
|
+
["bob", "review-older-digest"],
|
|
141
|
+
]);
|
|
142
|
+
expect(q.openConcerns.map((c) => c.reviewer)).toEqual(["bob"]);
|
|
143
|
+
// A counted verdict with a reason, or a not-counted one without, is refused.
|
|
144
|
+
const bad = structuredClone(doc);
|
|
145
|
+
const record = bad.records.find((x) => x.id === "ws-900")!;
|
|
146
|
+
record.quorum!.counted[0].reason = { code: "review-duplicate", message: "x" };
|
|
147
|
+
expect(validate(bad)).toBe(false);
|
|
148
|
+
});
|
|
149
|
+
|
|
96
150
|
test("lists exactly the warning codes the code can return", () => {
|
|
97
|
-
|
|
151
|
+
// A work kind's records carry the work warnings too (#2683), work-done-gap-open included since records walks a done item's region (#2686).
|
|
152
|
+
expect(schema.$defs.warning.properties.code.enum).toEqual([...RECORD_WARNING_CODES, ...WORK_WARNING_CODES]);
|
|
98
153
|
});
|
|
99
154
|
|
|
100
155
|
test("every failure validates with its code", async () => {
|