Evaluating AI Coding on Long Tasks: Capability Assessment and Security Acceptance
Evaluating AI coding systems by isolated code generation is not enough. This article explains how to assess long-running engineering work through implementation correctness, engineering completeness, security constraints, and verifiable delivery, using two contrasting tasks and a layered acceptance process.
1. Evaluate AI coding by the engineering loop, not code generation alone
AI coding ability should not be judged only by whether a single function is correct, or by treating a test pass rate as delivery quality. Real software work includes understanding requirements, locating code, coordinating modules, enforcing data constraints, handling failures, and completing acceptance. A gap in any of these steps can turn a feature that “runs” into a production risk.
Long tasks expose these differences especially clearly. After work continues across several stages, does the system still remember the original security requirements? After an interface changes, are callers updated as well? After a new data structure is introduced, is historical data compatibility handled? When a failure appears, is the root cause fixed, or is a test weakened so the run can pass? These questions are closer to real engineering ability than isolated code snippets.
A more useful evaluation framework has four layers:
- Implementation correctness: Does the feature match the requirements, and are critical branches fully handled?
- Engineering completeness: Do code, data, configuration, tests, and run instructions form a closed loop?
- Security constraint satisfaction: Are permission boundaries, input validation, and resource isolation actually enforced?
- Result verifiability: Can the deliverable be independently reproduced, inspected, and accepted?
These layers cannot replace one another. A page that opens does not mean the workflow is complete. Tests that all pass do not mean the permission design is correct. For features that touch user data or resource access, security cannot be offset by other strengths through an average score.
2. Use two task types to cover different engineering challenges
A useful evaluation should choose tasks that differ clearly and have explicit acceptance criteria, rather than repeating the same code-generation exercise.
2.1 Changing an existing project: understanding and preserving constraints
The first task adds “user image asset import and web animation scene references” to an existing system.
It may look like uploading a file, saving a record, and displaying an image. In practice it crosses several boundaries: user identity, business workspace, file storage, asset management, scene editing, and resource access. An older project may also have outdated interfaces, implicit permission rules, duplicated business logic, and modules with little test coverage.
The coding system must understand those boundaries before deciding where to change the code. Adding a standalone upload endpoint that does not reuse existing identity checks and workspace rules may be easy to get running, but it can bypass the system’s existing security model.
The evaluation focus is not how much code was added. It is whether the right extension points were found, whether old behavior stayed compatible, and whether permission rules cover the asset’s full lifecycle.
2.2 Building a learning game from scratch: turning source material into a product loop
The second task uses agent learning materials and a product requirements document to build a knowledge-learning game that can be completed from start to finish.
There is no legacy system to carry, but scattered material must become an executable product. The system must present knowledge and also design levels, interaction, feedback, progress, and end conditions, while keeping learning goals consistent with the game rules.
Evaluation should ask whether the system:
- Extracts an accurate knowledge structure from the source material.
- Maps learning goals to playable levels.
- Forms a complete path from start to finish.
- Handles wrong answers, repeated actions, and quitting midway.
- Helps the user understand why an answer failed, rather than showing only an error message.
The two tasks complement each other. The first tests incremental change under complex constraints. The second tests completeness from requirements to a working product. Success on one does not imply that the other class of engineering problem is solved.
3. The core difficulty of long tasks is keeping engineering state consistent
A long task is not solved merely by splitting a large requirement into many small prompts. The hard part is keeping each change consistent with earlier decisions.
For example, if assets must belong to the current business workspace, a later scene-reference feature cannot only check that an asset exists. If progress must be saved, a later reset action must also clear persisted state, not only what is shown on the page.
To reduce constraint drift, the task should start with a short engineering contract that at least records:
- The goal and what is explicitly out of scope.
- Key modules and call relationships.
- Business and security conditions that must always hold.
- Data structures and state-change rules.
- Acceptance criteria and shortcuts that are not allowed.
As work proceeds, also track what is done, what remains open, and what evidence has been collected. That prevents “a file was changed” from being mistaken for “the requirement is done.”
Long tasks should also be delivered in stages: analyze the code before proposing a design; implement a minimal closed loop before filling exception paths; then run regression and acceptance. Keeping reversible change points between stages is easier to review than generating a large amount of code at once, and it makes problems easier to locate.
4. Image asset import: security must cover the resource lifecycle
4.1 Do not trust the file extension alone
A client-supplied file name, extension, and content type are not trustworthy by themselves. The server should validate actual file content and limit allowed formats, file size, image dimensions, and resource use after decoding.
Formats that can carry scripts or external references need an explicit policy: reject them, do not accept them as ordinary images, or convert them to a restricted format through a verified processing path. Ordinary images still need handling for malformed files, abnormal dimensions, and decode failures.
The object identifier after upload must be generated by the server. The original file name must not be concatenated directly into a storage path. It may be kept as display information, but it must not decide where the file is written or stored.
4.2 Resource ownership must be decided on the server
An asset record typically needs a resource identifier, owning business workspace, creator, storage location, processing status, and creation time. Field design can vary, but the ownership relationship cannot be missing.
The client may request an operation, but it cannot decide which business workspace it owns. The server must use trusted identity information to confirm that the current user has the required permission on the target workspace before creating the resource record.
Creator and owner are not always the same concept. A team asset may be uploaded by one member but belong to the team. The permission model should reflect the business relationship, not generalize “the uploader can access it” into the full access rule.
4.3 A scene reference is a separate authorization action
Being allowed to view an image does not mean being allowed to add it to any scene. A reference should verify all of the following:
- The user can edit the target scene.
- The user is allowed to use the target asset.
- The scene and asset satisfy ownership or sharing rules.
- The asset has finished processing and is still valid.
The following pseudocode only illustrates the check order:
function attach_asset(actor, scene_id, asset_id):scene = load_scene(scene_id)asset = load_asset(asset_id)require(can_edit(actor, scene))require(can_use(actor, asset))require(reference_scope_allowed(scene, asset))require(asset.is_ready)save_reference(scene, asset)
What matters is the relationship among subject, action, object, and context, not merely whether a resource identifier exists. Hard-to-guess identifiers reduce enumeration risk, but they do not replace authorization.
4.4 Metadata permissions and file access permissions must match
Even if the asset query API checks permissions, the resource can still leak if the original file is reachable through a long-lived public URL.
Private assets should use an access mechanism consistent with business permissions, such as reading only after authorization or issuing a short-lived access credential. That credential also needs limits on lifetime, purpose, and log exposure. It must not be treated as a permanent permission.
Deletion needs a closed loop as well. Removing a database record, cleaning up the file, handling scene references, and updating caches can fail in different windows. The system should define retry, compensation, or delayed cleanup so it does not leave broken references and unmanaged files.
5. A learning game that can be finished is not automatically educational
5.1 Set learning goals before designing interaction
Knowledge material should not be split directly into random questions. A better approach is to organize concept relationships first—such as goal understanding, task planning, tool use, execution feedback, and result checking—and then set a clear learning goal for each point.
Basic levels can ask the user to recognize a concept. Advanced levels can ask the user to judge a failure cause from an execution record. A comprehensive level can ask the user to choose the next action and explain why the task should not be declared complete immediately.
The game mechanics then serve learning, rather than using animation and scores to hide shallow content.
5.2 Model the level flow as explicit state transitions
The game should distinguish states such as not started, in progress, waiting for feedback, and completed, and it should define which actions each state allows. Showing or hiding buttons is not enough to control the flow. Refreshing the page, clicking repeatedly, or opening an internal page directly can bypass interface limits.
If scores or progress have business value, critical rules should be checked on the server. If the game is only a local practice exercise, the saved-data scope and what the user can change should be stated clearly.
5.3 Accept the full user journey
“Can be completed” needs a set of repeatable paths, not one successful click-through under normal conditions.
At a minimum, cover first entry, a correct answer, a wrong answer, use of hints, consecutive actions, quitting midway, restoring progress, starting over, and final completion. If there are asynchronous requests, also check loading state, request failure, and duplicate submission.
Learning feedback should be part of acceptance. A wrong answer should explain the misunderstanding. A correct answer should explain the key basis. After all levels, the user should see a learning summary, not only an end screen.
6. Why all-green tests can still hide serious permission bugs
Automated tests only verify conditions that were written into the tests. If coverage is limited to “a normal user accesses their own assets,” a fully green suite still does not prove that the user cannot access resources in another business workspace.
Common sources of permission gaps include:
- Test accounts always have high privileges, with no low-privilege role.
- Tests run only from the page entry and never call the server API directly.
- A mock layer authorizes every request by default, so the real permission check never runs.
- Asset ownership is checked, but scene-edit permission is missed.
- The resource query API is checked, but the file download entry is missed.
- Expected results for different roles were never defined in advance.
Build an authorization test matrix with three dimensions: subject identity, resource ownership, and operation type. For example, verify upload, query, reference, download, and delete for a same-workspace member, a read-only member, a member of another workspace, and an unauthenticated subject.
High-risk operations also need negative tests. Do not only prove that a legitimate request succeeds. Actively prove that an unauthorized request fails and produces no side effects. For a permission denial, check the response and also confirm that the resource, reference relationships, and stored object were not changed unexpectedly.
7. Use layered acceptance instead of one universal score
Engineering acceptance can be split into four layers.
Layer 1 is static review. Inspect new entry points, permission checks, data query scope, sensitive information in logs, and error handling. Pay particular attention to whether cross-module changes stay consistent.
Layer 2 is automated verification. Use unit tests for local rules, integration tests for module collaboration, and end-to-end tests for the full user flow. They have different responsibilities and cannot replace one another.
Layer 3 is manual adversarial checking. Use accounts with different permissions and try replacing resource identifiers, referencing assets across workspaces, bypassing the page entry, and submitting repeatedly. The value of manual checking is to challenge existing assumptions, not to repeat the happy path.
Layer 4 is operational readiness. Confirm that configuration, data changes, logs, alerts, and a rollback plan are in place. For an existing project, also verify that old data and old interfaces do not break because of the new feature.
Each layer should keep evidence, such as test results, reproduction steps, review notes, and known limitations. “Done” without evidence is a status description, not an acceptance conclusion.
8. A practical human–system split: let the system advance the work, and let people hold the boundary
AI coding is well suited to locating code, drafting a design, editing across files, adding tests, and summarizing issues. Permission models, data boundaries, risk acceptance, and the final delivery decision should be confirmed by people who own the business and security responsibility.
That does not mean a person must replace the system line by line. It means human attention should concentrate on high-risk decisions: how resource ownership is defined, which operations may be shared, how failures are compensated, and which defects must block release.
The steadier way to use these systems is small changes, continuous verification, and staged review. When a defect is found, fix it and add a test that can reproduce it. Do not delete assertions or shrink the requirement to obtain a passing result.
The final measure of AI coding is whether it reduces the work between a requirement and a trustworthy delivery, not how autonomous it appears. Sustained progress on long tasks shows that the engineering assistance is useful. Accepting review, exposing limits explicitly, and finishing delivery inside security boundaries is what makes that capability part of a controllable production process.
