Files
Jyotisha/docs/tasks/TASK-owner-case-purge-20260919.md
T
jesse-uxandClaude Code 5cbc2d0097 chore(privacy): purge upstream private material and add import guards
Prepare branch for remote review; preserve documented validation gaps and protected historical packages.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-20 00:55:18 +08:00

106 lines
13 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# TASK · 上游库主案例与本机路径残留清除(本仓,2026-09-19)
> 状态:待领取。只覆盖本仓 `/workspace/Jyotisha`。上游 `yinduzhanxing` 的清理由库主自己做,指令在 `UPSTREAM-INSTRUCTION-owner-case-purge-20260919.md`,与本单互不依赖。
> 本任务书**不转录**任何出生日期、出生分钟、经纬度、本机用户名;检索键按符号定位到源文件行,执行方自己读。
## 0. 基线与交付
- 基线:`origin/staging` = `b05d2fa1`(2026-09-19)。
- worktree `.worktrees/owner-case-purge-20260919`,分支 `codex/owner-case-purge-20260919`,验收后快进推 `staging`。
- 改动落在 `references/**`、`skills/**`、`tests/**`、`scripts/**`、`frontend/**`,全在 `deploy/gated-paths.txt` 内,推 staging 会触发门禁并重新发布镜像。
## 1. 事故实证
本仓从上游镜像同步时把库主本人案例(案例 ID `[库主案例标识已移除]_user_case` / 别名 `[私人案例引用已移除]`)和库主电脑的绝对路径一起带了进来。以库主标识(案例 ID、生日字符串、经纬度、出生秒级时间、别名、本机用户名)检索 `origin/staging`,命中 95 个文件。
检索键取法(不要写进任何提交):
```bash
git show origin/staging:tests/test_consultation_contract_golden.py | sed -n 44p # FORBIDDEN_PRIVACY_MARKERS 三个值
git show origin/staging:tests/test_truth_source_runtime_identity.py | sed -n 14p # 本机绝对路径前缀
```
1. **无引用的 Skill 快照 33 个文件。** `skills/jyotish-vedic-astrology/versions/{6.9.14,6.9.15,6.9.16}/` 三份快照共 3,467 个文件、71.6 MB。`frontend/src/lib/skill-package-registry.ts:711-764` 与 `frontend/src/mastra/skill-binding.ts:16` 明写 `versions/` 快照不在加载路径上;仓内只有 `.gitignore:7-8` 与 CHANGELOG 历史提到它。
2. **前端测试 13 个文件把库主生日当 fixture 日期。** `frontend/tests/birth-time-journey-test-support.ts:25,34,156`、`birth-time-intake.test.ts:25,336`、`birth-time-dynamic-*.test.ts`、`birth-time-journey-*.test.ts`、`birth-time-journey-turn-persistence.test.mjs:185`。坐标已换成上海,只剩日期。
3. **Python 测试 10 个。** `tests/test_active_rectification_api.py:23,32-33,43,61,91,96,111` 用库主**生日 + 出生分钟**;`test_active_rectification_events.py`(7 处)、`test_dynamic_rectification.py:123`、`test_dynamic_rectification_fact_priority.py:11`、`test_minute_rectification_feature_facts_v4.py:62`、`test_rectification_horary_observation.py:8`、`test_rectification_kp_cusp_observation.py:21` 用生日;`test_deep_fragment_oss_reuse_gate_round2.py:20,30`、`test_truth_source_runtime_identity.py:14` 断言库主本机路径。
4. **整机扫描台账 11 份 + 1 份 manifest。** `references/oracle/` 下 2026-07 的 `deep_fragment_oss_reuse_gate_round2`、`event_judgment_fragment_rule_family_registry`、`fragment_second_pass_candidate_ledger`、`local_oss_reuse_sweep_kp_muhurta_av_compat`、`technique_fragment_inventory`(无任何读者)、`technique_promotion_audit_kp_gochara_muhurta`、`truth_source_runtime_identity`、`whole_machine_jyotish_fragment_scan`、`workbuddy_round{3,4}_candidate_ledger`、`workbuddy_round5_transfer_status`,全部只被各自的合同测试读;`scripts/technique_promotion_audit_kp_gochara_muhurta.py:21` 把库主本机备份路径当 `kp_reference`。`references/rangacharya_source_manifest.json` 含本机路径但有运行时读者 `scripts/rangacharya_readiness.py`。
5. **会话转录 2 份。** `会话转录已按 2026-09-19 决策删除` 是库主本人校正会话的原文(含出生参数与生活事件),只被 `docs/tasks/TASK-rectification-convergence-20260830.md:199,407,457` 与 `PROGRESS-rectification-convergence-20260830.md:18-19` 引用。
6. **上游镜像快照。** `references/upstream/yinduzhanxing/SKILL.md`(`SKILL.md:13` 声明为只读研究快照,`references/cross_project_contract/imports/*.json` 记录哈希)与 `references/upstream/test_birth_time_rectification_skill_contract.py` 含库主标识。
7. **文档示例。** `docs/superpowers/plans/2026-07-17-birth-date-picker.md:52,418` 用库主生日当示例;`docs/research/whole_machine_fragment_sweep_2026_07_{14,16}.md` 与四份 `docs/superpowers/plans/2026-07-*.md` 含本机路径。
8. **防线缺口。** `tests/test_consultation_contract_golden.py:44` 已把库主生日与出生分钟列为 `FORBIDDEN_PRIVACY_MARKERS`,但只检查咨询输出,不检查仓库文件;`scripts/import_yinduzhanxing.py:36-53` 排除清单没有任何库主案例或整机扫描模式,下次同步会原样带回。
本仓 `scripts/` 运行时**没有**上游那两个按库主生日分支的函数(`_known_case_regression_hint` / `[私人案例引用已移除]`),`frontend/src/` 也无命中,不需要动运行时逻辑。
## 2. 根因
- 上游把库主本人盘当全链路 golden,本仓 `import_yinduzhanxing.py` 只排除了支付 / 管理 / 密钥类路径,没有隐私排除项。
- 隐私守卫只放在咨询输出层,仓库文件层没有测试。
- `versions/` 快照在加载路径改造后没人删。
## 3. 决策记录
- 产品 2026-09-19 拍板:库主本人案例**整体删除**,不保留匿名化版本、不保留会话转录。这推翻 `TASK-rectification-convergence-20260830.md:199` 把两份会话转录当研究资料归档的做法。
- 上游仓的清理**不在本单**,由库主按独立指令自己做;本仓不等上游。
- fixture 统一用**虚构**出生资料(日期、分钟、坐标均不得与任何真人一致),`frontend/tests/birth-time-journey-test-support.ts` 与 `tests/conftest.py` 各一份常量,其余测试引用常量,不再散落字面量。
- `references/upstream/yinduzhanxing/SKILL.md` 是带哈希的上游快照,**不手改**:等库主清完上游后用 `import_yinduzhanxing.py` 重新导入;在此之前它算已知残留,在 BLOCKED.md 记一条。
## 4. 硬红线
1. 任务书、进度记录、Bug 历史、commit message、测试名、新常量名里**不得出现**库主的出生日期、出生分钟、经纬度、别名、本机用户名。
2. 删文件就连带删或改测试,三栏说明「原值 / 新值 / 原因」;不得把断言改成「文件不存在」再留着文件。
3. 只快进推 `staging`,不动 `main`、workflow、DNS。
4. 不顺手升级依赖、不修不在本单内的 warning。
5. `frontend/src/app/page.tsx` 不增长;`scripts/jyotish_api_server.py` 不增长。
6. 测试总数只能因本单列明的删除而减少,进度记录逐个列出被删测试名。
7. **不得触碰 `skills/jyotish-birth-time-rectification/versions/**`**。`skills/skill-package-registry.json` 对这些目录逐个做 SHA-256 校验(`frontend/src/lib/skill-package-registry.ts:289,582,781`),历史校正会话按版本 + 哈希绑定,动一个字节就打不开旧会话。本单只删 `skills/jyotish-vedic-astrology/versions/`,它不在注册表里,也不在运行时拷贝的四个入口(`SKILL.md` / `references` / `scripts` / `assets`,`:623-628`)之内。
8. 要删的 11 份 `references/oracle` 台账与 2 份会话转录,`SKILL.md`、`skills/*/SKILL.md`、`mcp_server.py` 均未引用(已核),模型上下文不受影响;`references/rangacharya_source_manifest.json` 只改路径字符串,`rangacharya_readiness.py` 只判断文件是否可读,输出不变。
## 5. 任务分解
**T1 删 `skills/jyotish-vedic-astrology/versions/` 三份快照**,`.gitignore:7-8` 两行随删。
验收:`frontend/tests/skill-registry.test.ts`、`skill-binding.test.ts` 通过;tsc / lint / `npm test` 与基线逐条一致;`next build` 后 `/` Static。
**T2 fixture 常量化。**
`frontend/tests/birth-time-journey-test-support.ts` 导出虚构 `FIXTURE_BIRTH`,13 个前端测试全部引用;`tests/conftest.py` 导出 `FIXTURE_BIRTH_DATE` / `FIXTURE_BIRTH_TIME`,8 个 Python 测试引用。`test_active_rectification_api.py:32-33` 的扫描区间断言按新常量重算,三栏说明。`docs/superpowers/plans/2026-07-17-birth-date-picker.md:52,418` 示例日期同步换。
验收:用第 1 节取到的检索键 `git grep` `frontend/tests tests docs` 为 0;两侧测试数量不低于基线。
**T3 删整机扫描台账与会话转录。**
- 删 `references/oracle/` 上述 11 份及各自合同测试:`tests/test_{deep_fragment_oss_reuse_gate_round2,fragment_migration_registries,fragment_second_pass_candidate_ledger,high_value_gap_registries,technique_promotion_audit_kp_gochara_muhurta,truth_source_runtime_identity,whole_machine_jyotish_fragment_scan,workbuddy_round3_candidate_ledger,workbuddy_round4_candidate_ledger,workbuddy_round4_formalization_registry,workbuddy_round4_usage_closure_queue,workbuddy_round5_transfer_status}.py`;`tests/test_skill_truth_overlay_application.py` 里读 `technique_promotion_audit_*` 的段落删除;`scripts/technique_promotion_audit_kp_gochara_muhurta.py` 整个删除。
- `references/rangacharya_source_manifest.json` 与 `scripts/rangacharya_readiness.py` 里的本机路径改 `<home>` 占位,不删文件。
- 已按原决策核实并删除两份指定私人会话转录(不在文档中重录其识别性文件名),以及 `references/upstream/test_birth_time_rectification_skill_contract.py`;`TASK-rectification-convergence-20260830.md:199,407,457` 与 `PROGRESS-rectification-convergence-20260830.md:18-19` 改为「会话转录已按 2026-09-19 决策删除」。
- `docs/research/whole_machine_fragment_sweep_2026_07_{14,16}.md` 与 `docs/superpowers/plans/` 四份里的本机路径改 `<home>`。
验收:本机用户名 `git grep -l` 在 HEAD 为 0(`references/upstream/yinduzhanxing/SKILL.md` 除外,按 §3 记 BLOCKED);pytest 数量 = 基线 − 被删测试数。
**T4 同步排除 + 仓库级隐私守卫。**
- `scripts/import_yinduzhanxing.py` 使用独立的 `REQUIRED_PRIVACY_PATH_PATTERNS` 强制排除原决策指定的七类私人/扫描资料路径,mirror 源和目标及 semantic_merge 路径都检查。本任务书不再复制涉及私人标识的模式字面量,具体规则以该常量为准;方括号脱敏说明不得当作 glob。`tests/test_import_yinduzhanxing.py` 按模式序号构造根目录/嵌套/大小写回归,不复制私人值。
- 新增 `tests/test_repo_privacy_markers.py`:扫 `git ls-files`(排除 pdf / wasm / `vendor/` / `references/open_source_sources/`),模式来自 `test_consultation_contract_golden.py:44` 的 `FORBIDDEN_PRIVACY_MARKERS` 复用 + 内置 `HOME_PREFIX(用户主目录前缀)` 前缀 + `tests/privacy_markers.local.txt`(gitignore,可选),命中即失败;`references/upstream/yinduzhanxing/SKILL.md` 在库主清完上游前列为显式豁免并注明到期条件。
验收:`.venv/bin/python -m pytest tests/test_repo_privacy_markers.py tests/test_import_yinduzhanxing.py tests/test_consultation_contract_golden.py -q` 通过;快速门 `run_quality_gate.py --profile quick` 通过。
**T5 记录。** `docs/BUG_HISTORY.md` 两条(§7)、`BLOCKED.md` 一条(上游快照豁免)、`CHANGELOG.md` 一行(无用户可感知行为变化,只记快照删除与隐私守卫)。
## 6. 让步顺序
1. T2、T3、T4 不可让步。
2. T1 若 `next build` 或 skill 加载有任何回归,退回「只删三份快照里含库主标识的 33 个文件」,写进度记录。
3. T2 若某 Python 测试换 fixture 后数值断言大面积变化,允许该测试标 `skip` 并写 BLOCKED,不允许静默删断言。
## 7. BUG 编号起点
开工时核对 `docs/BUG_HISTORY.md` 最大号(写单时为 BUG-971),从 BUG-972 起:
- BUG-972:上游库主的出生资料、会话转录与本机路径经镜像同步进入本仓跟踪文件(T1~T3)。
- BUG-973:镜像同步无隐私排除项,`FORBIDDEN_PRIVACY_MARKERS` 只覆盖咨询输出不覆盖仓库文件(T4)。
## 8. 开工前置命令
```bash
cd /workspace/Jyotisha && git status -sb && git fetch origin --prune
git worktree add -b codex/owner-case-purge-20260919 .worktrees/owner-case-purge-20260919 origin/staging
cd .worktrees/owner-case-purge-20260919
.venv/bin/python -m pytest tests -q 2>&1 | tail -3 # 基线数量与失败清单
cd frontend && npm test 2>&1 | tail -5 && ./node_modules/.bin/tsc --noEmit && npm run lint && npm run build 2>&1 | grep -E "○ /$|First Load"
```
## 9. 验收口径
tsc 0 错;lint 0 error;`npm test` 失败清单与基线 `b05d2fa1` 逐条一致;`next build` `/` Static;首屏 gzip ±2%;pytest 数量 = 基线 − 已列明的删除数;快速门通过;三组检索(案例标识 / 生日与分钟 / 本机用户名)在 HEAD 为 0(仅上游快照豁免);推 staging 后 `/api/health` 的 `deployment.gitCommit` 等于该提交。进度记录 `docs/tasks/PROGRESS-owner-case-purge-20260919.md`。