@codyswann/lisa 5.1.7 → 5.2.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.
Files changed (101) hide show
  1. package/all/copy-overwrite/scripts/lib/github-attestation-provider.mjs +15 -0
  2. package/all/copy-overwrite/scripts/lib/npm-update-allocate.mjs +32 -39
  3. package/all/copy-overwrite/scripts/lib/npm-update-authorization.mjs +12 -2
  4. package/all/copy-overwrite/scripts/lib/npm-update-checkpoint.mjs +10 -30
  5. package/all/copy-overwrite/scripts/lib/npm-update-execution-adapter.mjs +4 -1
  6. package/all/copy-overwrite/scripts/lib/npm-update-helper-graph.mjs +1 -1
  7. package/all/copy-overwrite/scripts/lib/npm-update-helper-inventory.mjs +4 -0
  8. package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +2 -1
  9. package/all/copy-overwrite/scripts/lib/npm-update-invariants.mjs +15 -1
  10. package/all/copy-overwrite/scripts/lib/npm-update-leaf-contract.mjs +41 -9
  11. package/all/copy-overwrite/scripts/lib/npm-update-leaf.mjs +23 -35
  12. package/all/copy-overwrite/scripts/lib/npm-update-policy.mjs +41 -6
  13. package/all/copy-overwrite/scripts/lib/npm-update-recovery.mjs +16 -3
  14. package/all/copy-overwrite/scripts/lib/npm-update-tracker-jira.mjs +300 -0
  15. package/all/copy-overwrite/scripts/lib/npm-update-tracker-linear.mjs +304 -0
  16. package/all/copy-overwrite/scripts/lib/npm-update-tracker-wire.mjs +298 -0
  17. package/all/copy-overwrite/scripts/lib/npm-update-tracker.mjs +179 -0
  18. package/all/copy-overwrite/scripts/lisa-npm-updater.mjs +16 -2
  19. package/all/copy-overwrite/scripts/lisa-work-item.mjs +1 -1
  20. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +62 -14
  21. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  22. package/dist/core/lisa-owned-hash-ledger.js +96 -0
  23. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  24. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  25. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  26. package/dist/core/upstream-evidence-manifest.js +84 -77
  27. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  28. package/package.json +4 -5
  29. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  30. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  31. package/plugins/lisa-agy/plugin.json +1 -1
  32. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  33. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  34. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  35. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  37. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  39. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  40. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  43. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  44. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  45. package/plugins/lisa-expo-agy/plugin.json +1 -1
  46. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  47. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  50. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  51. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  52. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  53. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  54. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  57. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  59. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  60. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  61. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  64. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  66. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  67. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  68. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  71. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  72. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  73. package/plugins/lisa-rails-agy/plugin.json +1 -1
  74. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  75. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  78. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  79. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  80. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  81. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  85. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  86. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  87. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  88. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  91. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  92. package/scripts/check-phrase-manifest-parity.mjs +6 -3
  93. package/scripts/classify-phrase-tests.mjs +109 -20
  94. package/scripts/fix-namespace-test-assertions.mjs +3 -20
  95. package/scripts/lib/phrase-tests/doc-taint.mjs +708 -0
  96. package/scripts/lib/phrase-tests/inventory.mjs +381 -0
  97. package/scripts/lib/phrase-tests/manifest.mjs +14 -2
  98. package/scripts/lib/phrase-tests/marker-classes.mjs +323 -0
  99. package/scripts/lib/phrase-tests/redact.mjs +88 -0
  100. package/scripts/two-channel-couplings.json +1 -1
  101. package/typescript/copy-overwrite/.prettierignore +4 -0
@@ -10,6 +10,45 @@ export const NAME = /^(?:@[a-z0-9][a-z0-9_.-]*\/)?[a-z0-9][a-z0-9_.-]*$/;
10
10
  export const VERSION =
11
11
  /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[A-Za-z0-9.-]+)?$/;
12
12
 
13
+ /** Each tracker names its maintainer by its own identifier: GitHub login, Jira accountId, Linear user id. */
14
+ const MAINTAINER = {
15
+ github: /^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/,
16
+ jira: /^[A-Za-z0-9][A-Za-z0-9:-]{0,127}$/,
17
+ linear: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,
18
+ };
19
+ const KEY = /^[A-Z][A-Z0-9]{1,9}$/;
20
+
21
+ /**
22
+ * GitHub keeps its exact original check. Jira and Linear hosts still publish to
23
+ * the configured GitHub code host, so a configured GitHub repository must match;
24
+ * their own work items live in the configured project or team.
25
+ */
26
+ function trackerScope(value, config) {
27
+ if (config.tracker !== "jira" && config.tracker !== "linear") {
28
+ required(
29
+ config.tracker === "github" &&
30
+ value.repository === `${config.github?.org}/${config.github?.repo}`,
31
+ "configured repository/tracker differs"
32
+ );
33
+ return;
34
+ }
35
+ const key =
36
+ config.tracker === "jira" ? config.jira?.project : config.linear?.teamKey;
37
+ required(
38
+ typeof key === "string" &&
39
+ KEY.test(key.trim().toUpperCase()) &&
40
+ (config.tracker === "jira" ||
41
+ (typeof config.linear?.workspace === "string" &&
42
+ config.linear.workspace.trim().length > 0)),
43
+ "configured tracker lacks its project, team or workspace"
44
+ );
45
+ required(
46
+ !config.github?.org ||
47
+ value.repository === `${config.github.org}/${config.github.repo}`,
48
+ "configured repository/tracker differs"
49
+ );
50
+ }
51
+
13
52
  /** Configured tracking and an explicit owner are prerequisites, never inferred. */
14
53
  export function validatePolicy(value, config) {
15
54
  keys(value, [
@@ -34,18 +73,14 @@ export function validatePolicy(value, config) {
34
73
  (value.lisaOwner === "absent" && !Object.hasOwn(value, "runtime")),
35
74
  "a subdirectory npm project has no Lisa owner or runtime profile"
36
75
  );
37
- required(
38
- config.tracker === "github" &&
39
- value.repository === `${config.github?.org}/${config.github?.repo}`,
40
- "configured repository/tracker differs"
41
- );
76
+ trackerScope(value, config);
42
77
  required(
43
78
  /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(value.repository),
44
79
  "invalid repository"
45
80
  );
46
81
  required(
47
82
  typeof value.maintainer === "string" &&
48
- /^[A-Za-z0-9][A-Za-z0-9-]{0,38}$/.test(value.maintainer),
83
+ MAINTAINER[config.tracker].test(value.maintainer),
49
84
  "explicit assignable maintainer required"
50
85
  );
51
86
  required(
@@ -21,6 +21,12 @@ import {
21
21
  } from "./github-attestation-recovery.mjs";
22
22
  import { persistCheckpoint } from "./npm-update-checkpoint.mjs";
23
23
  import { required, validateProposal } from "./npm-update-contract.mjs";
24
+ import {
25
+ trackerFor,
26
+ refuseUnlessGithub,
27
+ verifySignedWorkItem,
28
+ proveTrackerProvider,
29
+ } from "./npm-update-tracker.mjs";
24
30
 
25
31
  import {
26
32
  decodeCheckpoint,
@@ -172,11 +178,17 @@ export async function finalizeAuthorization({
172
178
  );
173
179
  const mode = readJson(join(output, "authorization.json")).mode;
174
180
  if (mode === "recovery") {
181
+ refuseUnlessGithub(config, "signed-origin recovery");
175
182
  verifyRenewal({ api, preview, paths, digest, proposal, issue, policy });
176
183
  } else {
177
184
  required(mode === "origin", "unknown authorization role");
178
185
  verifyDescriptorAttestation(api.policy, preview.descriptor, paths, digest);
179
- verifyCurrentProvider(api.policy, preview.descriptor);
186
+ if (config.tracker === "github")
187
+ verifyCurrentProvider(api.policy, preview.descriptor);
188
+ else {
189
+ verifySignedWorkItem(config, allocation, preview);
190
+ await proveTrackerProvider(api, preview.descriptor, config);
191
+ }
180
192
  await persistCheckpoint(
181
193
  api,
182
194
  allocation.number,
@@ -188,11 +200,12 @@ export async function finalizeAuthorization({
188
200
  bundle: readBytes(paths.bundle, 1_048_576).toString("utf8"),
189
201
  },
190
202
  digest,
191
- () => authorizeAllocation(api, proposal, allocation, policy, config)
203
+ () => authorizeAllocation(api, proposal, allocation, policy, config),
204
+ config
192
205
  );
193
206
  }
194
207
  const checkpoint = locateCheckpoint(
195
- (await api.issue(allocation.number)).comments,
208
+ (await trackerFor(api, policy, config).issue(allocation.number)).comments,
196
209
  proposal,
197
210
  policy
198
211
  );
@@ -0,0 +1,300 @@
1
+ // This file is managed by Lisa and IS replaced on each `lisa` run.
2
+ // Do not edit directly — durable changes belong upstream in Lisa.
3
+
4
+ /**
5
+ * @file npm-update-tracker-jira.mjs
6
+ * @description Jira REST v3 tracker adapter for the npm updater (CodySwannGT/lisa#4859).
7
+ * Tickets are normalized into the GitHub-issue record the claim, hold, quality and
8
+ * checkpoint checks already read; managed text is stored as one ADF code block.
9
+ * @module npm-updater
10
+ */
11
+ import { required } from "./npm-update-invariants.mjs";
12
+ import { sha256 } from "./github-attestation-verifier.mjs";
13
+ import { trackerContract } from "../lisa-work-item.mjs";
14
+ import {
15
+ trackerCredentials,
16
+ jsonCall,
17
+ adfCodeBlock,
18
+ adfText,
19
+ adfProse,
20
+ lifecycleName,
21
+ vocabularyRefusal,
22
+ withinJiraLimit,
23
+ strandedRefusal,
24
+ vendorLabels,
25
+ } from "./npm-update-tracker-wire.mjs";
26
+
27
+ const API = "/rest/api/3";
28
+ const FIELDS =
29
+ "summary,description,status,issuetype,priority,labels,assignee,subtasks,issuelinks";
30
+
31
+ /** Done-category statuses are closed history, never claimable. */
32
+ function stateOf(status) {
33
+ return status?.statusCategory?.key === "done" ? "closed" : "open";
34
+ }
35
+
36
+ /** Issue type and priority surface as the label names the shared checks require. */
37
+ function typeLabels(fields) {
38
+ const type = fields.issuetype ?? {};
39
+ return [
40
+ type.subtask ? "type:Sub-task" : `type:${type.name}`,
41
+ ...(fields.priority?.name === "Medium" ? ["priority:medium"] : []),
42
+ ];
43
+ }
44
+
45
+ /** An account's comment is managed only when it is the API credential's own account. */
46
+ function commentRecord(comment) {
47
+ return {
48
+ id: String(comment.id),
49
+ body: adfText(comment.body),
50
+ prose: adfProse(comment.body),
51
+ user: {
52
+ id: comment.author?.accountId,
53
+ type: comment.author?.accountType === "app" ? "Bot" : "User",
54
+ },
55
+ };
56
+ }
57
+
58
+ export class JiraTracker {
59
+ constructor(config, env, transport = globalThis.fetch) {
60
+ const credentials = trackerCredentials(config, env);
61
+ this.provider = "jira";
62
+ this.key = config.jira.project.trim().toUpperCase();
63
+ this.lifecycle = trackerContract(config).lifecycle;
64
+ this.baseUrl = credentials.baseUrl;
65
+ this.authorization = credentials.authorization;
66
+ this.transport = transport;
67
+ }
68
+ call(path, purpose, method = "GET", body) {
69
+ return jsonCall(
70
+ this.transport,
71
+ `${this.baseUrl}${API}${path}`,
72
+ { method, body, authorization: this.authorization },
73
+ purpose
74
+ );
75
+ }
76
+ ref(number) {
77
+ return `${this.key}-${number}`;
78
+ }
79
+ /** The decimal ticket number of an exact key in the configured project. */
80
+ numberOf(key) {
81
+ const match = new RegExp(`^${this.key}-([1-9]\\d*)$`).exec(String(key));
82
+ required(match, "tracker search reply differs");
83
+ return Number(match[1]);
84
+ }
85
+ async myself() {
86
+ this.accountId ??= (await this.call("/myself", "unclassified"))?.accountId;
87
+ required(
88
+ typeof this.accountId === "string",
89
+ "tracker identity unavailable"
90
+ );
91
+ return this.accountId;
92
+ }
93
+ async issue(number) {
94
+ required(
95
+ Number.isSafeInteger(number) && number > 0,
96
+ "invalid live issue number"
97
+ );
98
+ const ticket = await this.call(
99
+ `/issue/${this.ref(number)}?fields=${FIELDS}`,
100
+ "issue"
101
+ );
102
+ required(ticket?.key === this.ref(number), "live issue scope differs");
103
+ const fields = ticket.fields ?? {};
104
+ return {
105
+ number,
106
+ title: fields.summary,
107
+ body: adfText(fields.description),
108
+ state: stateOf(fields.status),
109
+ labels: [
110
+ lifecycleName(this.lifecycle, fields.status?.name),
111
+ ...typeLabels(fields),
112
+ ...vendorLabels(this.lifecycle, fields.labels),
113
+ ].map(name => ({ name })),
114
+ assignees: fields.assignee
115
+ ? [
116
+ {
117
+ login: fields.assignee.accountId,
118
+ type:
119
+ fields.assignee.accountType === "atlassian" ? "User" : "App",
120
+ },
121
+ ]
122
+ : [],
123
+ comments: await this.comments(number),
124
+ children: fields.subtasks ?? [],
125
+ blockers: (fields.issuelinks ?? [])
126
+ .filter(
127
+ link => link.type?.inward === "is blocked by" && link.inwardIssue
128
+ )
129
+ .map(link => ({ state: stateOf(link.inwardIssue.fields?.status) })),
130
+ };
131
+ }
132
+ async comments(number) {
133
+ const entries = [];
134
+ for (let page = 0; page < 20; page++) {
135
+ const reply = await this.call(
136
+ `/issue/${this.ref(number)}/comment?startAt=${entries.length}&maxResults=100`,
137
+ "issue-comments"
138
+ );
139
+ required(Array.isArray(reply?.comments), "provider page is not an array");
140
+ entries.push(...reply.comments.map(commentRecord));
141
+ if (!reply.comments.length || entries.length >= reply.total)
142
+ return entries;
143
+ }
144
+ throw new Error("npm updater: provider pagination exceeded bound");
145
+ }
146
+ async search(jql) {
147
+ const reply = await this.call("/search/jql", "issue-search", "POST", {
148
+ jql,
149
+ fields: ["status"],
150
+ maxResults: 100,
151
+ });
152
+ required(Array.isArray(reply?.issues), "tracker search reply differs");
153
+ return {
154
+ incomplete_results: reply.isLast !== true,
155
+ total_count: reply.issues.length,
156
+ items: reply.issues.map(item => ({
157
+ number: this.numberOf(item.key),
158
+ state: stateOf(item.fields?.status),
159
+ })),
160
+ };
161
+ }
162
+ /** The exact selection label, not full-text ranking, finds a prior proposal. */
163
+ searchPrior(proposal) {
164
+ return this.search(
165
+ `project = "${this.key}" AND labels = "lisa-npm-${proposal.selectionKey}"`
166
+ );
167
+ }
168
+ async relationships() {
169
+ const query = `project = "${this.key}" AND (summary ~ "npm" OR description ~ "npm")`;
170
+ return { ...(await this.search(query)), query };
171
+ }
172
+ async vocabulary() {
173
+ const types = await this.call(
174
+ `/project/${this.key}/statuses`,
175
+ "unclassified"
176
+ );
177
+ const task = (Array.isArray(types) ? types : []).find(
178
+ type => type.name === "Task"
179
+ );
180
+ const priorities = await this.call("/priority", "unclassified");
181
+ return [
182
+ ...(task ? ["type:Task"] : []),
183
+ ...((Array.isArray(priorities) ? priorities : []).some(
184
+ priority => priority.name === "Medium"
185
+ )
186
+ ? ["priority:medium"]
187
+ : []),
188
+ ...(task?.statuses ?? []).map(status =>
189
+ lifecycleName(this.lifecycle, status.name)
190
+ ),
191
+ ];
192
+ }
193
+ async ensureRole() {
194
+ throw vocabularyRefusal("Jira");
195
+ }
196
+ async createLeaf(draft, proposal) {
197
+ const fields = {
198
+ project: { key: this.key },
199
+ issuetype: { name: "Task" },
200
+ summary: draft.title,
201
+ description: adfCodeBlock(withinJiraLimit(draft.body)),
202
+ labels: [`lisa-npm-${proposal.selectionKey}`],
203
+ priority: { name: "Medium" },
204
+ assignee: { accountId: draft.assignees[0] },
205
+ };
206
+ const created = await this.call("/issue", "issue", "POST", { fields });
207
+ const number = this.numberOf(created?.key);
208
+ try {
209
+ await this.moveTo(number, this.lifecycle.ready);
210
+ } catch {
211
+ throw strandedRefusal(this.ref(number), this.lifecycle.ready);
212
+ }
213
+ return { number };
214
+ }
215
+ /** Exactly one workflow transition must reach the named status; none is ever guessed. */
216
+ async moveTo(number, name) {
217
+ const current = await this.call(
218
+ `/issue/${this.ref(number)}?fields=status`,
219
+ "issue"
220
+ );
221
+ if (current?.fields?.status?.name?.toLowerCase() === name.toLowerCase())
222
+ return;
223
+ const path = `/issue/${this.ref(number)}/transitions`;
224
+ const options = (await this.call(path, "issue"))?.transitions ?? [];
225
+ const matches = options.filter(
226
+ option => option.to?.name?.toLowerCase() === name.toLowerCase()
227
+ );
228
+ if (matches.length !== 1) throw vocabularyRefusal("Jira");
229
+ await this.call(path, "issue", "POST", {
230
+ transition: { id: matches[0].id },
231
+ });
232
+ }
233
+ async assignable(accountId) {
234
+ const users = await this.call(
235
+ `/user/assignable/search?project=${encodeURIComponent(this.key)}&accountId=${encodeURIComponent(accountId)}`,
236
+ "unclassified"
237
+ );
238
+ required(
239
+ Array.isArray(users) &&
240
+ users.length === 1 &&
241
+ users[0].accountId === accountId &&
242
+ users[0].active === true,
243
+ "trusted maintainer is not currently assignable"
244
+ );
245
+ }
246
+ async assign(number, accountId) {
247
+ await this.call(`/issue/${this.ref(number)}/assignee`, "issue", "PUT", {
248
+ accountId,
249
+ });
250
+ }
251
+ async transition(issue, roles) {
252
+ await this.moveTo(issue.number, roles.claimed);
253
+ }
254
+ async comment(number, text) {
255
+ const created = await this.call(
256
+ `/issue/${this.ref(number)}/comment`,
257
+ "issue-comments",
258
+ "POST",
259
+ { body: adfCodeBlock(withinJiraLimit(text)) }
260
+ );
261
+ required(
262
+ /^[1-9]\d*$/.test(String(created?.id)) && adfText(created.body) === text,
263
+ "checkpoint write readback differs"
264
+ );
265
+ return created;
266
+ }
267
+ /** The issue-scoped comment path is itself the scope proof: Jira answers 404 elsewhere. */
268
+ async durableComment(number, text) {
269
+ const created = await this.comment(number, text);
270
+ const read = await this.call(
271
+ `/issue/${this.ref(number)}/comment/${created.id}`,
272
+ "issue-comment"
273
+ );
274
+ required(
275
+ String(read?.id) === String(created.id) && adfText(read.body) === text,
276
+ "checkpoint immediate readback differs"
277
+ );
278
+ }
279
+ /** The credential's own account, whether a person or an app/service account. */
280
+ async isManagedActor(user) {
281
+ return typeof user?.id === "string" && user.id === (await this.myself());
282
+ }
283
+ async proveClaim(descriptor) {
284
+ const number = this.numberOf(descriptor.workItem);
285
+ required(
286
+ /^[1-9]\d*$/.test(String(descriptor.claimCommentId)),
287
+ "current tracker claim differs"
288
+ );
289
+ const comment = await this.call(
290
+ `/issue/${this.ref(number)}/comment/${descriptor.claimCommentId}`,
291
+ "issue-comment"
292
+ );
293
+ required(
294
+ String(comment?.id) === descriptor.claimCommentId &&
295
+ comment.author?.accountId === (await this.myself()) &&
296
+ sha256(adfText(comment.body)) === descriptor.claimSha256,
297
+ "current tracker claim differs"
298
+ );
299
+ }
300
+ }