dsh-compound-engineering 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/docs/releasing.md +65 -3
  2. package/package.json +1 -1
package/docs/releasing.md CHANGED
@@ -134,12 +134,13 @@ workflow 会跑这些,本地最好先过一遍,省一轮 CI:
134
134
 
135
135
  ```bash
136
136
  npm test # 期望 JS 38 pass / 0 fail、py 33 OK
137
- npm pack --dry-run # 看文件数和大小,期望 458 文件 / 1.8MB
137
+ npm pack --dry-run # 看文件数和大小,期望 459 文件 / 1.8MB
138
138
  git status --short # 期望干净
139
139
  ```
140
140
 
141
141
  关于 `npm pack --dry-run` 的文件数:0.1.0 / 0.1.1 是 461(含 3 个 `.pyc`),
142
- 加上 `prepack` 清理后是 458。**如果看到 461,说明 pyc 又混进来了。**
142
+ `prepack` 清掉 pyc 后是 458,`files` 收录 `docs/` 后是 **459**(0.1.3 起)。
143
+ **如果比上面多出 3 个,说明 pyc 又混进来了。**
143
144
 
144
145
  ---
145
146
 
@@ -292,6 +293,66 @@ git push origin main
292
293
 
293
294
  下次建仓库记得**不要勾 Add README**。
294
295
 
296
+ ### 4.11 测试在 Windows 全绿、Linux CI 必挂
297
+
298
+ 本项目是在 Windows 上开发的,而 CI 跑 ubuntu-latest。v0.1.2 的 CI 就挂在
299
+ 「跑测试」这一步,本地怎么都复现不出来。根因是**测试自身的前置条件**踩到了
300
+ 脚本里的 POSIX 校验,而 Windows 分支走的是 ACL/owner 检查,根本不看 mode 位。
301
+
302
+ 两处(都在 `test/test_windows_compat.py`):
303
+
304
+ ```python
305
+ # ❌ os.makedirs 用默认 umask 建成 0755,随后 ensure_private_dir 的
306
+ # validate_private_dir 要求 mode 恰好 0700,POSIX 分支直接抛 TrustFailure
307
+ os.makedirs(result_dir)
308
+ state.ensure_private_dir(result_dir)
309
+
310
+ # ✅ 交给它自己创建,内部是 os.mkdir(path, 0o700)
311
+ state.ensure_private_dir(result_dir)
312
+ ```
313
+
314
+ ```python
315
+ # ❌ 默认 umask 022 → 0644,而 read_private_at 要求 0600
316
+ with open(target, "wb") as handle:
317
+ handle.write(payload)
318
+
319
+ # ✅ 显式指定 mode
320
+ fd = os.open(target, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)
321
+ with os.fdopen(fd, "wb") as handle:
322
+ handle.write(payload)
323
+ ```
324
+
325
+ **教训**:任何涉及 `mode & 0o777`、`stat.S_IMODE`、`os.chmod`、`umask` 的测试,
326
+ 在 Windows 上都得不到真实结果(Windows 的 mode 是合成的,目录一律显示 0777)。
327
+ 写这类测试要么显式指定 mode,要么就假定它会跑在 Linux 上。
328
+
329
+ 另外两个当时排除掉的怀疑方向,记下来省得下次重查:
330
+
331
+ - **路径大小写**:Linux 区分大小写,`References/x.md` 与 `references/x.md` 不等价。
332
+ 实际用「按目录真实条目逐个解析」比对,缺失数 0。
333
+ - **行尾**:`.gitattributes` 已是 `* text=auto eol=lf`,`git ls-files --eol` 显示
334
+ `i/lf w/lf`,检出到 Linux 不会混入 `\r`。
335
+
336
+ ### 4.12 CI 日志看不到时怎么定位
337
+
338
+ 私有仓库 + 细粒度 token 权限不足时,日志接口会直接拒绝:
339
+
340
+ ```bash
341
+ curl -H "Authorization: Bearer $TOKEN" \
342
+ https://api.github.com/repos/<owner>/<repo>/actions/jobs/<id>/logs
343
+ # → {"message": "Must have admin rights to Repository.", "status": 403}
344
+ ```
345
+
346
+ 此时仍能看到**哪一步失败**(`GET /actions/runs` 里的 `conclusion`,配合 web 页面
347
+ 高亮的步骤名),只是拿不到 stdout。剩下的靠读代码推:
348
+
349
+ ```bash
350
+ # 列出所有平台分支敏感的调用
351
+ grep -n "IS_WINDOWS\|sys.platform\|process.platform" test/*.py test/*.mjs
352
+ # 找出「先建目录/文件、后校验」的组合
353
+ grep -n "makedirs\|os.mkdir\|open(.*\"wb\")" test/*.py
354
+ ```
355
+
295
356
  ---
296
357
 
297
358
  ## 5. 回滚与补救
@@ -355,7 +416,8 @@ diff -rq "$SRC/skills" "$DST/skills" && echo "一致"
355
416
 
356
417
  ## 7. 待办
357
418
 
358
- - [ ] Trusted Publisher 跑通一次,状态从 `Pending validation` 转正
419
+ - [x] Trusted Publisher 跑通一次,状态从 `Pending validation` 转正(v0.1.3 首次全绿)
359
420
  - [ ] 把 `Publishing access` 改为 disallow bypass 2fa tokens
360
421
  - [ ] 确认已删除临时 bypass token(<https://www.npmjs.com/settings/zhiangzhang1/tokens>)
361
422
  - [ ] README 加 npm 徽章与 provenance 徽章
423
+ - [ ] 考虑加一个 `test:linux` 的本地校验脚本,提前拦住 §4.11 那类问题
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-compound-engineering",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Every 的 compound-engineering 方法论技能包 —— brainstorm → plan → work → review → compound,让每一次改动都让下一次更容易。DeepSeek Harness 移植版。",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",