Skip to content

[HOLD FOR INTAKE] feature AIENG-624: add --from-github-actions option to subset command - #1358

Open
mnamachivayam wants to merge 1 commit into
mainfrom
feature/AIENG-624-CLI-Add-from-github-actions-option-to-Subset-command
Open

[HOLD FOR INTAKE] feature AIENG-624: add --from-github-actions option to subset command#1358
mnamachivayam wants to merge 1 commit into
mainfrom
feature/AIENG-624-CLI-Add-from-github-actions-option-to-Subset-command

Conversation

@mnamachivayam

@mnamachivayam mnamachivayam commented Aug 5, 2026

Copy link
Copy Markdown

Summary

Adds a --from-github-actions flag to smart-tests subset, selecting the GitHub App flow where the server creates the build and test session implicitly from the GitHub Actions environment instead of the client passing a --session.

This unblocks GitHub App users, for whom commit/file-change data isn't available at subset time and test sessions were always created in Observation Mode — so real subsetting never occurred.

With the flag set, the CLI detects GITHUB_RUN_ID, GITHUB_RUN_ATTEMPT, GITHUB_REPOSITORY, GITHUB_JOB and RUNNER_NAME and sends them in the subset payload (fromGithubActions, githubActionsRunId, githubActionsRunAttempt, githubActionsJobName, githubActionsRunnerName, repositoryOwner, repositoryName), so the server can resolve commit and file change data via the GitHub API and subset in non-Observation mode.

- name: Run tests with Smart Tests
  run: |
    smart-tests subset --from-github-actions maven --target 80% src/test/java > subset.txt
    mvn test -Dsurefire.includesFile=subset.txt

Flag behaviour

Invocation Result
--from-github-actions, no --session GitHub App flow
--session only classic flow, unchanged
both error (contradictory intent)
neither error (existing behaviour)
--from-github-actions outside GitHub Actions error
--from-github-actions with a missing/malformed variable error naming the variable
--from-github-actions --non-blocking warning; --non-blocking ignored

Test plan

  • 6 new tests covering the GitHub App payload, the --session conflict, running outside GitHub Actions, a missing variable, a malformed GITHUB_REPOSITORY, and the no-flag/no-session error
  • Full suite: 497 tests pass
  • flake8 and mypy clean
  • Manually exercised the flow and each error path against the CLI

🤖 Generated with Claude Code

@mnamachivayam mnamachivayam self-assigned this Aug 5, 2026
@mnamachivayam mnamachivayam added enhancement New feature or request tagpr:minor Smart Tests CLI The next gen CLI labels Aug 5, 2026
@mnamachivayam
mnamachivayam force-pushed the feature/AIENG-624-CLI-Add-from-github-actions-option-to-Subset-command branch 2 times, most recently from bc23e2d to 8e5c74a Compare August 5, 2026 10:09
@mnamachivayam mnamachivayam changed the title feature AIENG-625: add --from-github-actions option to subset command feature AIENG-624: add --from-github-actions option to subset command Aug 5, 2026
@mnamachivayam
mnamachivayam force-pushed the feature/AIENG-624-CLI-Add-from-github-actions-option-to-Subset-command branch from 8e5c74a to 9539a39 Compare August 5, 2026 10:54

@Konboi Konboi 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

"""Raised when running inside GitHub Actions but the environment is missing or malformed."""


def detect_github_action_context(env: Mapping[str, str]) -> dict[str, str] | None:

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.

👍

@mnamachivayam mnamachivayam changed the title feature AIENG-624: add --from-github-actions option to subset command [HOLD FOR INTAKE] feature AIENG-624: add --from-github-actions option to subset command Aug 7, 2026
Adds the GitHub App subset flow, where the server creates the build and
test session implicitly from the GitHub Actions environment instead of the
client passing a --session.

With the flag set, the CLI detects GITHUB_RUN_ID, GITHUB_RUN_ATTEMPT,
GITHUB_REPOSITORY, GITHUB_JOB and RUNNER_NAME and sends them in the subset
payload, so the server can resolve commit and file change data via the
GitHub API and subset in non-Observation mode.

--session becomes optional, and --non-blocking is ignored in this flow.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mnamachivayam
mnamachivayam force-pushed the feature/AIENG-624-CLI-Add-from-github-actions-option-to-Subset-command branch from 9539a39 to 37cc554 Compare August 10, 2026 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Smart Tests CLI The next gen CLI tagpr:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants