Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Validate license headers
run: python3 scripts/license-header.py --check

- name: Validate runtime-generator boundaries
run: python3 scripts/validate-runtime-generator-boundaries.py

# 缓存MegaLinter
- name: Cache MegaLinter
uses: actions/cache@v5
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ jobs:

diff -u expected-packages.txt actual-packages.txt

- name: Validate runtime-generator package boundaries
run: python3 scripts/validate-runtime-generator-boundaries.py --package-dir ./packages

- name: Show packages
run: ls -la ./packages || true

Expand Down
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ All generated or modified code MUST include clear and meaningful comments where
- Private fields: `_camelCase`
- Keep abstractions projects free of implementation details and engine-specific dependencies.
- Preserve existing module boundaries. Do not introduce new cross-module dependencies without clear architectural need.
- Framework runtime, abstractions, and meta-package projects MUST NOT reference `*.SourceGenerators*` projects or packages,
and MUST NOT use source-generator attributes such as `GenerateEnumExtensions` or `ContextAware`. Those capabilities are
reserved for consumer projects, generator projects, examples explicitly meant to demonstrate generator usage, and related tests.

### Formatting

Expand Down
3 changes: 0 additions & 3 deletions GFramework.Game/Config/YamlConfigSchemaPropertyType.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// Copyright (c) 2025-2026 GeWuYou
// SPDX-License-Identifier: Apache-2.0

using GFramework.Core.SourceGenerators.Abstractions.Enums;

namespace GFramework.Game.Config;

/// <summary>
/// 表示当前运行时 schema 校验器支持的属性类型。
/// </summary>
[GenerateEnumExtensions]
internal enum YamlConfigSchemaPropertyType
{
/// <summary>
Expand Down
3 changes: 0 additions & 3 deletions GFramework.Game/Config/YamlConfigStringFormatKind.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// Copyright (c) 2025-2026 GeWuYou
// SPDX-License-Identifier: Apache-2.0

using GFramework.Core.SourceGenerators.Abstractions.Enums;

namespace GFramework.Game.Config;

/// <summary>
/// 表示当前 Runtime / Generator / Tooling 共享支持的字符串 format 子集。
/// </summary>
[GenerateEnumExtensions]
internal enum YamlConfigStringFormatKind
{
/// <summary>
Expand Down
1 change: 0 additions & 1 deletion GFramework.Game/GFramework.Game.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<EnableGFrameworkPackageTransitiveGlobalUsings>true</EnableGFrameworkPackageTransitiveGlobalUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\GFramework.Core.SourceGenerators.Abstractions\GFramework.Core.SourceGenerators.Abstractions.csproj" />
<ProjectReference Include="..\GFramework.Core\GFramework.Core.csproj"/>
<ProjectReference Include="..\$(AssemblyName).Abstractions\$(AssemblyName).Abstractions.csproj"/>
</ItemGroup>
Expand Down
7 changes: 7 additions & 0 deletions ai-plan/public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ help the current worktree land on the right recovery documents without scanning
- Purpose: migrate release version calculation from fixed patch bumps to semantic-release while keeping the existing tag-driven NuGet publish flow.
- Tracking: `ai-plan/public/semantic-release-versioning/todos/semantic-release-versioning-tracking.md`
- Trace: `ai-plan/public/semantic-release-versioning/traces/semantic-release-versioning-trace.md`
- `runtime-generator-boundary`
- Purpose: keep runtime and abstractions packages isolated from source-generator dependencies, packaging leaks, and attribute usage.
- Tracking: `ai-plan/public/runtime-generator-boundary/todos/runtime-generator-boundary-tracking.md`
- Trace: `ai-plan/public/runtime-generator-boundary/traces/runtime-generator-boundary-trace.md`

## Worktree To Active Topic Map

Expand All @@ -68,6 +72,9 @@ help the current worktree land on the right recovery documents without scanning
- Branch: `fix/release-notes-pr-links`
- Worktree hint: `GFramework`
- Priority 1: `semantic-release-versioning`
- Branch: `fix/runtime-generator-boundary`
- Worktree hint: `GFramework`
- Priority 1: `runtime-generator-boundary`
- Branch: `docs/sdk-update-documentation`
- Worktree hint: `GFramework-update-documentation`
- Priority 1: `documentation-full-coverage-governance`
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Runtime / Generator Boundary Tracking

## Goal

Keep runtime, abstractions, and meta-package modules free from source-generator project references, source-generator
attributes, and leaked NuGet dependencies.

## Current Recovery Point

- Recovery point: RGB-RP-001
- Phase: remove `GFramework.Game` generator coupling and add repository guardrails
- Focus:
- delete `GFramework.Game`'s dependency on `GFramework.Core.SourceGenerators.Abstractions`
- remove unused `[GenerateEnumExtensions]` usage from `GFramework.Game`
- add static and packed-package validation so runtime packages cannot regress

## Active Risks

- A runtime package can still compile locally if it references a non-packable generator helper project, so regressions are
easy to miss without an explicit guard.
- A leaked package dependency may only surface when a consumer restores from NuGet, not during normal repository builds.

## Completed In This Stage

- Confirmed `GFramework.Game` was the direct runtime offender and `GeWuYou.GFramework.Game` leaked
`GFramework.Core.SourceGenerators.Abstractions` into its nuspec dependency graph.
- Confirmed the two `[GenerateEnumExtensions]` usages inside `GFramework.Game` do not need generated output and can be
removed outright.

## Validation Target

- `python3 scripts/validate-runtime-generator-boundaries.py`
- `dotnet build GFramework.Game/GFramework.Game.csproj -c Release`
- `dotnet build GFramework.Godot/GFramework.Godot.csproj -c Release`
- `dotnet pack GFramework.sln -c Release -p:PackageVersion=<local>`

## Next Recommended Resume Step

Run the new boundary validator plus minimal Release build and pack validation, then inspect `GeWuYou.GFramework.Game`
and transitive runtime packages to confirm no `SourceGenerators` dependency remains.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Runtime / Generator Boundary Trace

## 2026-05-05

### RGB-RP-001 Runtime package boundary repair

- Trigger:
- external consumers restoring `GeWuYou.GFramework.Game` failed because NuGet looked for
`GFramework.Core.SourceGenerators.Abstractions`
- repository inspection showed `GFramework.Game` had a direct project reference to a non-packable generator
abstractions project and used `[GenerateEnumExtensions]`
- Decisions:
- treat the issue as a runtime/generator boundary violation, not as a missing publish target
- remove the runtime-side attribute usage instead of turning generator abstractions into public runtime packages
- add repository guardrails at both source-validation time and packed-package validation time
- Expected implementation:
- `GFramework.Game` removes the generator abstractions project reference
- `GFramework.Game` removes the two unused enum generator attributes
- CI and publish workflows run a dedicated boundary validator script
- Immediate next step:
- complete implementation and run Release build plus pack verification
8 changes: 8 additions & 0 deletions docs/zh-CN/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ git push origin your-branch

### 命名规范

### 代码生成器边界

- 框架内部的运行时模块、抽象层模块和顶层元包不得依赖 `*.SourceGenerators*` 项目或包。
- `GenerateEnumExtensions`、`ContextAware`、`GetModel`、`GetService` 等代码生成器 attribute 只允许出现在消费端项目、
生成器项目本身、专门验证生成器行为的测试项目,或明确用于演示生成器接入的示例中。
- 如果某个运行时模块为了编译而需要引入生成器 attribute,说明模块边界已经漂移;应优先移除该 attribute 使用,而不是把
generator abstractions 暴露成新的运行时依赖。

遵循 C# 标准命名约定:
Comment thread
GeWuYou marked this conversation as resolved.

- **类、接口、方法**:PascalCase
Expand Down
Loading
Loading