Skip to content

Use exact metadata lookup for retired package deletion - #53

Merged
xnoto merged 1 commit into
mainfrom
fix/delete-retired-sms-package-targeted
Sep 20, 2026
Merged

xnoto merged 1 commit into
mainfrom
fix/delete-retired-sms-package-targeted

Conversation

@xnoto

@xnoto xnoto commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the approved temporary package-cleanup workflow after its first run failed on org-wide inventory HTTP400 before issuing any DELETE. Use the narrower exact-package metadata endpoint instead; fixed target and repository association checks remain mandatory.

Fixes: N/A — follows #52.

Type of change

  • Bug fix
  • CI / reusable workflow

Validation

  • Required PR checks pass — pending.
  • No generated files hand-edited.

Adversarial/security/delivery reviews ADVANCE. Initial metadata errors including404 fail closed; validate positive ID, exact name/type/producer repository before version inventory and whole-package DELETE. After accepted delete, at most5 GETs confirm404; other errors fail. Same pinned action, once-encoding check, permissions, repo/main guards, timeout, concurrency, zero inputs. No PAT fallback or raw error-header logging.

Impact and rollout

No deletion on PR/push. Owner-approved main dispatch still targets only opencode-sms-bridge. Previous failed run deleted nothing. After verified success, remove temporary workflow immediately. No other package/API privilege or repository setting change.

Safety and secrets

  • No credentials, state, or sensitive plans
  • No local OpenTofu/state operations
  • Fixed destructive scope and disarm requirement unchanged

AI-assisted; no upstream communications.

Both dispatched runs failed at the first org-wide inventory GET with
400 Invalid argument before any deletion; the repository GITHUB_TOKEN
is not authorized for org-wide package enumeration. Remove the
inventory dependency entirely: the exact package-scoped endpoints
remain the documented GITHUB_TOKEN path (the container registry grants
the publishing repository's workflow token admin, which reads and
writes package metadata and deletes the package).

The script now starts with the exact getPackageForOrganization call
using the raw package name. Any error there, including 404, fails the
run: 404 may mask a permission problem, so absence is never inferred.
The id must be a positive safe integer, and name, package_type, and
the exact repository association are verified fail-closed, with a
missing association failing. Versions come from the exact versions
endpoint; the whole package is deleted; and verification is bounded
to at most five metadata GETs with a 1s wait on 200 (eventual
consistency), 404 confirming the accepted 204 deletion. No relist is
performed. 400 or 403 on any call fails without expanded access or
PAT fallback.

All API errors are reported through core.setFailed with status and
message only; raw error objects, stack traces, and request headers
are never logged. Guards are unchanged: manual workflow_dispatch with
zero inputs, exact repository and refs/heads/main enforcement at the
job and script level, five-minute timeout, fixed per-repo concurrency
with cancel-in-progress false, the once-encoding pre-request URL
check, and the pinned actions/github-script v9.0.0 commit.

No dispatch, merge, or live API execution happens in this commit.
@xnoto
xnoto requested a review from a team as a code owner September 20, 2026 05:50
@github-actions

Copy link
Copy Markdown

Image CI passed

Pre-commit validation passed. View the workflow run.

@xnoto
xnoto merged commit 27660c5 into main Sep 20, 2026
5 checks passed
@xnoto
xnoto deleted the fix/delete-retired-sms-package-targeted branch September 20, 2026 05:52
xnoto added a commit that referenced this pull request Sep 20, 2026
## Summary

Replace unavailable Octokit deletePackageForOrganization helper with
documented whole-package REST DELETE and require204. Previous approved
run verified exact package/repository metadata and13versions, then
failed before any DELETE.

Fixes: N/A — completes approved temporary cleanup from #52/#53.

## Type of change

- [x] Bug fix
- [x] CI / reusable workflow

## Validation

- [ ] Required PR checks pass — pending.
- [x] No generated files hand-edited.

Adversarial/security/delivery reviewers ADVANCE. Only DELETE invocation
changes; fixed target, action pin, permissions, zero-input manual-main
guards, metadata validation, once-encoding check and bounded
post-delete404 verification unchanged.

## Impact and rollout

Owner-approved merge/dispatch targets only opencode-sms-bridge. Require
metadata success, DELETE204, then GET404. No other API permissions or
package targets. Delete temporary workflow immediately after verified
success. No source/image publication involved.

## Safety and secrets

- [x] No credentials, state, or sensitive plans
- [x] No local OpenTofu/state operations
- [x] Fixed scope and mandatory disarm preserved

AI-assisted; no upstream communications.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant