refactor(release): adopt global create_release.py from opencode-config #33
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
slaid098/voice_assistant!33
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/release/adopt-global-script"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Что сделано
scripts/create_release.pyиscripts/release_notes.py(заменены глобальными изopencode-config).tests/test_create_release.py(тестировал экстракторrelease_notes.py, теперь глобальный — тестируется вopencode-configissue #65, в voice_assistant не нужен)..github/workflows/release.ymlшаг "Create Forgejo release" переписан: скачивание глобальныхcreate_release.py+release_notes.pyчерезcurl.exeизopencode-config@main, запуск сRELEASE_PLATFORM="Windows 10+ (64-bit)". Шаг "Package release" переименован zip вvoice-assistant-windows-x64.zip(имя, которое глобальный скрипт ищет в CWD:{pyproject.name}-{RUNNER_OS.lower()}-{RUNNER_ARCH.lower()}.zip).README.mdсекции Requirements (EN) и Требования (RU): убрано упоминание "Python 3.13" (встроен в exe через PyInstaller), оставленоWindows 10+ (64-bit).Почему
slaid098— глобальныйcreate_release.pyвopencode-config(issue #65, PR #66, commit e00a060). Дублирование логики в каждом репо → drift, баги в одном репо не фиксятся в других.Windows 10+ (64-bit)теперь детерминированно попадает в body релиза черезRELEASE_PLATFORMenv var (глобальный скрипт формирует## Системные требованиязаголовок), а не через CHANGELOG (PR #31 уже убрал платформу из CHANGELOG).Watch out
opencode-configissue #65 (PR #66) — глобальный скрипт должен быть вmainветкеopencode-config. Если его нет или он сломан — релиз упадёт. Это single point of failure, но оправдано единым источником истины.$GITHUB_SERVER_URL— Forgejo runner auto-set env var (НЕ$FORGEJO_URL, который может не быть в runner env). Глобальный скрипт поддерживает оба (FORGEJO_URL||GITHUB_SERVER_URL), но в workflow используется именно$GITHUB_SERVER_URL.curl.exe— обязательно суффикс.exeв PowerShell 5.1;curlбез суффикса — алиас наInvoke-WebRequest, который ломает multipart-загрузку ассетов (gotcha из memory: forgejo-release-gotchas #7).\line-continuation,$VARбез$env:,curlalias) — не работает в PowerShell 5.1, адаптировано подcurl.exe+$env:VAR+Set-Location. (2) Spec утверждал "глобальная утилита сама сформирует имя при upload" — неверно: скрипт ищет локальный файл{name}-{os}-{arch}.zipв CWD (см.main()line 302-303), поэтому шаг "Package release" переименован вvoice-assistant-windows-x64.zipи запуск идёт изdist/. (3) Запуск изdist/нужен т.к. скрипт ищет zip в CWD, а zip лежит вdist/.uv.lock— НЕ коммитится: diffrequires-python>=3.12→3.13— остаточный мусор от PR #23, не относится к задаче.Pending
voice-assistant.zip→voice-assistant-windows-x64.zipи обновить body (добавить## Системные требованиязаголовок сWindows 10+ (64-bit)) — отдельная ручная операция через API.release_notes.pyвopencode-config(issue #65 уже слит, но тесты могли остаться — проверить).Closes #32
Code Review Summary
Summary
PR adopts the global
create_release.pyfromopencode-config— good direction (single source of truth for release logic). Removal of local scripts and tests is clean (no dangling imports). However, the workflow has a critical path-resolution bug that will make every release fail on the next tag push, plus a README inconsistency.Critical (must fix before merge)
.github/workflows/release.yml:78-79[correctness]Set-Location distbreakspyproject.tomllookup in the global script. The globalcreate_release.pymain()callsread_project_name(Path("pyproject.toml"))(resolves against CWD) andbuild_body(Path("CHANGELOG.md"), ...). AfterSet-Location dist, CWD isdist/, but:pyproject.tomlis at repo root → NOT indist/→read_project_namecalls_die("pyproject.toml not found at pyproject.toml")→sys.exit(1). Release step fails, no release created.CHANGELOG.mdis copied todist/voice-assistant/CHANGELOG.md(subdirectory) → NOT atdist/CHANGELOG.md→extract_changelog_sectionreturns""(non-fatal, but release body loses changelog notes).dist/voice-assistant-windows-x64.zipIS found correctly (only thing that works indist/).Fix: copy
pyproject.tomlandCHANGELOG.mdintodist/(notdist/voice-assistant/) beforeSet-Location. Add to the "Package release" step or the "Create Forgejo release" step:Then
Set-Location dist; python ..\scripts\create_release.pywill find all three files (pyproject.toml,CHANGELOG.md,voice-assistant-windows-x64.zip) in CWD.README.md:68andREADME.md:131[docs] Stale zip filename. The workflow now producesvoice-assistant-windows-x64.zip, but both EN and RU Quick Start still say "Downloadvoice-assistant.zip". Users following the instructions won't find that file in releases.Fix: Replace
voice-assistant.zip→voice-assistant-windows-x64.zipon both lines (68 and 131).Cross-file impact: missing paired update
PR меняет zip filename writer (
release.yml:68:voice-assistant.zip→voice-assistant-windows-x64.zip). README читает этот filename (README.md:68,README.md:131):voice-assistant.zip"voice-assistant.zip"voice-assistant-windows-x64.zip→ README врёт пользователюТЗ на fix:
voice-assistant.zip→voice-assistant-windows-x64.zipREADME.md:68(EN),README.md:131(RU)-DestinationPathвrelease.yml:68Добавьте fix в этот PR. ~2 строки в README.
Warnings (should fix)
.github/workflows/release.yml:76-77[security] No integrity verification of downloaded scripts.curl.exe -fsSL ... -o scripts/create_release.pydownloads fromopencode-config@mainwithout pinning to a commit SHA or verifying a checksum. Ifmainis compromised or a bad commit lands, the release pipeline executes arbitrary code withGITHUB_TOKEN(full repo access). The PR body acknowledges "single point of failure" but frames it as availability, not integrity/supply-chain.Fix: Pin to a specific commit:
$env:GITHUB_SERVER_URL/slaid098/opencode-config/raw/commit/<sha>/.opencode/scripts/create_release.py. Update the SHA when bumping the global script.uv.lock[hygiene] Working tree has a modifieduv.lock(visible at checkout:M uv.lock) that is NOT part of the PR diff (5 changed files, uv.lock absent). PR body notes "residual trash from PR #23". Not blocking for this PR, but the branch has stale local state — ensure it doesn't accidentally get committed in a follow-up.Positives
scripts/create_release.py,scripts/release_notes.py,tests/test_create_release.pydeleted with no dangling imports (grep confirmed nofrom scripts.release_notes/from scripts.create_releaseanywhere insrc/ortests/).curl.exe(notcurlalias),$env:GITHUB_SERVER_URL(not$GITHUB_SERVER_URL),$ErrorActionPreference = 'Stop'— all correct for PowerShell 5.1.RELEASE_PLATFORM: "Windows 10+ (64-bit)"correctly injected → global script builds## Системные требованияheading deterministically.## Watch outhonestly documents the 3 spec deviations (PowerShell adaptation, zip rename,dist/CWD) with line references to the global script.Verdict: REQUEST_CHANGES
Code Review Summary
Обе критические проблемы из предыдущего review исправлены корректно, новых проблем не появилось. CI green.
Исправления из предыдущего review
Problem 1 — release.yml Set-Location ломает lookup pyproject.toml: ✅
Copy-Item pyproject.toml dist/(строка 78) иCopy-Item CHANGELOG.md dist/(строка 79) добавлены ДОSet-Location dist(строка 80). Порядок правильный — копирование вdist/выполняется из корня репо, до смены CWD.create_release.pyизopencode-config@main: скрипт ищетPath("pyproject.toml"),Path("CHANGELOG.md")иPath(zip_name)через относительные пути в CWD. ПослеSet-Location distCWD =dist/, все три файла (pyproject.toml,CHANGELOG.md,voice-assistant-windows-x64.zip) находятся там. Контракт соблюдён.Problem 2 — README stale zip filename: ✅
voice-assistant.zip→voice-assistant-windows-x64.zipв EN (README:68) и RU (README:131).rg "voice-assistant\.zip"(без-windows-x64) — 0 совпадений, stale-имя полностью удалено из репо.asset_filename(name, os_token)={name}-{os}-{arch}.zip=voice-assistant-windows-x64.zip(pyproject.tomlname = "voice-assistant", RUNNER_OS=Windows, RUNNER_ARCH=X64). Тройная консистентность.Cross-file impact analysis
scripts/create_release.py,scripts/release_notes.py,tests/test_create_release.py(writers).rgпо репо — никто не импортирует удалённые модули, кроме удалённого теста. Чисто.create_release.py(ожидает файлы в CWD). Обе стороны обновлены в одном PR — окно сломанного main закрыто.RELEASE_PLATFORM: "Windows 10+ (64-bit)"(release.yml:72) совпадает с README:75 (EN) и README:138 (RU). Глобальный скрипт использует этот env var для формирования## Системные требованиязаголовка в body релиза.Positives
Copy-Item→Set-Locationправильный (копирование до смены CWD — критично для относительных путей скрипта).curl.exeс суффиксом.exe— корректно для PowerShell 5.1 (без суффиксаcurl— алиас наInvoke-WebRequest, ломает multipart).$ErrorActionPreference = 'Stop'— fail-fast на любом шаге.dist/,curl.exe,$GITHUB_SERVER_URLvs$FORGEJO_URL).uv.lockявно отмечен как не относящийся к задаче и не закоммичен.Suggestions (info, not blocking)
python ..\scripts\create_release.py— обратный слэш корректен для PowerShell на Windows, но можно рассмотретьpython scripts/create_release.pyпослеSet-Location dist(скрипт лежит вscripts/относительно корня, а CWD =dist/, поэтому..\scripts\правильно). Не менять — текущий вариант рабочий.Verdict: APPROVE