fix(triage): normalize claimed_version before drift compare (#483)

Reporter on #481 pasted the deb package version `claude-desktop
1.3561.0-2.0.0`. The classifier extracted `1.3561.0-2.0.0` verbatim,
and the naive `claimed != CLAUDE_DESKTOP_VERSION` string compare
flagged drift against `1.3561.0`. The issue is on the current
release — no drift should fire.

Fix normalizes both sides: strip a leading `v`, then strip anything
from the first `-` or space onward. Handles:

- `1.3561.0-2.0.0` → `1.3561.0` (deb package: upstream-REPO_VERSION)
- `v1.3561.0` → `1.3561.0` (copy-paste with prefix)
- `1.3561.0 stable` → `1.3561.0` (whitespace-separated qualifier)
- `1.3561.0` → `1.3561.0` (bare upstream, unchanged)

Same normalization applied to CURRENT_VERSION for symmetry, even
though the repo variable is always the bare upstream semver — keeps
the compare resilient if that ever changes.

Fixes the false drift banner on #481 and prevents the same shape
from tripping on any future issue where a reporter pastes their
`dpkg -l | grep claude` output or AppImage filename.

Co-authored-by: Claude <claude@anthropic.com>
This commit is contained in:
Aaddrick
2026-04-21 15:53:34 -04:00
committed by GitHub
parent 6fceb39d60
commit 35d4735b2d

View File

@@ -296,6 +296,14 @@ jobs:
# claimed_version against the repo variable CLAUDE_DESKTOP_VERSION.
# Investigation still runs regardless; the drift flag steers the
# final decision gate.
#
# Both sides are normalized before compare: strip a leading `v`,
# then strip anything from the first `-` or space onward.
# Handles the common case where a reporter pastes the deb
# package version (`claude-desktop 1.3561.0-2.0.0` — upstream +
# REPO_VERSION suffix) or the AppImage filename (which can
# carry the same suffix). A bare upstream version still
# round-trips unchanged.
- name: Check version drift
id: drift
if: steps.route.outputs.route == 'investigate'
@@ -304,11 +312,22 @@ jobs:
run: |
claimed=$(jq -r '.claimed_version // ""' \
/tmp/triage/classification.json)
if [[ -n "${claimed}" && "${claimed}" != "null" \
&& -n "${CURRENT_VERSION}" \
&& "${claimed}" != "${CURRENT_VERSION}" ]]; then
normalize() {
local v="${1#v}"
v="${v%%-*}"
v="${v%% *}"
printf '%s' "${v}"
}
claimed_norm=$(normalize "${claimed}")
current_norm=$(normalize "${CURRENT_VERSION}")
if [[ -n "${claimed_norm}" && "${claimed_norm}" != "null" \
&& -n "${current_norm}" \
&& "${claimed_norm}" != "${current_norm}" ]]; then
echo "drift_detected=true" >> "$GITHUB_OUTPUT"
echo "::notice::version drift: claimed=${claimed} current=${CURRENT_VERSION}"
echo "::notice::version drift: claimed=${claimed} (normalized ${claimed_norm}) current=${CURRENT_VERSION} (normalized ${current_norm})"
else
echo "drift_detected=false" >> "$GITHUB_OUTPUT"
fi