fix(gate-quality): trust_engine_v2 类型注解用 TYPE_CHECKING 导入 - #307
Merged
Conversation
- F821: to_audit_record/__init__ 注解中的 UnifiedAuditRecord/UnifiedAuditStore 此前仅在函数体内惰性导入,注解求值时未定义 → 移到 TYPE_CHECKING 块 - I001: @DataClass 前补双空行,满足 import 块与顶层代码分隔
|
Athena seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
1 similar comment
|
Athena seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
gate-quality 的
ruff check src/maref src/maref_lite在 CI 上仍失败,此前(PR #302)只修了__init__.py的 I001,但完整树检查发现 3 个 pre-existing 错误全部来自src/maref/recursive/trust_engine_v2.py:F821at 94:55 —def to_audit_record(...) -> UnifiedAuditRecord注解中UnifiedAuditRecord未定义(lazy import 仅在函数体内)F821at 148:37 —def __init__(self, audit_store: UnifiedAuditStore | None = None)注解中UnifiedAuditStore未定义I001at 1:1 —@dataclass前缺双空行(import 块与顶层代码分隔)修复
from typing import TYPE_CHECKING, Any+if TYPE_CHECKING:块引入两个类型(运行时惰性导入保留,无循环 import 风险)@dataclass前补双空行验证
ruff check src/maref src/maref_lite→ All checks passed!ruff format --check目标文件 → already formatted/Volumes/硬编码路径(No hardcoded paths 步骤不受影响)