Skip to content

Commit d8ef71b

Browse files
committed
style: remove unused variable in test_job_state (ruff F841)
1 parent 4d91175 commit d8ef71b

4 files changed

Lines changed: 85 additions & 2 deletions

‎repowiki/notes/2026-09-26-本机网络对-uploadpypiorg-的-python-openssl-tls-握手被干扰uv-publishtwin.md‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ origin: conversation
2525
verified:
2626
- by: human:wangbao
2727
at: '2026-09-26T13:58:03Z'
28-
source_conversations: ['conversations/conv-working_memory_content-The-following-is-the-existing-working-3-16f142.md']
28+
source_conversations: ['conversations/conv-working_memory_content-The-following-is-the-existing-working-3-16f142.md', 'conversations/conv-@command-windows-python-release-发布小版本5.16.7.md']
2929

3030
---
3131

@@ -60,3 +60,15 @@ Python 生态上传工具(uv/twine)在 TLS 被干扰的网络里不可用,
6060
3. **必须字段 :action=file_upload**:缺失时 PyPI 返回 405 Method Not Allowed。
6161

6262
Rationale:上文推荐的 `-K 配置文件` 路线在本机默认 curl.exe(PATH 解析到 System32 7.55.1)下会静默失效,本次发布为此多轮 405/400 排查才定位;三个硬前提是 curl 直传路线能否跑通的判定依据,须并入。
63+
64+
## 本机对 upload.pypi.org 的 TLS 干扰是间歇性的:v5.16.7 时 uv publish 直连成功,先直连再降级 curl.exe 绕法
65+
66+
> 合并自蒸馏候选:本机对 upload.pypi.org 的 TLS 干扰是间歇性的:v5.16.7 时 uv publish 直连成功,先直连再降级 curl.exe 绕法
67+
68+
## 补充:TLS 干扰是间歇性的,先直连 uv publish 再降级 curl.exe 绕法(2026-11 v5.16.7 发布实测)
69+
70+
上文记录的「uv publish/twine 全部超时失败」并非恒定状态:v5.16.7 发布(2026-11)时 `uv publish` **直接成功**,双产物正常上传,未触发任何 TLS 超时——干扰是间歇性的。
71+
72+
结论:发布流程中应先直接尝试 `uv publish`(token 从 keyring 取、经环境变量传入),失败(连接超时)时再降级到 curl.exe multipart 绕法;不要一上来就走绕法,也不要因一次直连成功就删掉绕法预案。
73+
74+
Rationale:把间歇性网络故障当成恒定故障会白白增加发布步骤;把一次成功当成永久修复则会在下次被干扰时卡死。先直连、失败降级是成本最低的顺序。
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
type: pitfall
3+
title: "Windows 临时 Python 脚本含中文经 %TEMP% 执行后输出乱码:PR 正文被 GBK 破坏,须用 \\u 转义纯 ASCII 源码"
4+
tags: ["49", "appdata", "github", "pitfall", "powershell"]
5+
metadata:
6+
date: 2026-11-26
7+
confidence_level: weak
8+
task_id: 发版本
9+
source_session: "2ab7a61e2f8a4461bcac02b382a185a5"
10+
related_modules: ["release-workflow"]
11+
severity: medium
12+
source_ref: "conversations/conv-@command-windows-python-release-发布小版本5.16.7.md"
13+
scene: "发版本"
14+
status: draft
15+
author: iamwangbao-163-com
16+
generated: { by: codewiki/5.16.7, at: 2026-11-26T03:21:18Z }
17+
stale_after: 2027-05-25
18+
origin: conversation
19+
20+
---
21+
22+
## Background
23+
24+
v5.16.7 发布流程中,用 write_to_file 把含中文正文的 Python 脚本(建 PR / 修 PR 正文)写到 `C:\Users\...\AppData\Local\Temp\`,再经 PowerShell 执行调 GitHub REST API。创建 PR #49 后发现 PR 正文中文全部乱码——脚本源文件在 Windows 编码层被按 GBK 解读,中文以错误编码发给了 API。
25+
26+
## 正确做法
27+
28+
- 含中文的临时 Python 脚本不要直接写中文字面量;把所有非 ASCII 字符改写成 `\uXXXX` 转义,使源码为纯 ASCII,从根上绕开编码层歧义。
29+
- 出现乱码后可用同样的纯 ASCII 源码脚本 PATCH PR 正文修复(本次 PR #49 正文即这样修复,Release 正文无乱码)。
30+
31+
## Rationale
32+
33+
Windows 控制台默认 GBK 代码页,`%TEMP%` 路径 + PowerShell 子进程链路中任何一环按本地代码页解读源文件都会破坏中文;纯 ASCII 源码在任何代码页下字节不变,是确定性绕法。与既有笔记《PowerShell 下命令输出与临时文件的四个编码/语法坑》互补:那条讲 shell 语法层(%TEMP% 不展开、重定向 UTF-16),本条讲 Python 脚本源文件编码层。
34+
35+
## Root cause
36+
37+
脚本源文件编码层问题:中文以 UTF-8 写入但被按 GBK 解读(或反之),非 GitHub API 侧问题。
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
type: procedure
3+
title: "本机无 gh CLI 时用 Python + git credential fill 调 GitHub REST API 完成 PR/合并/Release 全流程"
4+
tags: ["github", "procedure"]
5+
metadata:
6+
date: 2026-11-26
7+
confidence_level: weak
8+
task_id: 发版本
9+
source_session: "2ab7a61e2f8a4461bcac02b382a185a5"
10+
related_modules: ["release-workflow"]
11+
severity: medium
12+
source_ref: "conversations/conv-@command-windows-python-release-发布小版本5.16.7.md"
13+
scene: "发版本"
14+
status: draft
15+
author: iamwangbao-163-com
16+
generated: { by: codewiki/5.16.7, at: 2026-11-26T03:21:29Z }
17+
stale_after: 2027-05-25
18+
origin: conversation
19+
20+
---
21+
22+
## Background
23+
24+
v5.16.7 发布时本机没有 gh CLI,需要完成:建 PR develop→main、修 PR 正文、轮询 CI check-runs、等绿后合并、创建 GitHub Release。
25+
26+
## 做法(v5.16.7 实测跑通)
27+
28+
1. 用 Python 脚本调 `git credential fill` 取 GitHub 凭据(不落盘、不打印),用 Basic Auth 调 GitHub REST API。
29+
2. POST `/repos/<owner>/<repo>/pulls` 创建 PR;正文含中文时源码用 `\u` 转义纯 ASCII(见同场景 pitfall 笔记)。
30+
3. 轮询 PR 的 check-runs,Test + Lint 全绿后 PUT 合并。
31+
4. 创建 Release 时传 `target_commitish` 指向 merge commit,tag 由远端自动打在该 merge commit 上(本地无需先打 tag,事后同步本地 tag 即可)。
32+
33+
## Rationale
34+
35+
无 gh CLI 的环境下这条链路可完整替代 gh pr create/merge/release;凭据经 git credential fill 取用与既有 keyring/凭据管理约定一致,token 不落盘。与既有笔记《GitHub merge API 响应的 merge_commit_sha 可能为 None》互补:那条定单点坑(从 PR API 取真实 sha),本条定端到端流程顺序与各步 API。

‎tests/test_job_state.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ def test_close_reports_missing_pages_as_degraded(analyzed_repo):
338338
from codewiki.mcp.tools.module_tree import handle_save_module_tree
339339

340340
repo, store = analyzed_repo
341-
output = repo / "repowiki"
342341

343342
handle_save_module_tree(
344343
{"repo_path": str(repo), "module_tree": {"core": {"components": ["a.py::func_a"]}}},

0 commit comments

Comments
 (0)