AI-Assisted Development for Long-Horizon Coding Tasks: Practices and Acceptance Criteria
Evaluating AI-assisted coding on short, self-contained benchmarks misses what matters in real engineering: reading legacy context, keeping changes consistent across modules, and driving tasks to a verifiable state. This article breaks long-horizon coding tasks into four capability dimensions, presents two evaluation scenarios covering security-sensitive feature extension and from-scratch product delivery, and provides negative-path test examples, a manual acceptance checklist, and practical guidance for teams adopting AI-assisted development.
1. Why Evaluation Methods Need Redefining
Public leaderboards typically score models on fixed problems that are short, fully self-contained, and aimed at a single goal. Real engineering work looks nothing like this: codebases carry years of accumulated conventions, requirements span databases, APIs, task queues, frontends, and rendering components, and many constraints live in documentation or historical code without ever being stated explicitly.
When evaluating AI-assisted programming, three questions matter:
- Can the model correctly read and understand existing context, including directory structure, naming conventions, and dependencies between modules?
- Can the model keep changes consistent across multiple modules instead of fixing only one place?
- Can the model push a task to a runnable, testable state, and locate and fix problems when something breaks midway?
Single-shot answer accuracy alone cannot answer these questions.
2. Four Capability Dimensions of Long-Horizon Tasks
Breaking long-horizon tasks down reveals four dimensions.
Context understanding: The model needs to grasp how legacy code is layered and determine which functions already encapsulate authentication or validation logic, avoiding duplicate implementations or bypassing existing mechanisms.
Cross-module consistency: A single feature extension usually touches API contracts, data models, state machines, asynchronous tasks, and frontend components. Any mismatch in field names or state values across layers will surface at runtime.
Closed-loop verification: The model should proactively run compilation, unit tests, and integration tests, then modify code based on failure output. For UI-related tasks, it should also verify actual results through browser automation or screenshots.
State recovery: Long tasks are often interrupted by missing dependencies, incomplete environment variables, or timeouts. A good execution process records progress and resumes from the latest checkpoint rather than starting over.
3. Designing Test Scenarios
A single scenario cannot cover all four dimensions. We recommend at least two scenario types, testing the ability to “read an old system” and the ability to “deliver from scratch.”
Scenario A: Extending Security Features in a Legacy Project
Consider a task where users upload image assets and reference them in HTML animation scenes. The requirement looks simple but actually crosses several security boundaries:
- A file type whitelist that validates file headers, not just extensions.
- File size limits to prevent disk exhaustion or resource exhaustion during parsing.
- Server-side filename regeneration—never trust client-provided filenames.
- Path traversal protection ensuring the final write path stays within the designated storage directory.
- Authenticated asset access, so files cannot be read by guessing IDs.
- Treating HTML animation content as untrusted input, rendered in a sandboxed container with a Content Security Policy.
The following example of asset-saving logic shows the basic approach to path validation and filename handling:
from pathlib import Pathimport uuidALLOWED_EXTS = {".png", ".jpg", ".jpeg", ".webp"}MAX_SIZE = 10 * 1024 * 1024 # 10 MB, example value; adjust per business needsUPLOAD_ROOT = Path("/srv/app/storage/assets").resolve()def save_asset(owner_id: str, original_name: str, data: bytes) -> str:ext = Path(original_name).suffix.lower()if ext not in ALLOWED_EXTS:raise ValueError("unsupported file type")if len(data) > MAX_SIZE:raise ValueError("file too large")# Filename is generated server-side; the client name is only used to determine the extensionasset_id = uuid.uuid4().hextarget = (UPLOAD_ROOT / owner_id / f"{asset_id}{ext}").resolve()if UPLOAD_ROOT not in target.parents:raise ValueError("invalid path")target.parent.mkdir(parents=True, exist_ok=True)target.write_bytes(data)return asset_id
This code still has gaps: it does not check file headers and does not handle concurrent writes. During evaluation, watch whether the model recognizes these gaps and addresses them in the implementation, or explicitly documents what remains uncovered in its summary.
Scenario B: From Reference Material and a PRD to a Playable Product
The second task type provides learning materials and a product requirements document, asking the model to build a fully completable learning application from scratch. Evaluation focuses on:
- Knowledge coverage: Do the core concepts from the materials all appear in levels or questions?
- Level reachability: Can every level’s completion condition actually be achieved in the UI, with no dead ends?
- State persistence: Is progress correctly saved after a page refresh or re-login?
- Completion-path regression: Can a script simulate a full playthrough to verify the flow still works after every change?
This type of task better reflects how deeply the model understands requirements. A project that compiles does not necessarily support a complete learning journey.
4. Passing Tests Does Not Mean Ready to Ship
Automated tests usually cover positive paths—a successful upload, a successful query, a successful playthrough. Permission problems, however, tend to hide in negative paths, such as whether User A can read User B’s assets.
Permission-related features therefore need dedicated negative tests, verified item by item during manual acceptance:
class NotFound(Exception):passdef get_asset_for_user(user_id: str, asset_id: str, db):asset = db.assets.find_one(id=asset_id)# Return NotFound for both missing resources and unauthorized access,# avoiding leaking whether the resource existsif asset is None or asset.owner_id != user_id:raise NotFound()return asset
A manual acceptance checklist might include:
- Upload an asset with one account, then access its URL directly with another account, and confirm the response is a denial or “not found.”
- Upload a non-image file disguised as an image and confirm the server rejects it.
- Inject a script into the HTML animation and confirm the sandbox blocks it from accessing parent page data.
- Compare database migration scripts before and after the change to confirm no existing data was deleted or overwritten.
- Review the complete code diff, not just the final running result.
Item 5 is especially important. A model may modify the tests themselves to make them pass, or leave debugging code in unrelated files.
5. Recommendations for Team Adoption
When bringing AI-assisted programming into real projects, the following practices help:
- Split tasks and set checkpoints: Commit to a separate branch at the end of each stage, with test results attached, so rollbacks are easy.
- Least privilege: Give the execution environment read-only or restricted credentials. Production secrets never enter the conversation context and are never written into code or logs.
- Trial runs in isolated environments first: Validate new capabilities on non-production data and confirm security boundaries before gradually opening access.
- Define clear human responsibility points: Permission changes, data migrations, and public-facing APIs must receive final review from an owner.
- Record evaluation data: Save each task’s inputs, diffs, and failure causes to gradually build your team’s own evaluation benchmark.
AI-assisted programming can already handle substantial development tasks, but the standard for evaluating it should come from engineering goals themselves: the ability to deliver correct, maintainable, and secure results under real constraints.
