Repository navigation
Conversation
added 3 commits
November 2, 2026 14:31
Feature PR databases now survive merge into a release branch and are dropped by the deploy pipeline (targeted cleanup + sweep) once the release actually ships, so QA can keep querying them during the release window. The PR-close pipeline now only drops on abandonment. Ported from the Azure DevOps side (infra/cleanup-tst-on-deploy), adapted to balboa's feature/release branch convention, <base>_PR_<id> database naming, and the GitHub REST API. Covered by a new pytest suite under automate/git/tests (23 cases, mocked GitHub API).
The deploy container's run: shell doesn't support bash here-strings (<<<) or read -ra arrays -- confirmed live: the real pipeline 30 run for PR #299 hit "sh: Syntax error: redirection unexpected" and exit code 2 on the sweep's drop loop. continue-on-error kept the deploy green, but BALBOA_PR_295 was never actually dropped. Replaced with a POSIX-safe comma-split via IFS word-splitting, which works identically under sh and bash. Reproduced the exact failure and verified the fix under both shells before committing.
"TST" was carried over literally from the Azure DevOps source, where it is part of the real database name (TST_EDP__PR<id>). In balboa the real database is <base>_PR_<id> -- there is no "TST" anywhere in the actual name. balboa's own pre-existing code already calls this concept "PR database" (grant_access_to_pr_database.sql, "Create PR database", etc.); this aligns the new code with that convention. Renamed files, macro name, env vars (TST_* -> PR_*), step names/ids, and comments/docstrings. No behavior change -- confirmed by the full test suite (23/23 passing) and macro syntax check.
Contributor
🧪 dbt Workflow Status
✅ All dbt validations passed |
workflow_dispatch runs have no github.event.number, so the database name resolved to <DB>_PR_ and the drop targeted nothing useful. Manual runs now require a pr_number input, used as a fallback for the PR number. A validation step rejects empty or non-numeric PR numbers before the drop. It uses a POSIX `case` rather than bash `[[ =~ ]]` because this container's run: shell is sh (see 3dc4174). The drop step now reads the database name from the shell environment instead of interpolating ${{ }} into the script, and checkout falls back to github.sha when there is no pull_request.
Contributor
🧪 dbt Workflow Status
✅ All dbt validations passed |
This branch has not been deployed
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.
Summary
Feature PR databases (
BALBOA_PR_<id>) now survive merge into a release branch and are dropped by the deploy pipeline (targeted cleanup + sweep) once the release actually ships, so QA can keep querying them during the release window. The PR-close pipeline (15) now only drops a PR's database when it was abandoned, not when it was merged.This is a port of the same logic already proposed in the Azure DevOps PR for our production repo (
infra/cleanup-tst-on-deploy) -- same rules, adapted to this repo's branch convention (feature/,release/,hotfix/,infra/), database naming (<base>_PR_<id>), and the GitHub REST API.Status: fully tested end-to-end in this repo's real pipeline. Ready for review -- not merged yet, pending approval.
Equivalence with the Azure DevOps PR
This section exists so approving this PR and the Azure PR can be treated as approving the same change twice, not two different changes. Verified by reading both branches' current content side by side, not from memory.
Identical decision logic, confirmed line-by-line:
pull_request.mergedfield -- different mechanism, same outcome, and this repo's version is simpler because GitHub's event already carriesmerged: true/falsedirectly (Azure's generic "PR updated" webhook doesn't, which is why that side needs an extra status-check step).continueOnError/continue-on-error), placed after the version-bump push, and never fails the deploy; anything left behind is retried on the next deploy.Differences, and why each one is expected, not a divergence:
fb/,rb/,hf/,infra/feature/,release/,hotfix/,infra/TST_EDP__PR<id>(hardcoded literal)<base>_PR_<id>(derived fromtarget.database, generic)##vso[task.setvariable...](stdout)$GITHUB_OUTPUT(file) -- each platform's own mechanismTwo of those are deliberate improvements made during this port, not just translation, and are worth flagging explicitly:
show_pr_databasesmacro) is generic (target.database ~ '_PR_%') instead of the Azure side's hardcodedTST_EDP__PR%literal, and the excluded CI user defaults totarget.userinstead of a hardcodedSVC_AZURE_DEVOPS. Neither changes any drop/keep decision -- they only remove two environment-specific literals. These could optionally be backported to the Azure PR too if full byte-level symmetry is wanted, but they're not required for the behavior to match.IFS=',' read -ra ... <<< "$IDS"), which silently broke the drop loops (caught bycontinue-on-error, so the deploy was never affected, but the actual database drop didn't happen). Fixed here with a POSIX-safe loop. I have not verified whether Azure Pipelines' hosted agents have the same issue -- Claude only read that code, it did not execute it there. Worth a specific check when reviewing the Azure PR, since it has the identical shell pattern.What was tested, and how
automate/git/tests/), covering the full sweep decision table, pagination, a GitHub API query quirk, 404 handling, and invalid-config handling.shandbashbefore merging the fix.Everything above was done on
mainfor real and has since been reverted (this repo was only meant to validate the logic, not keep it applied) -- see the revert PR (#304) for the full trail if useful. This PR reapplies the final, validated code cleanly on top of currentmain.Next step
Once this is approved, the Azure DevOps PR with the equivalent logic for our production repo can be reviewed and merged.