Skip to content

简化过度防御代码 #709

Open
Open

Description

@minorcell

当前项目其实其中有大量的过度防御代码,一些函数的调用其实是非常不信任上游的,但是上游呢又完全不会出问题,所以这里面需要简化。帮我分析并删掉所有的过度防御性代码。

Activity

  1. minorcell commented on Jun 5, 2026

    @minorcell
    MemberAuthor

    /code

  2. fennoai commented on Jun 5, 2026

    @fennoai
    Contributor

    已完成

    已提交并创建 PR:#710 #710

    本次变更聚焦 internal/context 中已被新 stable/dynamic source 构造链路取代的防御性兼容代码:

    • 删除 DefaultBuilder.promptSources 旧字段及其回退逻辑。
    • 删除 NewConfiguredBuilder 对 nil SectionSource 的跳过兜底,改为依赖上游传入有效 source。
    • 调整 builder 测试,覆盖当前 stable/dynamic source 行为,不再保留旧兼容断言。

    验证

    • 已运行:git diff --check
    • 已确认:旧 promptSources / backward compatibility 相关引用无残留
    • 未运行:go test ./...,因为当前环境中 go 和 gofmt 不在 PATH

    提交:56ba6bb5

    View job run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions