Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

[NOJIRA] Expose adoption comparison action outputs - #4966

Merged
Vincent Liu (xiaogliu) merged 3 commits into
mainfrom
codex/adoption-guard-outputs-main
Jul 24, 2026
Merged

Vincent Liu (xiaogliu) merged 3 commits into
mainfrom
codex/adoption-guard-outputs-main

Conversation

@xiaogliu

Copy link
Copy Markdown
Contributor

Summary

Expose the adoption comparison already calculated by backpack-adoption-guard as GitHub Action outputs:

  • head-backpack-adoption
  • base-backpack-adoption
  • backpack-adoption-delta

This lets consuming workflows publish Head/Base/Delta in a PR comment without checking out the base ref or running the guard a second time. The existing Cortex JSON result schema is unchanged.

Why

The guard already calculates the comparison for PR evaluation, but previously only persisted the Head metric in its JSON file. Consumers therefore had to duplicate the Base calculation solely for presentation.

Consumer impact

This is a backwards-compatible, additive action API change. Consumers can use the new outputs after upgrading to the next guard release.

Apply the minor label.

Validation

  • Updated packages/backpack-adoption-guard/README.md
  • Added unit-test coverage for action outputs
  • Typecheck passed
  • Unit tests passed (5 tests)
  • Build passed
  • git diff --check passed
  • Accessibility tests — not applicable; this is a Node GitHub Action with no UI
  • Storybook examples — not applicable
  • Migration guide — not applicable; the change is additive and backwards compatible

Note: re-running checks after rebasing onto the latest main was blocked by transient npm registry ECONNRESET errors during dependency installation. The same cherry-picked change passed typecheck, tests, and build before the rebase.

Copilot AI review requested due to automatic review settings July 24, 2026 07:23
@xiaogliu Vincent Liu (xiaogliu) changed the title Expose adoption comparison action outputs [NOJIRA] Expose adoption comparison action outputs Jul 24, 2026
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Expose the adoption comparison already computed by backpack-adoption-guard as GitHub Action outputs, enabling downstream workflows to report Head/Base/Delta without re-running base analysis.

Changes:

  • Added head-backpack-adoption, base-backpack-adoption, and backpack-adoption-delta as Action outputs.
  • Implemented setOutput plumbing in the action IO layer and emits outputs from run.
  • Updated README and added unit test assertions for emitted outputs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/backpack-adoption-guard/src/action/run.ts Emits the new GitHub Action outputs based on the already-computed comparison.
packages/backpack-adoption-guard/src/action/run-test.ts Adds unit assertions verifying the outputs are set.
packages/backpack-adoption-guard/src/action/io.ts Extends ActionIO to include setOutput and wires it to @actions/core.
packages/backpack-adoption-guard/action.yml Declares the new outputs in the action metadata.
packages/backpack-adoption-guard/README.md Documents the new outputs for consumers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@xiaogliu Vincent Liu (xiaogliu) added the patch Patch production bug label Jul 24, 2026
@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

headBackpackPercentage,
} = result.comparison;

io.setOutput(ADOPTION_OUTPUTS.head, String(headBackpackPercentage));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action.yml/README says these outputs are "rounded to at most two decimal places," but this layer just does String(...) — the rounding actually happens upstream in the analyzer. So the documented format is accurate only by coincidence, and the tests (asserting String(result.comparison.…)) wouldn't catch a drift.

Either round explicitly here + assert the exact string in a test, or soften the docs to just "numeric string."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in e44da5d. Output formatting is now enforced at the action boundary: non-empty values use toFixed(2) and unavailable values remain empty strings. The action metadata and README now specify exactly two decimal places, and the tests assert concrete values (100.00, 0.00).

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@wpe1arhy Iris Li (wpe1arhy) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaogliu
Vincent Liu (xiaogliu) merged commit 2318b3f into main Jul 24, 2026
15 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the codex/adoption-guard-outputs-main branch July 24, 2026 09:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

patch Patch production bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants