Compare commits

...
Author SHA1 Message Date
cflmy f89b2dd81e feat: show release notes and official download in update check
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
Continue app-harness#16 goal 4: the application update check now displays the
trusted release metadata a user needs to decide.

- release/gitea.ts reads the trusted Gitea release body (truncated to 8 KiB)
  into the candidate alongside the already-validated manifest/asset.
- UpdateCandidate gains notes and release_url; UpdateState.latest persists both.
- mqdh update check text output adds published/download/release URL/known limits
  and release notes; JSON already carries the same fields.
- DISTRIBUTION documents the fields; RELEASING names the Gitea release body as
  the single source of release notes (no second list).
- updater.test.ts fake release carries a body and asserts notes/release_url.

Verified locally: updater tests 3/3, all downstream node tests 77 pass/3
skipped, typecheck 5/5. No release/tag; full ecosystem latest-version view and
E09 notification/reconciliation remain UNVERIFIED.
2026-11-30 21:57:22 +08:00
cflmy eceb13a70a Merge pull request #19 from codex/issue-16-status-view
ci/woodpecker/push/ci Pipeline was successful
feat: read-only mqdh status ecosystem view (#16 slice)
2026-11-30 20:44:29 +08:00
7 changed files with 62 additions and 2 deletions

No files matched your search

+1
View File
@@ -73,6 +73,7 @@ mqdh update rollback --confirm [--json]
- 失败关闭:摘要/平台/兼容/smoke 任一失败都不改指针,staging 清理。
- 更新不触碰 `MQDH_HOME/ecosystem`;Marqdo 运行时仍由 Bootstrap/生态中心独立管理。
- 应用仓库当前为私有开发仓时,匿名检查返回 403/404,状态显示 `update.unavailable`(不是伪造“已是最新”)。正式发行需公开仓库或显式配置凭据。
- `update check` 同时展示最新候选的 `published_at`、官方下载 URL(`latest.asset.url`)、Release 页面 URL(`latest.release_url`)、`known_limits` 与发布说明;发布说明来自可信 Gitea Release body(截断到 8 KiB),不是第二份清单。JSON 字段为 `latest.notes` 与 `latest.release_url`。
## 5. 构建与发布
+5 -1
View File
@@ -73,6 +73,10 @@ cd marqdo-harness-<version>-x86_64-unknown-linux-gnu
- 已发布版本有缺陷:发布更高版本;不删除或重写旧资产。用户侧可 `mqdh update rollback --confirm`。
- 签名错误:停止发布,轮换密钥并提升版本;不得重新上传同 tag。
## 7. 未验证
## 7. 发布说明
创建 Gitea Release 时填写的 body 是产品内 `mqdh update check` 展示的发布说明唯一来源(截断到 8 KiB);不要另建发布说明清单或第二份版本表。发布说明应包含用户可见变化、已知限制和升级注意项,且不得包含凭据、私有数据或未验证的 PASS 声明。
## 8. 未验证
生产签名证书/密钥托管、macOS/Windows 构建与公证、第二台干净主机、低于 2.39 glibc 的平台、真实断网更新与弱网大文件下载。以上保持 `UNVERIFIED`,不得写成 PASS。
@@ -0,0 +1,28 @@
# 应用更新检查展示发布说明/官方下载/已知限制(app-harness#16 切片)
Date: 2026-11-30. Branch: `codex/issue-16-update-notes`.
Baseline: `eceb13a70a723d8623cbf7f4b1b6979bdc303680`(main)。
## 交付
- `release/gitea.ts`:可信 Gitea Release 的 `body` 进入候选(截断 8192 字节,空值 null);`AppReleaseCandidate.notes` 与 `browser_url` 明确。
- `distribution/updater.ts`:`UpdateCandidate` 新增 `notes` 与 `release_url`;持久化 `UpdateState.latest` 携带二者。
- CLI `mqdh update check` 文本输出新增 `published`/`download`(官方资产 URL)/`release`(Release 页面)/`known limits`/`release notes`;JSON 已直接包含这些字段。
- 文档:`DISTRIBUTION.md` §4 更新检查字段、`RELEASING.md` §7 发布说明唯一来源(Gitea Release body,不另建清单)。
- 测试:`updater.test.ts` 的 fake Gitea Release 带 body,断言 `latest.notes` 与 `latest.release_url`。
## 验证(本机,Linux x86_64 / glibc 2.43)
```text
node --import tsx/esm --test packages/marqdo/harness/tests/updater.test.ts
3 pass, 0 fail
node --import tsx/esm --test packages/marqdo/harness/tests/*.test.ts
77 pass, 0 fail, 3 skipped
pnpm run typecheck → 5 passed, 0 failed
```
## 边界
- 发布说明来自可信 Release body,显示为数据;不执行、不解析为指令,不冒充“更新说明已验证”。
- 仍不是完整生态(CLI/View/Tools/Bundle/Knowledge)的最新版本聚合;E09 通知/对账仍 UNVERIFIED。
- 未创建 release/tag;未运行浏览器/真实 Gitea 端到端。
+8
View File
@@ -432,6 +432,14 @@ async function runUpdate(parsed: ParsedCommand, io: CliIO, runtime: () => Promis
`channel: ${state.channel}`,
`latest: ${state.latest?.version ?? 'none'}${state.latest === null ? '' : ` (${state.latest.signature})`}`,
`update available: ${String(state.update_available)}`,
...(state.latest === null ? [] : [
`published: ${state.latest.published_at}`,
`download: ${state.latest.asset.url}`,
`release: ${state.latest.release_url}`,
...(state.latest.known_limits.length === 0 ? [] : ['known limits:']),
...state.latest.known_limits.map(limit => ` - ${limit}`),
...(state.latest.notes === null ? [] : ['release notes:', ...state.latest.notes.split('\n').map(line => ` ${line}`)]),
]),
...(state.last_error === null ? [] : [`error: ${state.last_error.code}: ${state.last_error.message}`]),
].join('\n') + '\n')
}
@@ -52,6 +52,10 @@ export interface UpdateCandidate {
readonly node: string
readonly signature: 'verified' | 'unsigned'
readonly known_limits: readonly string[]
/** Release notes from the trusted release body, or null. */
readonly notes: string | null
/** Official browser URL of the release page. */
readonly release_url: string
}
/** Persisted update state. */
@@ -135,6 +139,8 @@ function candidateOf(candidate: AppReleaseCandidate): UpdateCandidate {
node: candidate.manifest.app.node,
signature: candidate.signature.status,
known_limits: candidate.manifest.known_limits,
notes: candidate.notes,
release_url: candidate.browser_url,
}
}
@@ -38,6 +38,8 @@ export interface GiteaRelease {
readonly prerelease: boolean
readonly draft: boolean
readonly target_commitish: string | null
/** Release notes authored in the trusted Gitea release, truncated. */
readonly body: string | null
readonly assets: readonly GiteaAsset[]
}
@@ -72,11 +74,15 @@ function parseRelease(raw: unknown): GiteaRelease {
const record = raw as Record<string, unknown>
if (typeof record.tag_name !== 'string') throw new GiteaError('invalid_response', 'release has no tag_name')
const assets = Array.isArray(record.assets) ? record.assets.map(parseAsset) : []
const body = typeof record.body === 'string' && record.body.trim() !== ''
? record.body.slice(0, 8192)
: null
return {
tag_name: record.tag_name,
prerelease: record.prerelease === true,
draft: record.draft === true,
target_commitish: typeof record.target_commitish === 'string' ? record.target_commitish : null,
body,
assets,
}
}
@@ -131,6 +137,8 @@ export interface AppReleaseCandidate {
readonly asset: { readonly name: string; readonly url: string; readonly size: number; readonly sha256: string }
readonly manifest_url: string
readonly browser_url: string
/** Release notes from the release body, or null when absent. */
readonly notes: string | null
}
/** Read a detached signature asset when the release publishes one. */
@@ -258,6 +266,7 @@ async function inspectRelease(
},
manifest_url: manifestAsset.browser_download_url,
browser_url: `${authority}/${repository}/releases/tag/${release.tag_name}`,
notes: release.body,
}
}
@@ -81,6 +81,7 @@ async function startReleaseServer(releases: readonly {
manifest: string
signature: string
size: number
body?: string
}[]): Promise<{ server: Server; authority: string; stop: () => void }> {
const server = createServer(async (req: IncomingMessage, res: ServerResponse) => {
const url = req.url ?? ''
@@ -92,6 +93,7 @@ async function startReleaseServer(releases: readonly {
prerelease: false,
draft: false,
target_commitish: null,
body: release.body ?? null,
assets: [
{ name: 'mqdh-release.json', size: Buffer.byteLength(release.manifest), browser_download_url: `${authority}/assets/${release.tag}/mqdh-release.json` },
{ name: 'mqdh-release.json.sig', size: Buffer.byteLength(release.signature), browser_download_url: `${authority}/assets/${release.tag}/mqdh-release.json.sig` },
@@ -150,13 +152,15 @@ test('checks, verifies, activates and rolls back a signed application release',
const v3 = await buildRelease({ root, version: '0.3.0', target })
const server = await startReleaseServer([
{ tag: 'mqdh-v0.2.0', archive: v2.archive, manifest: v2.manifest, signature: v2.signature, size: v2.size },
{ tag: 'mqdh-v0.3.0', archive: v3.archive, manifest: v3.manifest, signature: v3.signature, size: v3.size },
{ tag: 'mqdh-v0.3.0', archive: v3.archive, manifest: v3.manifest, signature: v3.signature, size: v3.size, body: '修复启动问题并更新默认 Bundle。' },
])
const { updater, installRoot } = await makeUpdater(server.authority)
try {
const checked = await updater.check({ force: true })
assert.equal(checked.latest?.version, '0.3.0')
assert.equal(checked.latest?.signature, 'verified')
assert.equal(checked.latest?.notes, '修复启动问题并更新默认 Bundle。')
assert.match(checked.latest?.release_url ?? '', /releases\/tag\/mqdh-v0\.3\.0$/)
assert.equal(checked.update_available, true)
assert.equal(checked.current?.version, '0.1.0')