Skip to content

feat: 强制清单规则,补齐 prepack 与生命周期幂等 - #22

Merged
residua1 merged 7 commits into
mainfrom
feat/manifest-rules
Nov 5, 2026
Merged

residua1 merged 7 commits into
mainfrom
feat/manifest-rules

Conversation

@residua1

@residua1 residua1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

概要

按 ADR-0006 / 0013 / 0031 / 0042 把清单与生命周期的规则落到读取器与打包器上。

  • 每个非载体包必须声明 hosihikari 依赖,两处都拒绝。
  • extraInfo.packageKind:plugin/loader/carrier,其它值报错;carrier 只给 hosihikari,自持态扫描跳过载体包。
  • extraInfo.prepack 在打包期于包目录执行(字符串或数组),失败或 5 分钟超时拒包。
  • 共享层清单改读契约;载体交进来的程序集并进清单。
  • 卸载验证只收有限超时;Disable 幂等;待回收也算依赖者。
  • 新增 R21–R23 断言,夹具清单补全;核心 1.3.0,Build 与 Testing 1.1.0。

验证

  • dotnet run --project host/... -c Release:79 项全过
  • bash tools/Build/smoke.sh:通过
  • dotnet run --project testing/...Testing.Smoke:通过
  • bash ./pack.sh 0.0.0-check:出包成功

- 每个非载体包必须声明 hosihikari 依赖,读取器与打包器都拒绝(ADR-0006)
- extraInfo.packageKind:plugin/loader/carrier,其它值报错;carrier 只给 hosihikari,自持态扫描跳过
- extraInfo.prepack 在打包期于包目录执行,字符串或数组都收,失败或超时拒包(ADR-0031)
- 共享层清单改读契约;载体注册加载器时把程序集并进清单
- 卸载验证只收有限超时(ADR-0042)
- Disable 幂等,与 Enable 对称;待回收也算依赖者(ADR-0013 / 0004)
- 打包期拒绝缺框架依赖、未知 packageKind、错名载体包;新增 R21–R23 断言并把夹具清单补全
- 版本:核心 1.3.0,Plugin.Build 与 Testing 1.1.0
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T06:55:30.962643Z dca6aef Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e15877f34e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/PluginManager.cs Outdated
Comment on lines +67 to +68
if (options.UnloadVerificationTimeout <= TimeSpan.Zero
|| options.UnloadVerificationTimeout > MaxUnloadVerificationTimeout)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the documented timeout option in the 1.x API

Existing carriers that pass Timeout.InfiniteTimeSpan through PluginManagerOptions now fail during manager construction with ArgumentOutOfRangeException, although this was explicitly supported by the previous public API. Removing that accepted value in the 1.3.0 release violates the repository's additive-only requirement for 1.x changes. Preserve compatibility in this release or defer the breaking change to a major version.

AGENTS.md reference: AGENTS.md:L31-L32

Useful? React with 👍 / 👎.

Comment thread tools/Pack/Packager.cs
Comment on lines +129 to +133
if (kind != "carrier"
&& !manifest.Dependencies.Any(dependency =>
string.Equals(dependency?.Name, PluginContractInfo.ParentName, StringComparison.Ordinal)))
{
problems.Add(PackText.Get("MissingFrameworkDependency"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update the Build smoke fixture for the required dependency

The manifest generated in tools/Build/smoke.sh still omits dependencies, so packaging that fixture with the updated packer now returns MissingFrameworkDependency instead of producing the package. This breaks the MSBuild packaging smoke step in .github/workflows/verify.yml. Add the required hosihikari dependency to that fixture alongside enforcing the new rule.

AGENTS.md reference: AGENTS.md:L20-L20

Useful? React with 👍 / 👎.

Comment thread tools/Pack/Packager.cs Outdated
Comment on lines +171 to +172
// 进程外插件的 prepack 也在打包期跑,装 node_modules / venv 之类(ADR-0031)。
Prepack(manifest, sourceDirectory, problems);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate shared-layer files after running prepack

If a successful prepack command creates or copies a shared-layer DLL into the source directory, it bypasses the shared-layer scan, which has already finished before this call. The subsequent recursive copy includes the new DLL without another check, allowing Pack to report success for a package it would otherwise reject for duplicate shared assemblies. Run prepack before the file validations, or repeat those validations against the resulting files before copying them into the package.

Useful? React with 👍 / 👎.

- InfiniteTimeSpan 仍是 1.3.0 的合法取值(1.x 加法承诺),只有有限值走范围校验
- prepack 挪到共享层扫描与入口检查之前,装出来的文件也受同一套校验
- tools/Build/smoke.sh 的夹具清单补上 hosihikari 依赖

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa86b1ca00

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/Pack/Packager.cs Outdated

if (process.ExitCode != 0)
{
var detail = (stderr.GetAwaiter().GetResult() + stdout.GetAwaiter().GetResult()).Trim();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the prepack timeout to redirected output reads

If a failing prepack command starts a background child that inherits stdout or stderr, the main process can exit while those pipes remain open. WaitForExit then returns immediately, but these unbounded GetResult() calls wait for the child to close the pipes, bypassing the five-minute timeout and potentially hanging packaging indefinitely. Apply the same overall deadline to process completion and output draining so this failure path also returns within the configured limit.

Useful? React with 👍 / 👎.

@residua1

residua1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 491329a6a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

孙进程继承管道时主进程可能先退出,读 stdout/stderr 会一直等下去;现在整段 prepack
共用一个截止时间,超时连树一起杀。
@residua1

residua1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 386bc7c7fe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/Pack/Packager.cs
.Where(item => item.ValueKind == JsonValueKind.String)
.Select(item => item.GetString()!)
.Where(item => item.Length > 0));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve empty arguments in prepack command arrays

When a prepack command intentionally includes an empty argument, .Where(item => item.Length > 0) removes it and shifts subsequent arguments. For example, a script invoked with ["python", "prepare.py", "", "release"] receives different positional arguments than the manifest specifies, potentially failing packaging or generating the wrong artifacts. Preserve empty strings after the executable position and validate the executable separately.

Useful? React with 👍 / 👎.

<TargetFramework>net10.0</TargetFramework>
<PackageId>Hosihikari.Plugin.Build</PackageId>
<Version>1.0.0</Version>
<Version>1.1.0</Version>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update the smoke fixture to request the new Build version

With Hosihikari.Plugin.Build 1.0.0 already in the global NuGet cache, tools/Build/smoke.sh can still restore that version because its generated project continues to request Version="1.0.0". Although the script builds 1.1.0 into its temporary feed, the smoke step in .github/workflows/verify.yml can therefore exercise the old packaged targets and packer instead of this change. Update the fixture's package reference alongside this version bump so the required smoke check reliably tests the newly built package.

AGENTS.md reference: AGENTS.md:L20-L20

Useful? React with 👍 / 👎.

@residua1

residua1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a16837bd27

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/Pack/Packager.cs

// prepack 先跑(ADR-0031):它会往包目录里装 node_modules / venv,
// 之后共享层扫描与递归复制看到的就是最终产物。
Prepack(manifest, sourceDirectory, problems);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bump the standalone packer version to distribute these changes

If Hosihikari.Plugin.Pack 1.0.0 has already been published, these new packaging rules and prepack support will not reach standalone hosihikari-pack users: tools/Pack/Hosihikari.Plugin.Pack.csproj still declares version 1.0.0. The inspected release workflow packs that project and pushes it with --skip-duplicate (.github/workflows/release.yml:175–195), which the CLI documentation says “treats any 409 Conflict response as a warning.” Consequently, the release can succeed while retaining the old standalone tool, even though Build 1.1.0 bundles the new implementation. Increment the packer's independently managed version and update the tool-install smoke check accordingly.

AGENTS.md reference: AGENTS.md:L38-L41

Useful? React with 👍 / 👎.

@residua1

residua1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 2696f2f2b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@residua1

residua1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: dca6aef0a0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@residua1
residua1 merged commit 3cc16fd into main Nov 5, 2026
5 checks passed
@residua1
residua1 deleted the feat/manifest-rules branch November 5, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants