Repository navigation
fix(utilities): soft delete removed pubcode entries again - #654
Merged
Merged
Conversation
Scheduled jobs look up the API host with `oc get route/pubcode-api`, but since the chart switched to an Ingress (#561) that route no longer exists, so the crawler and the soft-delete job have failed every day. Read the host from `ingress/pubcode-api` instead. The soft-delete utility now fails fast: missing API_KEY/API_URL, a failed list fetch, or any failed delete exits non-zero instead of being logged and ignored. Only a 404 for both bcgovpubcode.yml and .yaml marks a repo as removed; other GitHub errors keep the entry. Add node:test unit tests for the removal logic and run them in PR CI. Closes #256
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Static review found no blocking issues in the cleanup logic, Ingress lookup, or CI integration; tests were not executed.
Review effort: Balanced
Findings: None
What changed in this PR
Restores scheduled catalogue updates and soft deletion of entries whose pubcode files have been removed.
Changes:
- Uses the API Ingress host for scheduled jobs.
- Preserves entries on GitHub errors other than 404 and reports configuration/API failures.
- Adds utility tests required by PR CI.
| File | Description |
|---|---|
utilities/remove-deleted-pubcode/package.json |
Enables Node’s test runner. |
utilities/remove-deleted-pubcode/index.test.js |
Tests removal detection and delete handling. |
utilities/remove-deleted-pubcode/index.js |
Refactors cleanup and propagates failures. |
.github/workflows/scheduled.yml |
Replaces Route lookups with Ingress lookups. |
.github/workflows/pr-open.yml |
Adds utility tests to the required Results check. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Entries whose
bcgovpubcode.ymlwas removed from their repo stay visible in the catalogue.Soft delete already exists (
is_deleted,DELETE /api/pub-code/:repo_name, and the dailysoft-delete-removed-pubcodesjob), but since the chart moved to an Ingress in #561 every scheduled job has failed atoc get route/pubcode-api. That includes the crawler, so new and updated pubcodes aren't loaded either.Changes
scheduled.yml: read the API host fromingress/pubcode-apifor the crawler and the soft-delete job.utilities/remove-deleted-pubcode:.ymland.yamlreturn 404. Any other GitHub error keeps the entry.API_KEY/API_URL, a failed list fetch, or any failed delete now exits non-zero. Before, these were logged and ignored.API_URLinstead of a hardcoded prod URL.node --test, no new dependencies), run in PR CI asUtility Testsand required byResults.Notes
is_deletedagain: the crawler'sfindOneAndReplaceapplies the schema default.pubcode-api.apps.silver.devops.gov.bc.ca). It will be proven by the first scheduled run after merge.validate-ministry-listalso fails daily, with an@actions/coredefault-import error inschema/script.Closes #256
Thanks for the PR!
Deployments, as required, will be available below:
Please create PRs in draft mode. Mark as ready to enable:
After merge, new images are deployed in: