Add safe coverage artifact upload guidance - #54875
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot this safe output should use this action and introduce a completely new safe output "upload-code-coverage" |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a safe-output pipeline for staging Cobertura reports and publishing them through GitHub’s code coverage API.
Changes:
- Adds
upload-code-coverageconfiguration, validation, handlers, and jobs. - Adds
code-qualitypermissions and action pins. - Updates coverage guidance, schemas, types, and tests.
Show a summary per file
| File | Description |
|---|---|
pkg/workflow/safe_outputs_validation_config.go |
Validates coverage metadata. |
pkg/workflow/safe_outputs_tools_computation.go |
Enables the coverage tool. |
pkg/workflow/safe_outputs_state.go |
Tracks coverage output state. |
pkg/workflow/safe_outputs_max_validation.go |
Validates upload limits. |
pkg/workflow/safe_outputs_handler_registry.go |
Registers handler configuration. |
pkg/workflow/safe_outputs_config_types.go |
Defines coverage configuration. |
pkg/workflow/safe_outputs_config_extraction.go |
Parses coverage configuration. |
pkg/workflow/safe_output_handlers.go |
Registers the safe-output descriptor. |
pkg/workflow/publish_code_coverage.go |
Builds staging and upload jobs. |
pkg/workflow/publish_code_coverage_test.go |
Tests parsing and job generation. |
pkg/workflow/permissions.go |
Adds code-quality scope. |
pkg/workflow/permissions_operations_test.go |
Updates permission tests. |
pkg/workflow/permissions_factory.go |
Defines upload-job permissions. |
pkg/workflow/mcp_setup_safe_outputs.go |
Creates the staging directory. |
pkg/workflow/js/safe_outputs_tools.json |
Adds the generated tool schema. |
pkg/workflow/frontmatter_types.go |
Models code-quality. |
pkg/workflow/frontmatter_serialization.go |
Serializes the permission. |
pkg/workflow/frontmatter_parsing.go |
Parses the permission. |
pkg/workflow/data/action_pins.json |
Pins the coverage action. |
pkg/workflow/dangerous_permissions_validation_test.go |
Updates write-scope count. |
pkg/workflow/compiler_yaml_post_agent.go |
Uploads staged coverage. |
pkg/workflow/compiler_safe_outputs_job.go |
Exposes coverage outputs. |
pkg/workflow/compiler_safe_output_jobs.go |
Adds the dedicated upload job. |
pkg/parser/schemas/main_workflow_schema.json |
Documents and validates configuration. |
pkg/parser/schema_errors.go |
Lists the new permission scope. |
pkg/constants/job_constants.go |
Defines the upload job name. |
pkg/cli/lint_command.go |
Suppresses pending actionlint support. |
pkg/actionpins/data/action_pins.json |
Adds the canonical action pin. |
docs/public/editor/autocomplete-data.json |
Adds editor permission completion. |
actions/setup/js/upload_code_coverage.test.cjs |
Tests the handler factory. |
actions/setup/js/upload_code_coverage.cjs |
Records coverage metadata. |
actions/setup/js/types/safe-outputs.d.ts |
Types coverage messages. |
actions/setup/js/types/safe-outputs-config.d.ts |
Types coverage configuration. |
actions/setup/js/safe_outputs_tools.json |
Exposes the setup-action tool schema. |
actions/setup/js/safe_outputs_tools_loader.cjs |
Attaches the MCP handler. |
actions/setup/js/safe_outputs_handlers.test.cjs |
Tests staging and path safety. |
actions/setup/js/safe_outputs_handlers.cjs |
Stages requested report files. |
actions/setup/js/safe_output_handler_manager.cjs |
Routes and reports coverage handling. |
.github/aw/test-coverage.md |
Updates fallback coverage guidance. |
.github/aw/actions-lock.json |
Locks the coverage action version. |
Review details
Suppressed comments (1)
.github/aw/test-coverage.md:54
- Use the actual command name
gocover-cobertura, consistent with the Go example below;go-coberturawould send agents looking for the wrong tool.
- convert the freshly generated coverage report to Cobertura XML format (e.g. `coverage.py xml`, `go-cobertura`, or a JaCoCo/Istanbul Cobertura reporter), stage it under `$RUNNER_TEMP/gh-aw/safeoutputs/upload-code-coverage/`, and call `upload_code_coverage` with `file: "cobertura.xml"`, `language` set to the inferred ecosystem's Linguist name (e.g. `"Go"`, `"Python"`, `"JavaScript"`), and a descriptive `label` (e.g. `"code-coverage/fallback"`)
- Files reviewed: 37/39 changed files
- Comments generated: 4
- Review effort level: Balanced
| if (typeof entry.file === "string" && path.isAbsolute(entry.file)) { | ||
| const filePath = entry.file; |
There was a problem hiding this comment.
Fixed in c900666: upload_code_coverage now resolves relative paths from staging/workspace, enforces GITHUB_WORKSPACE/coverage (or staging) as allowed roots, validates the resolved file, and rewrites staged output safely.
| if cfg.GitHubToken != "" { | ||
| steps = append(steps, fmt.Sprintf(" token: %s\n", getEffectiveSafeOutputGitHubToken(cfg.GitHubToken))) | ||
| } |
There was a problem hiding this comment.
Fixed in c900666: the upload job now applies token precedence (upload-code-coverage.github-token → safe-outputs.github-token), mints a job-local GitHub App token when configured, and always passes an explicit token input.
| waitForProcessingTimeout := defaultCodeCoverageWaitForProcessingTimeout | ||
| if cfg.WaitForProcessingTimeout > 0 { | ||
| waitForProcessingTimeout = cfg.WaitForProcessingTimeout | ||
| } |
There was a problem hiding this comment.
Fixed in c900666: wait-for-processing-timeout now renders the parsed value directly, so explicit 0 is preserved instead of being replaced with 160.
|
@copilot this PR looks close, but it still needs a maintainer-ready finish.
Run: https://github.com/github/gh-aw/actions/runs/32592579426
|
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>
Addressed in |
| - Choose workflow architecture and patterns: `.github/aw/patterns.md` | ||
| - Optimize token usage and cost: `.github/aw/token-optimization.md` | ||
| - Design long-running multi-agent research workflows: `.github/aw/multi-agent-research.md` | ||
| - Add skills or agent plugins requested by the user (`skills:` / `plugins:` frontmatter, never on-the-fly installs): `.github/aw/skills.md` |
There was a problem hiding this comment.
@copilot patch the go code that generate this file to generate this paragraph
There was a problem hiding this comment.
Patched the Go generator in pkg/cli/copilot_agents.go so the OTEL paragraph is guaranteed in generated dispatcher skill output (covered by new generator test). Addressed in 65def23.
| "type": "string", | ||
| "description": "Label identifying this coverage report (e.g., \"code-coverage/unit-tests\", \"code-coverage/jacoco\"). Distinguishes multiple coverage reports uploaded across different workflows or jobs." | ||
| }, | ||
| "secrecy": { |
There was a problem hiding this comment.
@copilot secrecy is configured in the safe output frontmatter (default to private) and not set able by the agent
There was a problem hiding this comment.
Updated the upload_code_coverage tool schema so secrecy is no longer agent-settable; it is now omitted from tool inputs and remains frontmatter-configured/defaulted. Addressed in 65def23.
| "description": "Confidentiality level of the coverage report content (e.g., \"public\", \"internal\", \"private\")." | ||
| }, | ||
| "integrity": { | ||
| "type": "string", |
There was a problem hiding this comment.
Updated the schema to use an enum for upload_code_coverage.integrity (low|medium|high) in both compiler and runtime copies of safe_outputs_tools.json. Addressed in 65def23.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot identity agentic workflows that generate tests and enable the safe output |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed in Validation: |
|
@copilot resolve the merge conflicts in this pull request |
…ut-for-coverage-upload # Conflicts: # pkg/workflow/artifacts.go Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot this PR has merge conflicts and still needs forward progress.
Run: https://github.com/github/gh-aw/actions/runs/32612677145
|
Resolved the merge conflicts in |
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Ran Validation: |
|
@copilot this PR still needs forward progress.
Run: https://github.com/github/gh-aw/actions/runs/32615850773
|
…ut-for-coverage-upload Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot error in mcp gateway init. ensure logging works. |
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Addressed in Validation: CI on the new agent-pushed HEAD will be stale until a maintainer re-triggers it. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in |
Coverage workflows lacked a safe-output path for publishing reports generated when no reusable CI artifact exists.
Safe output
upload-artifactoperation.coverage/**.Fallback coverage
coverage-report.