@bakers-build/addon-forge 0.13.1-next.3 → 0.14.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.
@@ -6,8 +6,9 @@ export declare const TITLE_REFUSAL = "the title must be a Conventional Commits s
6
6
  export declare function isOwned(branch: string, branchName: string): boolean;
7
7
  export declare function ownershipRefusal(branch: string, branchName: string): string;
8
8
  /**
9
- * The ticket branch merges into `target_branch` (a deployment's environment
10
- * branch), else `base_branch`; a variant into the ticket branch.
9
+ * The ticket branch merges into `target_branch` (a ship's environment branch),
10
+ * else `base_branch`; a variant into the ticket branch, or into `base_branch`
11
+ * for a ship, whose variant carries a fix the source needs before the freeze.
11
12
  */
12
13
  export declare function derivedBase(branch: string, run: {
13
14
  branchName: string;
package/dist/src/rules.js CHANGED
@@ -25,13 +25,15 @@ export function ownershipRefusal(branch, branchName) {
25
25
  return `branch '${branch}' is not owned by this run: only '${branchName}' and '${branchName}-<suffix>' may be used`;
26
26
  }
27
27
  /**
28
- * The ticket branch merges into `target_branch` (a deployment's environment
29
- * branch), else `base_branch`; a variant into the ticket branch.
28
+ * The ticket branch merges into `target_branch` (a ship's environment branch),
29
+ * else `base_branch`; a variant into the ticket branch, or into `base_branch`
30
+ * for a ship, whose variant carries a fix the source needs before the freeze.
30
31
  */
31
32
  export function derivedBase(branch, run) {
32
- return branch === run.branchName
33
- ? (run.targetBranch ?? run.baseBranch)
34
- : run.branchName;
33
+ if (branch === run.branchName)
34
+ return run.targetBranch ?? run.baseBranch;
35
+ const ship = run.targetBranch !== undefined && run.targetBranch !== run.baseBranch;
36
+ return ship ? run.baseBranch : run.branchName;
35
37
  }
36
38
  /** Remove every secret and any Authorization header value. */
37
39
  export function redact(text, secrets) {
@@ -34,7 +34,7 @@ export const FORGE_TOOL_DEFINITIONS = {
34
34
  },
35
35
  },
36
36
  forge_pr_upsert: {
37
- description: "Create the PR/MR of an owned branch into its base (target_branch, which is base_branch unless a deployment names its environment branch; the ticket branch for a variant), or update the open one's title and body. The title must be a Conventional Commits subject.",
37
+ description: "Create the PR/MR of an owned branch into its base (target_branch, which is base_branch unless a ship names its environment branch; the ticket branch for a variant, base_branch for a ship's variant), or update the open one's title and body. The title must be a Conventional Commits subject.",
38
38
  input: {
39
39
  type: 'object',
40
40
  properties: {
package/dist/src/tools.js CHANGED
@@ -19,13 +19,11 @@ function runOf(req) {
19
19
  };
20
20
  }
21
21
  /**
22
- * Where `branch` merges: a variant into the ticket branch, the ticket branch into
23
- * the ticket's current target as the server returns it now. A failed read refuses;
24
- * the run copy may predate an environment added during the run.
22
+ * Where `branch` merges, by `derivedBase` on the ticket's current target as the
23
+ * server returns it now. A failed read refuses; the run copy may predate an
24
+ * environment added during the run.
25
25
  */
26
26
  async function currentBase(req, branch, run) {
27
- if (branch !== run.branchName)
28
- return derivedBase(branch, run);
29
27
  const refuse = (why) => new Error(`forge: the ticket's current target_branch could not be read from the server (${why}); nothing was sent`);
30
28
  if (!req.currentTicket)
31
29
  throw refuse('no server read for this call');
@@ -35,7 +33,11 @@ async function currentBase(req, branch, run) {
35
33
  const target = t.targetBranch ?? t.baseBranch;
36
34
  if (!target)
37
35
  throw refuse('no target_branch or base_branch returned');
38
- return target;
36
+ return derivedBase(branch, {
37
+ ...run,
38
+ baseBranch: t.baseBranch ?? run.baseBranch,
39
+ targetBranch: target,
40
+ });
39
41
  }
40
42
  /** The ticket's origin as the server returns it now, else the run's copy. */
41
43
  async function originOf(req) {
@@ -251,7 +253,6 @@ export function forgeTools(deps) {
251
253
  // One server read serves the base and the reviewers.
252
254
  const read = req.currentTicket;
253
255
  if (read) {
254
- // Lazy: a suffixed branch without the flag never reads the ticket.
255
256
  let once;
256
257
  req = { ...req, currentTicket: () => (once ??= read()) };
257
258
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-forge",
3
- "version": "0.13.1-next.3",
3
+ "version": "0.14.0",
4
4
  "description": "bakers.build forge tools: a sandboxed run fetches, pushes its own branches, opens its PR/MR, reads checks and merges through the conductor, which holds the token. Backends implement the ForgeBackend contract (./backend).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "directory": "bakers-cli/addons/forge"
23
23
  },
24
24
  "peerDependencies": {
25
- "@bakers-build/conductor": "^0.13.1-next.3",
26
- "@bakers-build/core": "^0.13.1-next.3"
25
+ "@bakers-build/conductor": "^0.14.0",
26
+ "@bakers-build/core": "^0.14.0"
27
27
  },
28
28
  "bakersBuild": {
29
- "commit": "5565691077f72d73f8a59330202b8c2f51777066",
30
- "channel": "next"
29
+ "commit": "9f7275a341fe96e9792bce6cd1bbc7b7afc1dcd0",
30
+ "channel": "latest"
31
31
  }
32
32
  }