Skip to content

[code-simplifier] Simplify purity_scan.go: extract resolveObj and ensureDir helpers #53026

Description

@github-actions

Caution

Protected files were modified in this change.
This pull request is in request_review mode and requires explicit human scrutiny before merge.

Protected files: .github/scripts/purelock/purity_scan.go

Summary

Extractive, behavior-preserving simplification of .github/scripts/purelock/purity_scan.go, identified via the daily code-simplifier scan of files changed in the last 24 hours.

Changes

  • resolveObj(pkg, ident) helper: extracted the repeated "check TypesInfo.Uses, fall back to TypesInfo.Defs" object-resolution pattern that was duplicated identically in isLocalValue, escapingTarget, and escapingWriteThroughBase.
  • ensureDir(path) helper: extracted the repeated "create parent directory via filepath.Dir + os.MkdirAll" pattern duplicated in writeJSON and writeSummary.

No public interfaces, signatures, or behavior changed — these are pure DRY extractions of identical inline blocks.

Validation

  • go vet ./... (in .github/scripts/purelock): passes with no findings.
  • gofmt -l: no formatting issues.
  • No existing unit tests for this standalone script package (go test ./... reports "no test files").
  • make lint / make build for the wider Go module were not run since this script is a standalone .github/scripts/purelock module outside the main build graph; go vet/gofmt on the module itself is the applicable check.

Process notes

  • Deterministic pre-processing (recent PRs/commits, file candidate list, history summary) was consumed from precomputed JSON inputs per the code-simplifier workflow's token-efficiency design; no redundant GitHub API calls were made.
  • Findings were generated by a simplification-scout sub-agent pass over the file; only the two lowest-risk, purely duplicative extractions were applied (renaming/nesting suggestions were skipped as lower value / higher review overhead for this pass).

Source references: candidate file list from .github/scripts/code-simplifier/source-files.json snapshot generated 2026-08-16T03:31:01Z.

Generated by 🔧 Code Simplifier · auto · 53.1 AIC · ⌖ 6.17 AIC · ⊞ 9.4K ·

  • expires on Aug 16, 2026, 7:37 PM UTC-08:00

Note

This was originally intended as a pull request, but the git push operation failed.

Original error: ERR_VALIDATION: pushSignedCommits: refusing unsigned push for branch 'copilot/simplify-purity-scan-0a4a01ddfe7bca61': Signed-commit payload violates file-protection policy (request_review): .github/scripts/purelock/purity_scan.go

Workflow Run: View run details and download bundle artifact

The bundle file is available in the agent artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 31924328027 -n agent -D /tmp/agent-31924328027

# Fetch the bundle into a temporary ref, then update the local branch
git fetch /tmp/agent-31924328027/aw-copilot-simplify-purity-scan.bundle refs/heads/copilot/simplify-purity-scan:refs/bundles/create-pr-copilot-simplify-purity-scan-0a4a01ddfe7bca61-88836b41
git update-ref refs/heads/copilot/simplify-purity-scan-0a4a01ddfe7bca61 refs/bundles/create-pr-copilot-simplify-purity-scan-0a4a01ddfe7bca61-88836b41
git checkout copilot/simplify-purity-scan-0a4a01ddfe7bca61
# Ensure the working tree matches the updated branch
git reset --hard
# Remove the temporary bundle ref
git update-ref -d refs/bundles/create-pr-copilot-simplify-purity-scan-0a4a01ddfe7bca61-88836b41

# Push the branch to origin
git push origin copilot/simplify-purity-scan-0a4a01ddfe7bca61

# Create the pull request
gh pr create --title '[code-simplifier] Simplify purity_scan.go: extract resolveObj and ensureDir helpers' --base main --head copilot/simplify-purity-scan-0a4a01ddfe7bca61 --repo github/gh-aw

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions