返回提示词目录第 1407 页

盘点弃用接口并规划升级修复

根据警告与代码归并弃用接口,区分可提前修复和升级阻塞项,输出分批改动清单与扫描补漏方案。

完整提示词

<context>
An engineer is preparing a framework or SDK upgrade and has a wall of deprecation warnings. Treating them as one list leads to a giant upgrade branch that never merges. Experts group warnings by replacement (one fix pattern covers many sites), fix what the current version already supports, so each change ships safely before the upgrade, and leave only true version-coupled changes for the upgrade itself. Warnings also undercount: some deprecations only fire at runtime on rarely used paths, some are hidden by log filters, and dependencies emit warnings the team cannot fix directly.

Target version: {{target_version}}
</context>

<task>
<warnings_or_code>
{{warnings_or_code}}
</warnings_or_code>

1. Parse each warning or usage: the deprecated API, the replacement named in the message or docs, file and line, and the source (own code, a dependency, generated code, configuration). Deduplicate identical warnings that repeat per test or request.
2. Group by replacement: one group per deprecated API or pattern, with its count of call sites and files.
3. For each group decide:
   - Fixable now: the replacement exists in the current version, so the change ships before the upgrade.
   - Upgrade-coupled: the replacement only exists in the target version; it must change with the upgrade (consider a small compatibility shim).
   - Dependency-owned: the warning comes from a library; the fix is upgrading or replacing that library, or waiting.
   - Removed in target: if a target version is given above and its docs or the warning say it removes the API, mark it blocking.
   Mark anything you are unsure about as "to verify in the release notes".
4. Estimate effort per group (S: mechanical, codemod or search-and-replace; M: needs judgement per site; L: behaviour change or design decision), and whether an official codemod or automated fix exists (only if sure).
5. Order the work: blocking groups first, then high-count mechanical groups (a codemod clears many warnings in one review), then the rest; each item is one small pull request. Propose turning fixed deprecations into errors in CI (warnings-as-errors for that category) so they do not come back.
6. Gaps in the scan: how to surface deprecations the input missed (run the full test suite with deprecation warnings enabled and not filtered, enable runtime deprecation logging in staging, compiler or linter deprecation flags, a search for known deprecated names).
</task>

<constraints>
- Use only warnings and code given; do not invent call sites or counts.
- Do not claim an API is removed in a version unless the warning says so or you are sure; otherwise mark it to verify.
- If the current version is missing and it matters for "fixable now", ask for it.
{{> output/uncertainty}}
</constraints>

<output_format>
## Summary
Totals: warnings parsed, unique groups, blocking groups, fixable now.

## Deprecation groups
Table: group (deprecated API) | replacement | sites | source | category (fixable now, upgrade-coupled, dependency-owned, blocking) | effort | codemod?

## Work order
Numbered list of small changes, each with the group and the CI guard to add.

## Gaps in the scan
Bullets with commands or settings to run.

## Open questions
Bullets.
</output_format>

可替换内容

  • {{target_version}}
  • {{warnings_or_code}}
  • {{> output/uncertainty}}

分类与标签

编程开发、框架升级、弃用接口、代码迁移、持续集成

前往 AI 图片创作