makecindy / makecindy/cindy

fix: ghost install receipt「normalized setup」测试失败 — helper 用 author format

Open
#2,897 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 现象

`apps/desktop/src/main/cindy-brain/__tests__/ghostInstallReceipt.test.ts` 里
`GhostInstallReceiptStore cleanup > still reads normalized setup receipts emitted by affected builds`
稳定失败(2 个断言),`store.read('hello')` 返回 `state: 'invalid'` 而非 `state: 'approved'`。

在干净的 main + 标准 node_modules 下即可复现,与其它改动无关。

## 根因(已定位到格式漂移)

- 测试 helper `createSetupReceipt()` 用 `validateGhostManifest` 产出 manifest,其 `setup.requires` 是
**author format**:`{ anyOf: ['secret:api_key'] }`(字符串简写)。
- 而 `validateReceipt` 调 `validateNormalizedGhostManifest`,期望 **normalized format**:
`{ anyOf: [{ kind: 'secret', key: 'api_key' }] }`(对象)。
- 测试上方 `writes setup in the author format accepted by the v0.1.48 receipt reader` 说明仓库刻意区分
author / normalized 两套格式,但 helper 把未经 normalize 的 author format 塞进了 receipt。

## 待判定

normalize 该发生在哪一侧:是 `createGhostInstallReceipt` 漏了 normalize(源码 bug),还是
测试 helper 该直接用 normalized 格式(测试过时)?需追 ghost 的真实 build/normalize 链路后再定。

Contributor guide

Open the contributing guide

Research direction

Start with apps/desktop/src/main/cindy-brain/__tests__/ghostInstallReceipt.test.ts and compare createSetupReceipt with validateGhostManifest, validateReceipt, and validateNormalizedGhostManifest. Trace the real ghost build and normalization path before deciding whether createGhostInstallReceipt or the test helper is wrong. Done means the affected receipt test passes with the intended author/normalized format boundary.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.