功能实现与重构
Feature implementation & refactoring
Add a feature or refactor across modules without breaking behavior.
20 条本项目编写的提案 · 分类 v1.1 · 新增基准运行 0 次。下方验证方式与部分得分规则是设计,不是执行结果。
- 典型应用
- git · IDE · test runner
- 小类 GUI 需求标签
CL· CLI 足够
任务提案 · 20
展开查看完整原文与建议检查方式;两种界面均保留提案英文原文。
R02.01.01.02-T01 Add a --json output mode to an existing Python CLI
原始指令
Repo `/work/diskreport` (Python, Click). Add a `--json` flag to the `scan` and `top` commands that prints machine-readable output matching the schema in `docs/json_schema.json`, keeping the default human-readable output byte-identical. Update `--help` text.
- 平台
lin· Linuxmac· macOS- 应用
- Click · pytest
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 2 / 5
建议验证方式
Hidden tests run both commands on fixture trees: JSON validates against the schema and values match; default output byte-identical to golden files; --help mentions --json.
建议部分得分
50% JSON correct for both commands; 40% default output unchanged; 10% help text
R02.01.01.02-T02 Add cursor-based pagination to a FastAPI list endpoint
原始指令
Service `/work/notes-api` (FastAPI, SQLAlchemy, Postgres in Docker). Replace offset pagination on `GET /notes` with opaque cursor pagination (`limit`, `cursor`, response `next_cursor`), stable under concurrent inserts, while keeping `?page=` working for one release with a `Deprecation` header.
- 平台
lin· Linux- 应用
- FastAPI · pytest · Docker
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden API tests: full traversal returns each note exactly once while inserts happen mid-iteration; tampered cursors return 400; legacy ?page= works and returns Deprecation header; OpenAPI schema lists new params.
建议部分得分
40% exactly-once traversal; 20% cursor validation; 25% legacy compatibility; 15% OpenAPI
R02.01.01.02-T03 Rename a public API with a deprecation shim and update all call sites
原始指令
Library `/work/geoutil` (Python). Rename `calc_dist()` to `distance()` and module `geoutil.helpers` to `geoutil.geometry`. Old names must keep working for one release, emitting `DeprecationWarning` once per call site. Update every internal call site, the docs and the changelog.
- 平台
lin· Linuxmac· macOS- 应用
- pytest · git
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 2 / 5
建议验证方式
Hidden tests: new names work; old imports and calls work and warn (category and stacklevel pointing at caller); grep finds no internal use of old names; docs build (sphinx -W) passes; CHANGELOG has an entry.
建议部分得分
30% new API; 30% shims with correct warnings; 25% internal call sites; 15% docs/changelog
R02.01.01.02-T04 Thread context cancellation through a Go service's call chain
原始指令
Repo `/work/fetcher` (Go). Requests can't be cancelled: handlers call `store.Get`, `cache.Fill` and `upstream.Fetch` without `context.Context`. Add context parameters through the chain so client disconnects cancel upstream calls within 50 ms, and update all callers and tests.
- 平台
lin· Linux- 应用
- go · git
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Hidden test: client disconnect cancels the mock upstream within 50 ms (measured); no goroutine leaks (goleak); `go vet` and staticcheck clean; all existing tests updated and green.
建议部分得分
50% cancellation propagates within bound; 20% no leaks; 30% build/tests/lint green
R02.01.01.02-T05 Add a persisted dark-mode toggle to a React app and verify it in the browser
原始指令
App `/work/dashboard-web` (React + Vite). Add a theme toggle in the header that switches light/dark using the existing CSS variables, respects `prefers-color-scheme` on first visit, persists the choice across reloads, and has no flash of the wrong theme on load. Check it visually in a browser.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- Vite · Chrome · Playwright
- 交互表面
term· 终端brow· 浏览器- GUI 需求 · 任务设定
HY· 混合- GUI 需求 · 普通权限
G2· GUI 必要- 交互原语
code· 代码与命令vis· 视觉判断click· 指向与点击- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden Playwright tests: toggle switches computed background colors; emulated dark preference on first load; choice persists after reload; first paint screenshot (video frame 0) already in the stored theme; existing unit tests green.
建议部分得分
30% toggle works; 20% system preference; 25% persistence; 25% no flash on load
R02.01.01.02-T06 Replace a payment-fee class hierarchy with a strategy pattern in Java
原始指令
Maven project `/work/feecalc` (Java 21). Twelve subclasses of `FeeCalculator` override `compute()` with copy-pasted logic. Refactor to a single `FeeCalculator` using composable `FeeRule` strategies configured from `fees.yaml`, removing the subclasses, with behavior unchanged.
- 平台
lin· Linuxwin· Windowsmac· macOS- 应用
- Maven · JUnit
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Hidden golden test: 10,000 generated transactions produce identical fees before/after; no class extends FeeCalculator (ArchUnit rule); rules loaded from fees.yaml; mvn verify green.
建议部分得分
50% identical outputs; 30% hierarchy removed; 20% config-driven and build green
R02.01.01.02-T07 Make a Rust parser generic over any Read source
原始指令
Crate `/work/logparse` (Rust) only parses `&str` loaded fully into memory. Make `Parser` generic over `R: BufRead` so multi-GB files stream with bounded memory, keep a convenience `from_str` constructor, and keep the public error type stable.
- 平台
lin· Linuxmac· macOS- 应用
- cargo
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Hidden tests: parse a 3 GB generated log with peak RSS < 64 MB; outputs identical to from_str on 50 fixtures; cargo semver-checks reports no breaking change except allowed additions; clippy -D warnings clean.
建议部分得分
40% streaming with memory bound; 30% identical outputs; 30% API compatibility + clippy
R02.01.01.02-T08 Add gettext internationalization with two locales to a Flask app
原始指令
App `/work/booking-flask` has hard-coded English strings in templates and flash messages. Add Flask-Babel, extract all user-facing strings, provide complete Portuguese (pt_PT) and German (de) catalogs from `input/translations.csv`, and select locale from the `Accept-Language` header with a `?lang=` override.
- 平台
lin· Linux- 应用
- Flask · Babel · pytest
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden tests render 8 pages in each locale: no English leftovers outside an allowlist; strings equal translations.csv; plural forms correct for counts 0,1,2,5; locale negotiation and override work.
建议部分得分
40% strings extracted; 30% catalogs correct; 15% plurals; 15% negotiation
R02.01.01.02-T09 Add per-key rate limiting middleware to an Express API
原始指令
Service `/work/express-api` (Node 20). Add a sliding-window rate limiter: 100 requests per minute per API key, 20 per minute for anonymous IPs, Redis-backed so it works across 3 instances, returning 429 with `Retry-After` and `RateLimit-*` headers. Health checks are exempt.
- 平台
lin· Linux- 应用
- Node · Express · Redis
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden docker-compose test with 3 instances behind a round-robin proxy: 101st keyed request in 60 s gets 429 across instances; headers correct; anonymous limit 20; /healthz unlimited; existing tests green.
建议部分得分
40% limits enforced across instances; 25% headers; 20% anonymous path; 15% exemption + suite
R02.01.01.02-T10 Convert a callback-based Node library to promises without breaking callers
原始指令
Library `/work/fsqueue` (Node) exposes 14 callback-style functions. Convert internals to async/await and make every function return a Promise when no callback is passed, while still honoring callbacks (error-first, called exactly once) for backward compatibility.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- Node · mocha
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden tests: both styles for all 14 functions; callbacks invoked exactly once, errors propagate; no unhandled rejections (process flag --unhandled-rejections=strict); legacy suite unchanged and green.
建议部分得分
40% promise API; 40% callback compatibility; 20% no unhandled rejections
R02.01.01.02-T11 Add move semantics and strong exception safety to a C++ container
原始指令
Header-only library `/work/smallvec` (C++20). `SmallVec<T, N>` only supports copy. Add move constructor/assignment, `emplace_back`, and make `push_back` strongly exception-safe for types whose move may throw. Keep ABI-irrelevant API unchanged.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- CMake · clang · Catch2
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Hidden Catch2 tests: move-only types work; moved-from state valid; counting allocator shows no extra copies; throwing-move type leaves container unchanged on exception; ASan/UBSan clean on clang and MSVC builds.
建议部分得分
35% move ops; 20% emplace; 30% exception safety; 15% sanitizers/compilers
R02.01.01.02-T12 Add a filtered CSV export action to a Django admin
原始指令
Project `/work/crm-django`. Add an admin action and a changelist button on `Contact` that exports the currently filtered queryset to CSV with the columns listed in `docs/export_spec.md`, streaming for large sets, respecting the user's `view_contact` permission, and with UTF-8 BOM for Excel.
- 平台
lin· Linux- 应用
- Django · pytest
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden tests: exported rows equal the filtered queryset (search + 2 list filters); column order/headers exact; BOM present; StreamingHttpResponse used; users without permission get 403.
建议部分得分
40% correct rows under filters; 25% columns; 20% permission; 15% streaming+BOM
R02.01.01.02-T13 Split a 3,000-line Python module into a package without breaking imports
原始指令
Repo `/work/billing` has `billing/core.py` (3,000 lines). Split it into a `billing/core/` package with submodules per concern as outlined in `docs/split_plan.md`. Every name importable from `billing.core` today must remain importable, pickled objects must still unpickle, and no circular imports may appear.
- 平台
lin· Linuxmac· macOS- 应用
- pytest · git
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden tests: all 214 previously public names importable from billing.core; fixture pickles load; `python -X importtime` shows no import cycles errors; submodules match plan; suite green.
建议部分得分
40% public names preserved; 20% pickles; 20% structure matches plan; 20% suite
R02.01.01.02-T14 Introduce a feature-flag system with per-tenant overrides
原始指令
Service `/work/saas-core` (TypeScript, NestJS). Add a feature-flag module: flags defined in `flags.yaml` with defaults, per-tenant overrides stored in Postgres, a `@Flag('name')` guard for routes, and an admin endpoint to toggle overrides. Gate the existing `/reports/v2` route behind `reports_v2`.
- 平台
lin· Linux- 应用
- NestJS · Jest · Postgres
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden tests: default off returns 404 for /reports/v2; tenant override on returns 200 for that tenant only; admin endpoint requires admin role; override persists across restart; existing tests green.
建议部分得分
30% flag definitions; 30% per-tenant override; 25% guard on route; 15% admin endpoint
R02.01.01.02-T15 Implement undo/redo in a text editor's document model
原始指令
Package `/work/textcore` (TypeScript) has a `Document` model with insert/delete/replace operations but no history. Implement undo/redo with operation coalescing (consecutive typing within 500 ms merges), selection restoration, and a max history of 1,000 entries, without changing existing operation semantics.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- Node · vitest
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Hidden property tests (fast-check): any operation sequence followed by full undo returns the initial doc; redo restores; coalescing rules exact; selection after undo equals pre-op selection; history bound enforced.
建议部分得分
40% undo/redo correctness; 25% coalescing; 20% selection; 15% bound
R02.01.01.02-T16 Add OpenTelemetry tracing across an HTTP service and its worker
原始指令
Repo `/work/orders` (Python): a Flask API enqueues jobs to an RQ worker. Add OpenTelemetry tracing so one trace spans the HTTP request, the enqueue and the worker job (context propagated through job metadata), with span names and attributes from `docs/tracing.md`, exported via OTLP.
- 平台
lin· Linux- 应用
- OpenTelemetry · Flask · RQ
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 3 / 5
建议验证方式
Hidden compose test with an OTLP collector: a POST /orders produces one trace id across api and worker spans; parent-child links correct; required attributes present; no spans when OTEL_SDK_DISABLED=true.
建议部分得分
30% API spans; 40% propagation to worker; 20% attributes; 10% disable switch
R02.01.01.02-T17 Remove global singletons so a service becomes testable in parallel
原始指令
Repo `/work/inventory` (Python) uses module-level singletons for DB, cache and config, so tests cannot run in parallel. Refactor to explicit dependency injection via an `AppContext` passed through constructors/factories, keeping the CLI and HTTP entry points' behavior identical.
- 平台
lin· Linux- 应用
- pytest · pytest-xdist
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 5 / 5
建议验证方式
Hidden checks: `pytest -n 8` passes 3 consecutive runs; AST check finds no module-level instances of the 3 singletons; CLI golden outputs and HTTP contract tests unchanged.
建议部分得分
35% parallel suite passes; 30% singletons removed; 35% behavior unchanged
R02.01.01.02-T18 Add an entry-point plugin system to a static site generator
原始指令
Project `/work/pagesmith` (Python). Add a plugin system: plugins discovered via the `pagesmith.plugins` entry-point group, with hooks `on_config`, `on_page_markdown`, `on_post_build` in that order, plugin ordering from config, and errors reported with the plugin name. Port the built-in `toc` feature to a plugin.
- 平台
lin· Linuxmac· macOS- 应用
- pip · pytest
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
- 未声明
- 提案难度
- 4 / 5
建议验证方式
Hidden tests install two sample plugin packages and check hook order, config-driven ordering and error messages; toc output identical to before; site build golden files unchanged.
建议部分得分
40% discovery + hooks; 20% ordering; 15% error reporting; 25% toc ported identically
R02.01.01.02-T19 Add offline editing with sync conflict resolution to a TypeScript notes app
原始指令
App `/work/notes-pwa` (TypeScript, IndexedDB client, Node server). Add offline support: edits queue locally while offline and sync on reconnect; concurrent edits to the same note merge per-field with last-writer-wins by Lamport clock, and true conflicts on the body create a conflict copy, as specified in `docs/sync.md`.
- 平台
lin· Linuxmac· macOSwin· Windows- 应用
- Node · Playwright · vitest
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
long· 长流程- 提案难度
- 5 / 5
建议验证方式
Hidden multi-client simulation (3 clients, random offline windows, 2,000 ops, 20 seeds): all replicas converge; per-field LWW and conflict copies match spec oracle; no lost edits.
建议部分得分
30% offline queue; 30% convergence; 25% merge rules; 15% conflict copies
R02.01.01.02-T20 Rename a core domain concept across code, API and database
原始指令
Monorepo `/work/fleetapp` (Python backend, TS frontend, Postgres). Rename the concept `Customer` to `Account` everywhere: models, DB table and columns (with an Alembic migration that preserves data), API routes (old routes 308-redirect), TS types and UI strings. Keep foreign keys and indexes intact.
- 平台
lin· Linux- 应用
- Alembic · pytest · tsc
- 交互表面
term· 终端- GUI 需求 · 任务设定
CL· CLI 足够- GUI 需求 · 普通权限
CL· CLI 足够- 交互原语
code· 代码与命令- 工作产物
WP06· 代码 / 工程- 条件
long· 长流程- 提案难度
- 5 / 5
建议验证方式
Hidden checks: migration upgrade on a seeded DB keeps all rows and FKs, downgrade restores; old routes redirect; grep finds 'customer' only in migration/allowlist; backend and frontend suites and tsc green.
建议部分得分
30% migration preserves data; 20% API + redirects; 25% code renamed; 25% suites green
已有研究映射
以下沿用研究目录中的基准与小类映射,不是逐题标注、执行记录或产品背书。