Conversation
The release version-stamping sed matched `__version__ = '...'` (single quotes), but redash/__init__.py declares `__version__ = "26.06.0-dev"` with double quotes, so the substitution never matched and CI builds were never stamped with the run's FULL_VERSION. Update the pattern (and replacement) to use double quotes. Fixes getredash#7598
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the CI version-bumping script to rewrite redash/__init__.py’s __version__ assignment using double quotes.
Changes:
- Adjusted the
sedmatch/replace pattern for__version__to target double-quoted values. - Kept the build metadata formatting (
+b<run_id>.<run_number>) inFULL_VERSION.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} | ||
|
|
||
| sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py | ||
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py |
| FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} | ||
|
|
||
| sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py | ||
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py |
There was a problem hiding this comment.
3 issues found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".ci/update_version">
<violation number="1" location=".ci/update_version:5">
P2: Post-substitution verification is missing: sed returns success (0) even when no replacements are performed, so format drift in `redash/__init__.py` will again silently leave the version unstamped.</violation>
<violation number="2" location=".ci/update_version:5">
P2: This sed pattern is now hard-coded to double quotes. If the quote style in `redash/__init__.py` ever changes (e.g., a formatter switches to single quotes), the substitution will silently fail again — the same class of bug this PR fixes. Consider matching either quote style (e.g., `["']`) and reusing the captured quote in the replacement to make this resilient to formatting changes.</violation>
<violation number="3" location=".ci/update_version:5">
P2: The character class `[A-Za-z0-9.-]` does not include `+`, but `FULL_VERSION` contains `+` (e.g., `26.06.0-dev+b12345.67`). If this script runs against a file that already has a stamped version with build metadata, the regex won't match and the substitution will silently do nothing. Add `+` to the character class (or match everything up to the closing quote) to make the script idempotent.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} | ||
|
|
||
| sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py | ||
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py |
There was a problem hiding this comment.
P2: Post-substitution verification is missing: sed returns success (0) even when no replacements are performed, so format drift in redash/__init__.py will again silently leave the version unstamped.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .ci/update_version, line 5:
<comment>Post-substitution verification is missing: sed returns success (0) even when no replacements are performed, so format drift in `redash/__init__.py` will again silently leave the version unstamped.</comment>
<file context>
@@ -2,5 +2,5 @@
FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
-sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py
+sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py
sed -i "s/dev/${GITHUB_SHA}/" client/app/version.json
</file context>
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py | |
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py | |
| grep -qF "__version__ = \"${FULL_VERSION}\"" redash/__init__.py || { echo "ERROR: Failed to stamp version"; exit 1; } |
| FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} | ||
|
|
||
| sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py | ||
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py |
There was a problem hiding this comment.
P2: This sed pattern is now hard-coded to double quotes. If the quote style in redash/__init__.py ever changes (e.g., a formatter switches to single quotes), the substitution will silently fail again — the same class of bug this PR fixes. Consider matching either quote style (e.g., ["']) and reusing the captured quote in the replacement to make this resilient to formatting changes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .ci/update_version, line 5:
<comment>This sed pattern is now hard-coded to double quotes. If the quote style in `redash/__init__.py` ever changes (e.g., a formatter switches to single quotes), the substitution will silently fail again — the same class of bug this PR fixes. Consider matching either quote style (e.g., `["']`) and reusing the captured quote in the replacement to make this resilient to formatting changes.</comment>
<file context>
@@ -2,5 +2,5 @@
FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
-sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py
+sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py
sed -i "s/dev/${GITHUB_SHA}/" client/app/version.json
</file context>
| FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} | ||
|
|
||
| sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py | ||
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py |
There was a problem hiding this comment.
P2: The character class [A-Za-z0-9.-] does not include +, but FULL_VERSION contains + (e.g., 26.06.0-dev+b12345.67). If this script runs against a file that already has a stamped version with build metadata, the regex won't match and the substitution will silently do nothing. Add + to the character class (or match everything up to the closing quote) to make the script idempotent.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .ci/update_version, line 5:
<comment>The character class `[A-Za-z0-9.-]` does not include `+`, but `FULL_VERSION` contains `+` (e.g., `26.06.0-dev+b12345.67`). If this script runs against a file that already has a stamped version with build metadata, the regex won't match and the substitution will silently do nothing. Add `+` to the character class (or match everything up to the closing quote) to make the script idempotent.</comment>
<file context>
@@ -2,5 +2,5 @@
FULL_VERSION=${VERSION}+b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}
-sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py
+sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py
sed -i "s/dev/${GITHUB_SHA}/" client/app/version.json
</file context>
| sed -ri "s/^__version__ = \"([A-Za-z0-9.-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py | |
| sed -ri "s/^__version__ = \"([A-Za-z0-9.+-]*)\"/__version__ = \"${FULL_VERSION}\"/" redash/__init__.py |
What & why
Fixes #7598.
.ci/update_versionstamps the build version intoredash/__init__.pyduring release CI:sed -ri "s/^__version__ = '([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.pyThe pattern matches a single-quoted value, but the file declares the version with double quotes:
So the substitution never matches and the version is silently left as the
-devplaceholder in built images —FULL_VERSION(<version>+b<run_id>.<run_number>) is never applied.Fix
One line — match (and emit) the double-quoted form.
Testing
Verified end-to-end by running the actual script against temp copies with CI-like env (
GITHUB_RUN_ID/GITHUB_RUN_NUMBER/GITHUB_SHA, realpackage.jsonversion viajq):__version__left unchanged — reproduces the bug.__version__becomes26.06.0-dev+b12345.67; exactly one line changes; theclient/app/version.jsondev → SHAstep is unaffected.5/5 assertions pass.