@juangcarmona/lighthouse-sdlc 0.22.9 → 0.22.10

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juangcarmona/lighthouse-sdlc",
3
- "version": "0.22.9",
3
+ "version": "0.22.10",
4
4
  "type": "module",
5
5
  "description": "Provider-neutral SDLC skills, commands and route contracts for Lighthouse adopters",
6
6
  "repository": {
@@ -267,7 +267,19 @@ async function writeImplementationPullRequest(api, { snapshot, changes, body, ru
267
267
  const tree = verificationRefresh ? commit.tree : await api('git/trees', 'POST', { base_tree: commit.tree.sha, tree: entries });
268
268
  if (synchronization && tree.sha !== checkedTree) throw Error('Synchronized publication differs from the independently checked tree');
269
269
  const message = verificationRefresh ? `chore: refresh verification for issue #${snapshot.issue}\n\nLighthouse-CI-Base: ${snapshot.baseRevision}` : `feat: implement issue #${snapshot.issue}`;
270
- const created = await api('git/commits', 'POST', { message, tree: tree.sha, parents: synchronization ? [snapshot.sourceRevision, snapshot.baseRevision] : [snapshot.sourceRevision] });
270
+ const commitBody = { message, tree: tree.sha, parents: synchronization ? [snapshot.sourceRevision, snapshot.baseRevision] : [snapshot.sourceRevision] };
271
+ let created;
272
+ for (let attempt = 0; attempt < 3; attempt++) {
273
+ try { created = await api('git/commits', 'POST', commitBody); break; }
274
+ catch (error) {
275
+ // Recover only this explicit refusal, after observing the immutable tree; uncertain writes remain terminal.
276
+ if (attempt === 2 || error.status !== 422 || error.message !== 'GitHub POST git/commits: 422: Tree SHA does not exist' || !/^[a-f0-9]{40}$/.test(tree.sha ?? '')) throw error;
277
+ if ((await api(`git/trees/${tree.sha}`, 'GET', undefined, true))?.sha !== tree.sha) throw error;
278
+ await setTimeout(250 * 2 ** attempt);
279
+ await beforeWrite();
280
+ await checkEpicBase();
281
+ }
282
+ }
271
283
  await beforeWrite();
272
284
  await checkEpicBase();
273
285
  if (snapshot.productAlignment?.parent.pullRequest) {