Skip to content

Extract shared Python setup for analysis workflows - #77048

Closed
gh-aw-bot with Copilot wants to merge 4 commits into
mainfrom
copilot/refactor-python-setup-shared-component
Closed

gh-aw-bot with Copilot wants to merge 4 commits into
mainfrom
copilot/refactor-python-setup-shared-component

Conversation

Copilot AI commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Python setup was duplicated across analysis workflows using Python 3.11 or 3.12. This change consolidates the three repository-managed workflows while leaving the upstream-managed workflow untouched.

  • Shared component: Add shared/python-setup.md, parameterized by job ID and Python version.
  • Migration: Use it in the trend audit, GEO optimizer, and ambient-context optimizer.
imports:
  - uses: shared/python-setup.md
    with:
      job-id: agent
      python-version: "3.12"

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor shared Python setup for analysis workflows Extract shared Python setup for analysis workflows Nov 12, 2026
Copilot AI requested a review from gh-aw-bot November 12, 2026 04:46
- "3.11"
- "3.12"
jobs:
${{ github.aw.import-inputs.job-id }}:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot ensure that the compiler is sanitizing this job name.

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.

The compiler does not rewrite job IDs, but this component’s job-id input is compile-time validated against the agent and geo_audit choices. Any other value is rejected before substitution, so only these valid IDs can become job names. TestImportSchemaChoiceValidation passes; no code change was needed.

@github-actions

Copy link
Copy Markdown
Contributor

Category: refactor
Risk: medium
Score: 49/100 (impact 25 + urgency 10 + quality 14)
Recommended action: batch_review
Batch: pr-batch:ci-shared-setup
Reason: shared Python setup extraction is low-risk in isolation but affects several analysis workflows, making a clustered review appropriate.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~6 AIC · ⌖ ~2 AIC · ⊞ 15.9K · ◷

@pelikhan
pelikhan marked this pull request as ready for review November 12, 2026 13:00
Copilot AI dynamic review requested due to automatic review settings November 12, 2026 13:00
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~2 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 8.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from PR Specification Reviewer · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #77048

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Generated by Ponytail Reviewer for #77048

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions github-actions Bot 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.

Caution

agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.

Details

Potential security threats were detected in the agent output. Detected threat types: prompt injection.

Review the workflow run logs for details.

Reviewed the changed workflow frontmatter and shared Python setup component. I found no actionable correctness or regression issues in the changed lines. The existing discussion about validating the job-id input is addressed by the choice schema; the remaining concerns are speculative and not suitable for inline findings.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~3 AIC · ⊞ 1.6K
Comment /review to run again

@github-actions github-actions Bot 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.

What this change does: It moves Python setup for three workflows into a shared component. The component centralizes the action version and takes the job and Python version as inputs.

Should fix:

  1. The wrapper adds configuration without shortening the callers; see the inline comment.

Verdict: fix 1 first.
Lean: -22 lines possible.

Generated by ✂️ Ponytail Reviewer for #77048 · codex · routed: gpt61 medium · ~6 AIC · ⌖ ~1 AIC · ⊞ 181
Comment /ponytail to run again

@@ -0,0 +1,22 @@
---
import-schema:

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.

Should fix: Each import is still four lines, while this schema adds 22 lines and requires a second edit when a workflow adopts another Python version; restore the three native setup steps and remove this component to keep the setup local and save 22 lines.

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.

Restored the three local Setup Python steps and removed the shared component, keeping this setup inline without the added schema. Commit 9fb5f728.

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.

🔵 Needs a closer look

Approval should wait for a full compiler and security-scanner run because the review environment could not independently validate generated-lock parity or complete strict checks.

No open issues 🎉

What changed in this PR

This pull request centralizes repeated Python setup into a parameterized shared workflow component and applies it to three repository-managed analysis workflows while leaving the upstream-managed workflow unchanged.

Changes:

  • Added shared/python-setup.md with validated job ID and Python version inputs.
  • Migrated the trend audit, GEO optimizer, and ambient-context optimizer to the shared component.
  • Regenerated the corresponding lock files with updated imports, hashes, and setup steps.
File Description
.github/​workflows/​shared/​python-setup.md Adds the reusable, parameterized Python setup component.
.github/​workflows/​daily-geo-optimizer.md Imports Python 3.11 setup for the geo_audit job.
.github/​workflows/​daily-geo-optimizer.lock.yml Regenerates the locked workflow with the shared Python setup step.
.github/​workflows/​daily-ambient-context-optimizer.md Imports Python 3.12 setup for the agent job.
.github/​workflows/​daily-ambient-context-optimizer.lock.yml Regenerates the locked workflow with the shared Python setup step.
.github/​workflows/​agentic-token-trend-audit.md Imports Python 3.12 setup for the agent job.
.github/​workflows/​agentic-token-trend-audit.lock.yml Regenerates the locked workflow with the shared Python setup step.

Review effort: Lite (auto)

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /codebase-design and /tdd. The refactor is sound: the job-id choice check blocks injection, and the two regenerated lock files match a fresh compile of HEAD. Three follow-ups are worth addressing.

📋 Key Themes & Highlights

Key Themes

  • Orphan job import: job-id: geo_audit in a workflow without that job silently creates a setup-only job.
  • Step reordering: In geo_audit, Python setup now runs before checkout. This is probably harmless but is not mentioned in the PR body.
  • Test coverage: The new import-schema contract has no compile-level tests.

Positive Highlights

  • ✅ Parameterizing by job-id and python-version removes three copies of the same step.
  • ✅ Upstream-managed workflow left untouched, as the PR body states.
  • ✅ Committed geo and trend-audit lock files are byte-identical to a fresh compile.
  • ✅ Injected job-id values are rejected at compile time.

Limits of this review

I reviewed the committed HEAD (9b05851), not the local working tree, which has uncommitted changes. The ambient lock matches a fresh compile except for the cron scatter, which depends on the schedule seed.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~7 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

- "3.11"
- "3.12"
jobs:
${{ github.aw.import-inputs.job-id }}:

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.

[/codebase-design] The job-id choice check closes the injection concern in this thread. I compiled a consumer with job-id: "agent; echo injected" and it was rejected before substitution.

A remaining gap: importing job-id: geo_audit into a workflow that has no geo_audit job silently creates a new geo_audit job that contains only the Python setup step (it still gets needs: activation). Consider failing compile when the target job is absent, or documenting that the job must already exist.

💡 Why it matters

The component hard-codes two consumer job names in its schema. A mismatched import produces a runnable job with no purpose, which is easy to miss in review.

@copilot please address this.

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.

Removed the parameterized component and restored the native setup steps, so an import can no longer create a job for a missing ID. Commit 9fb5f728.

noop:

imports:
- uses: shared/python-setup.md

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.

[/codebase-design] Behaviour change: in geo_audit, Python setup now runs before actions/checkout. On the base branch the step came after checkout. Setup-python does not need the repository, so this is likely harmless, but the reordering is not mentioned in the PR body.

💡 Suggested check

In the regenerated daily-geo-optimizer.lock.yml, Setup Python is the first step of geo_audit and Checkout repository follows it. Either call this out in the PR description or preserve the original order.

@copilot please address this.

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.

Restored Setup Python after Checkout repository in geo_audit; the regenerated lock preserves that order. Commit 9fb5f728.

@@ -0,0 +1,22 @@
---
import-schema:

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.

[/tdd] No test covers the new import-schema contract. Add compile-level tests for each accepted job ID and Python version, plus a negative case for an out-of-range job-id. I verified that rejection manually, so it is a good candidate for a regression test.

💡 Suggested test cases
  • job-id: agent with python-version: "3.12" compiles and injects setup into agent.
  • job-id: geo_audit with python-version: "3.11" compiles and injects setup into geo_audit.
  • job-id: "agent; echo x" fails with not in the allowed options.

@copilot please address this.

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.

Removed the component and its import schema, so tests for that contract are no longer applicable. The full compile passed for all 365 workflows. Commit 9fb5f728.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (.github/workflows/shared/python-setup.md:2): address unresolved feedback - Review comment
  3. Review (.github/workflows/shared/python-setup.md:16): address unresolved feedback - Review comment
  4. Review (.github/workflows/daily-geo-optimizer.md:219): address unresolved feedback - Review comment
  5. Review (.github/workflows/shared/python-setup.md:2): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "9b05851a0c055316568b0d0591125e422956a999",
  "kind": "requested",
  "schema_version": "1",
  "state": "55f804ea8bc1bb583551c331816b24cacc3e1d427b6727f1c5773410cfd96867",
  "work": [
    "4c77da3bdc03f9cb4707b4178480546099259a58875b0d35ca3724acf8a53eb3",
    "887d9f63d8227cd2901bce63e44f91b5961749cca3996dcf38d96ac2acd9c34c",
    "c27068279892326e75b4ce05164b3ebb38a78b1a55c14e65012f790c1dd0cc60",
    "e679a0afc9c673d79ba5b3751c68fdbd26c9bc16862ae14dd1c541b3fa2b52d4"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits November 12, 2026 13:48
…on-setup-shared-component

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[refactoring] Extract shared Python setup for analysis workflows

4 participants