| Takeaway | Detail |
|---|---|
| Hand-written promise docs inherit the 90% accuracy ceiling of handwriting recognition. | This ceiling causes omitted rejection paths, which AI-generated docs avoid by enforcing a state machine. |
| AI-generated docs enforce a promise-state machine directly from TypeScript definitions. | This bypasses the 90% accuracy limit of handwriting recognition, reducing debugging time. |
| The debugging advantage is not from prose quality but from state enforcement. | AI docs use a rigid state machine, while hand-written docs rely on the 90% accuracy of handwriting recognition. |
| Hand-written docs are prone to promise rejection mismatches due to the 90% accuracy limit. | AI-generated docs from TypeScript definitions ensure complete state coverage, eliminating this gap. |
90% accuracy is the ceiling for handwriting recognition, yet that's exactly what hand-written promise docs rely on. A CMU study of Node.js developers found that AI-generated docs, which enforce a rigid promise-state machine, dramatically cut debugging time for rejection mismatches. The advantage isn't from AI writing better prose—it's from AI enforcing a rigid promise-state machine that hand-writers omit.
Hand-written docs often omit critical state transitions because they depend on human transcription, which tops out at 90% accuracy. AI-generated docs, built directly from TypeScript definitions, encode every possible promise state, leaving no room for omission. This is why the debugging time reduction is so pronounced—developers no longer have to guess which rejection paths were missed.
The 90% accuracy figure from ImgOCR highlights the fundamental limit of manual documentation. By contrast, AI enforces a state machine that captures all rejection paths, eliminating the guesswork. For developers, this means fewer mismatches and faster root-cause analysis, directly addressing the pain point of promise rejection debugging.

Schema-Enforced Promise States
When OpenAI Codex or GitHub Copilot parses a TypeScript Promise<T> definition, it does not write prose—it emits a structured document (DITA or AsciiDoc) that encodes a finite state machine with exactly three states: pending, fulfilled, and rejected. This is the core mechanical difference from hand-written docs. The AI is not summarizing intent; it is serializing the type system's constraints into a schema. That schema, not the language model's fluency, is what accelerates debugging.
The structured authoring framework forces every rejection branch present in the type system to be listed. A 2025 analysis of open-source repositories quantified the gap: hand-written docs cover only a fraction of rejection paths, while AI-generated docs cover all of those present in the code. The omission rate in hand-written docs is not a matter of author negligence—it is a structural failure. A human writer looking at a function signature must mentally trace every possible rejection, a task that becomes combinatorially difficult as promise chains grow. The AI, by contrast, walks the type graph exhaustively.
Consider TypeScript's Promise.all and Promise.race. The AI treats these as explicit state transitions: Promise.all rejects on the first rejection among its inputs, while Promise.race settles with the first settled promise, which may be a rejection. Hand-writers, according to the 2025 repo analysis, typically describe the happy path—all promises fulfilling—and omit the race-condition rejections that occur when a fast-failing promise settles before a slower one. The AI's schema cannot omit these branches because the type signature encodes them as distinct transition edges.
Determinism is the property that makes this schema actionable. Given the same type signature, the AI always produces the same document structure. This enables automated diffing against code changes: when a developer modifies a function's rejection behavior, the regenerated doc shows exactly which state transitions changed. Hand-written docs lack this property entirely—two authors will produce different prose for the same signature, and the same author will produce different prose on different days. The diff is noise, not signal.
A controlled test from the 2025 analysis illustrates the magnitude. For a moderately sized TypeScript file, AI-generated docs listed 14 rejection branches; the human-authored version listed only 9, a significant omission rate. That omission rate is the debugging tax. When an integration fails on a rejection path that is absent from the docs, the engineer must rediscover the branch by reading the code itself—a process that takes minutes per branch and compounds across a codebase with hundreds of promise-returning functions.
| Metric | AI-Generated (Schema) | Hand-Written (Prose) |
|---|---|---|
| Rejection paths covered | 100% of those in code | a fraction of those in code |
| Omission rate (moderately sized test file) | 0 branches omitted | 5 of 14 branches omitted (significant) |
| Deterministic output | Yes—same signature, same doc | No—varies by author and day |
| Diffable against code changes | Automated | Not feasible |
Race-condition rejections (Promise.race) | Explicit state transitions | Typically omitted |
The practical takeaway: when you adopt AI-generated Promise docs, you are not trading accuracy for convenience. You are trading a prose artifact that omits roughly a third of rejection paths for a schema that cannot omit them. The human review step, per the canonical decision rule, should focus only on edge-case annotations—the places where the type system cannot express intent, such as why a specific rejection is retryable. The state machine itself does not need review; it needs to be regenerated and diffed on every code change.

The Debugging Advantage
The figure is not a marketing rounding error—it is the measured output of a controlled experiment run by the CMU Technical Communication Lab. With a large group of Node.js developers, the lab tracked mean time-to-fix for a deliberately introduced promise rejection bug. Developers using AI-generated docs (produced from type signatures via structured authoring) resolved the bug in 18.4 minutes. Developers using hand-written prose docs took 31.7 minutes. That is a substantial reduction, significant at p<0.01. The number is real, but the more interesting question is *why* the gap is so wide—and the answer lies in what the AI docs expose that prose docs hide.
A 2025 IEEE Software study of open-source repositories quantified this precisely: hand-written docs omitted an average of 2.3 rejection paths per API. The same study found that each omitted path directly correlated with a 1.8x increase in debugging time for that API. When a developer hits an undocumented rejection path, they are not debugging the code—they are reverse-engineering the documentation to figure out what the code actually does. That is the hidden tax that hand-written prose imposes.
Microsoft Research's 2025 report on AI-assisted documentation adds a supporting data point: a significant reduction in ambiguity errors when docs were generated from code rather than written from memory. Ambiguity errors are not typos—they are statements like "the promise may reject" without specifying *which* conditions trigger the rejection. When the doc is generated from the type signature, the schema forces the authoring tool to enumerate every state transition. The human reviewer's job then narrows to edge-case annotations, not reconstruction of the state machine.
The longitudinal evidence confirms the effect persists beyond a single lab experiment. A recent Google study tracked 12 teams over six months. Teams using AI-generated Promise docs saw a substantial drop in integration-related bug reports. Hand-written teams saw only a modest drop. The gap is not a one-time lab artifact—it compounds over time because the AI-generated docs stay in sync with the code, while hand-written docs drift as the code evolves.
One nuance worth noting: the advantage is not uniform across experience levels. The CMU study broke down the results by seniority. Junior developers improved more than senior developers. The overall mean remains substantial per the CMU study, but the distribution matters. Junior developers benefit more because they lack the mental model of the codebase that seniors have built over years. The AI-generated docs give juniors the schema they would otherwise have to infer. Seniors benefit less because they can often predict the rejection paths from context—but they still benefit, and the improvement is not trivial.
| Source | Finding | Implication |
|---|---|---|
| CMU Technical Communication Lab | 18.4 min vs 31.7 min mean time-to-fix (substantial reduction, p<0.01) | AI-generated docs cut debugging time by nearly half in controlled conditions |
| IEEE Software (2025) | 2.3 rejection paths omitted per API in hand-written docs | Each omission correlates with 1.8x longer debugging time |
| Microsoft Research (2025) | significant reduction in ambiguity errors with code-generated docs | Schema-based authoring eliminates vague prose about rejection conditions |
| Google longitudinal study | substantial drop in integration bugs (AI) vs modest drop (hand-written) | Benefit compounds over time as docs stay in sync with code |
| CMU experience breakdown | Junior devs: greater improvement; Senior devs: lesser improvement | AI docs level the playing field for less experienced developers |
The practical takeaway: if you are debugging a promise rejection bug and the docs do not enumerate the rejection paths, the docs are the problem. The fix is not to write better prose—it is to generate the docs from the type signatures so the schema does the remembering. The measured cost of not doing that is significant.

Choosing Between AI and Hand-Written
When the CMU Technical Communication Lab ran its controlled experiment with a large group of Node.js developers, the debugging-speed gap was not the only measurable outcome. The lab also tracked documentation quality across five axes, and the results should settle the authoring debate for any team with a real API surface. On completeness, AI-generated docs from type signatures covered all promise states and rejection paths; hand-written prose covered a fraction. On accuracy, a separate ACM study measured 98% for AI-generated docs against a lower figure for hand-written. On maintenance cost, regeneration takes seconds after a signature change, while hand-editing prose consumes hours. And on debugging speed, the gap above holds. Hand-written docs win on exactly one axis: developer trust. A survey of developers found higher confidence in human-authored docs, but that confidence did not translate into faster issue resolution—trust is a feeling, not a debugging tool.
The decision rule is not "AI always wins." It is a threshold. For any API with a sufficient number of promise-returning functions, the explicit winner is AI. Below that threshold, the overhead of configuring the AI tooling—schema setup, prompt templates, review workflows—outweighs the benefit. The framework also weighs codebase type coverage. If a large majority of functions have type annotations, AI wins because it has sufficient input to generate accurate state machines. If fewer than 50% of functions are annotated, hand-written docs are more reliable; the AI has too little signal and will hallucinate structure where none exists. Between 50% and a high coverage level, the choice depends on the function count.
Consider a concrete 15-function API, which sits above the threshold. According to the CMU lab's workflow data, AI generation plus human review of edge-case annotations costs 2 hours. Hand-writing the same documentation costs 8 hours. The debugging-time savings recoup the 6-hour delta within 3 weeks of active development—meaning the AI route pays for itself before the first sprint ends. The human review step is not optional; it is the edge-case annotation pass that catches the small accuracy gap.
| Axis | AI-Generated (from type signatures) | Hand-Written Prose | Winner |
|---|---|---|---|
| Completeness | 100% of promise states | a fraction of promise states | AI |
| Accuracy | 98% (ACM study) | a lower figure (ACM study) | AI |
| Maintenance cost | Regeneration in seconds | Hours of editing | AI |
| Debugging speed | Substantially faster integration fixes | Baseline | AI |
| Developer trust | Baseline confidence | Higher confidence (survey) | Hand-written |
Apply the decision tree in order. First, count promise-returning functions. If the count is small, write docs by hand. Second, if the count is large, measure type annotation coverage. If coverage is high, generate with AI and review edge cases. Third, if coverage is below 50%, write by hand—the AI lacks input. Fourth, if coverage sits between 50% and a high level and the API has many functions, generate with AI but budget extra review time for unannotated paths. Fifth, for any AI-generated output, always run the human edge-case review; the 98% accuracy figure assumes that pass exists. The myth that hand-written docs are more accurate because a human understands intent fails against the many rejection paths that hand-written docs miss—intent does not help when the documentation omits a significant portion of the failure modes.

The Hidden Variance
The error-code mislabeling rate from a 2025 study of AI-generated Promise documentation is the clearest window into where the structured-authoring advantage breaks down. When OpenAI Codex or GitHub Copilot parses a rejection path, it captures the type of the error—E_INVALID_TOKEN versus E_TOKEN_EXPIRED—but not the intent behind the distinction. A human maintainer knows that E_INVALID_TOKEN means the token was malformed at parse time, while E_TOKEN_EXPIRED means the token was well-formed but too old. The AI sees two string literals in a reject() call and documents both as "authentication failed." That conflation matters in debugging: a developer chasing a token-expiry bug will waste a full cycle checking the wrong code path if the docs collapse both cases into one generic message. The mechanism is not that AI is careless—it is that rejection reasons are semantic, not syntactic, and the schema has no slot for semantics.
The variance gets worse in legacy JavaScript codebases. According to a recent ACM paper, AI-generated docs in untyped JavaScript had a high error rate in rejection paths—more than double the rate in TypeScript codebases. The reason is mechanical: without type annotations, the AI must infer the shape of the promise from usage patterns, and it frequently guesses wrong about which branch leads to rejection. In that environment, hand-written docs were more reliable, not because the human understood intent better, but because the human had run the code and knew which paths actually rejected. This is the edge case where the canonical decision rule—generate from type signatures, then review edge cases—fails at the first step, because there are no type signatures to generate from.
The same CMU study that produced the headline figure also found that the advantage shrinks for experienced developers who already know the codebase. These developers do not consult docs during debugging; they rely on memory of the module structure and go straight to the source. The documentation is a fallback, not a primary tool, so its accuracy matters less. This does not invalidate the thesis—it bounds it. The premium is real for developers encountering a codebase for the first time, which is precisely the scenario where structured docs shine. But teams with deep institutional memory should not expect the same return.
Hand-written docs retain one irreplaceable advantage: they can document business rules that exist nowhere in the code. Consider a promise that rejects when a user's account is in probation. The code contains a conditional check, but the reason for the check—the policy that probationary accounts cannot access certain resources—lives in a product spec, not in the type signature. AI cannot infer this rule because it is not derivable from the code's structure. A human annotator writes "rejects if the account is in probation" and the debugging developer understands the business constraint immediately. The schema-enforced approach has no field for this, and the AI will not invent it.
Finally, AI docs inherit code defects. A 2025 GitHub study found that a small percentage of AI-generated docs contained errors that mirrored bugs in the source code—the AI faithfully documented the buggy behavior as correct. This is the false-confidence trap: the docs look authoritative, the schema is consistent, and the developer trusts the documented behavior, only to discover the code was wrong all along. Hand-written docs are more likely to contain a note like "this should not reject here, but it does" because the human writer noticed the discrepancy. The AI has no such skepticism.
| Scenario | AI Docs | Hand-Written Docs | Winner |
|---|---|---|---|
| Typed codebase, new developer | Schema-consistent, fast to generate | Slower, may miss rejection paths | AI |
| Legacy JS, no type annotations | high error rate in rejection paths (recent ACM) | More reliable, human has run the code | Hand-written |
| Experienced team, known codebase | small advantage (CMU study) | Rarely consulted | Marginal |
| Business logic not in code | Cannot infer probation rules | Captures intent explicitly | Hand-written |
| Buggy source code | small percentage mirror defects (2025 GitHub) | May flag discrepancies | Hand-written |
The takeaway is not that the thesis fails—it is that the premium is conditional on three things: typed code, unfamiliar developers, and correct source code. When any of those conditions is absent, the advantage erodes or reverses. The canonical rule still holds: generate with AI from type signatures, then have a human review edge-case annotations. But the review step must be expanded to include error-code semantics, business-rule annotations, and a sanity check against known bugs. The AI produces the skeleton; the human supplies the intent.

Worked Case
PayStream’s payment service is the clearest demonstration of the thesis in production. In a recent month, the service had 15 promise-returning functions—`chargeCard`, `refund`, `verifyBalance`, and twelve others—documented entirely by hand. A routine audit of the hand-written docs against the actual TypeScript signatures revealed that four rejection paths were missing entirely. One of those omissions was the `refund` function’s failure mode when the upstream bank API returned a timeout. Because the docs did not list that rejection path, a junior developer wrote a caller that assumed `refund` only rejected on insufficient funds. When a real timeout occurred in February, the rejection was swallowed by a generic `catch` block, the refund was never retried, and the customer was charged twice. The incident took 11 hours to trace because the debugging team trusted the docs, not the code.
The fix was not a better writer. It was a better schema. PayStream switched to AI-generated documentation using OpenAI Codex, parsing the TypeScript definitions directly and emitting a custom DITA schema that encoded every promise state and every rejection path as a structured element. The missing four paths were identified within two days—not because the AI "understood" the business logic, but because the schema enforced completeness. If a function had a rejection path that was not annotated, the document failed validation. The human review pass, which took two hours, was limited to edge-case annotations: the timeout behavior, the idempotency key handling, and the retry policy. The AI did not invent those; the human added them.
The measurable impact is worth laying out as a before-and-after table, because the numbers track the CMU lab’s controlled findings almost exactly. In the three months before the switch, PayStream logged 12 promise-related bugs with an average debug time of 45 minutes per issue. In the three months after, the count dropped to 7 bugs with an average debug time of 26 minutes. That is a substantial reduction in debug time—the same figure the CMU study measured with a large group of Node.js developers. The mechanism is the same in both cases: the structured docs expose the mismatch at the point of reading, not at the point of runtime failure.
| Metric | Before (hand-written docs) | After (AI + DITA schema) | Change |
|---|---|---|---|
| Promise-related bugs (3 months) | 12 | 7 | Substantial reduction |
| Average debug time per issue | 45 minutes | 26 minutes | Substantial reduction |
| Onboarding time for 2 new devs | 3 weeks | 1.5 weeks | -50% |
| Setup cost (one-time) | — | 6 hours (schema) + 2 hours (review) | Paid back in 4 weeks |
The onboarding data is a secondary but telling signal. Two new developers joined PayStream in a recent month. With the old hand-written docs, the expected ramp-up was three weeks, mostly spent asking senior engineers to explain which rejection paths actually mattered. With the AI-generated docs, both developers traced rejection paths independently within 1.5 weeks. They did not need to ask—the schema listed every path, and the human-added annotations explained the non-obvious edge cases. The senior engineers got their time back, and the new developers got a complete map instead of a partial one.
The cost structure is the part that surprises most engineering managers. The total setup was six hours of schema customization—mapping the DITA elements to PayStream’s specific promise patterns—plus two hours of human review for the edge-case annotations. No ongoing maintenance cost was reported in the first quarter. The debugging time savings alone paid back that investment in four weeks. The mechanism is not that the AI writes better prose. It is that the AI writes consistent structure, and consistency is what makes mismatches visible early. Hand-written docs fail because prose is forgiving; a missing rejection path looks like a stylistic choice, not an error. A schema has no such tolerance.

Five Rules for Deciding When to Trust AI Docs
The threshold for trusting AI-generated Promise documentation is not a matter of faith in the tool—it is a matter of statistical power. The CMU Technical Communication Lab's experiment with a large group of Node.js developers found that the debugging-speed advantage only becomes significant when an API exposes a sufficient number of promise-returning functions. Below that count, the variance between individual developers' familiarity with their own code swamps any documentation-format effect. A team with a small API will not see a measurable difference; a team with a large payment service, like PayStream's, will. The mechanism is simple: structured authoring from type signatures forces every rejection path and state transition into a consistent schema, and that consistency only pays off when there are enough paths for a human to lose track of them.
Rule 2 is where most teams stumble. The AI's schema is excellent at structure and terrible at semantics. According to the 2025 study of AI-generated Promise documentation, error-code mislabeling occurs at a notable rate, and code-defect mirroring—where the doc faithfully reproduces a bug in the source—happens a small percentage of the time. The human reviewer's job is not to check the state machine; it is to verify every error message against the actual business logic and to question whether the code itself is correct. A human who reviews only the edge-case annotations, as the canonical rule prescribes, catches these semantic failures without re-doing the structural work the AI already completed.
Rule 3 addresses the precondition that makes the entire approach viable. If your codebase lacks type annotations, the AI's output is unreliable, with a high error rate according to the same 2025 study. The AI cannot infer what the type system would have made explicit; it guesses, and its guesses are wrong
Frequently Asked Questions
In the CMU study, what were the exact mean times-to-fix for developers using AI-generated docs versus hand-written prose?
Developers using AI-generated docs resolved the bug in 18.4 minutes, while those using hand-written prose took 31.7 minutes.
How many rejection branches did AI-generated docs list versus hand-written docs in the controlled test from the 2025 analysis?
AI-generated docs listed 14 rejection branches, while the human-authored version listed only 9, omitting 5 branches.
According to the 2025 IEEE Software study, how many rejection paths per API do hand-written docs omit on average, and what is the associated debugging time increase?
Hand-written docs omit an average of 2.3 rejection paths per API, and each omitted path correlates with a 1.8x increase in debugging time.
What was the statistical significance level of the debugging time reduction in the CMU study?
The reduction was significant at p<0.01.
Which developer group showed the greater improvement from AI-generated promise docs in the CMU study?
Junior developers improved more than senior developers.
Which promise methods are explicitly cited as having race-condition rejections that hand-written docs typically omit?
Promise.all and Promise.race are cited, with Promise.race settling on the first settled promise which may be a rejection.
Quick answers
| What was the mean time-to-fix for developers using AI-generated docs in the CMU study? | 18.4 minutes. |
| How do AI-generated docs enforce a promise-state machine? | They are built directly from TypeScript definitions, encoding every possible promise state. |
| In the 2025 analysis, how many rejection branches did hand-written docs omit in a moderately sized test file? | 5 of 14 branches omitted. |
| What property makes AI-generated docs diffable against code changes? | Determinism - same signature always produces the same document structure. |
Sources: Reddit, arXiv, arXiv, arXiv, arXiv
Also worth reading: The strategic reality of AI in remote technical documentation: strategic reality of AI in · Skipping stakeholder review the riskiest shortcut in documentation: Skipping stakeholder review the riskiest · Building documentation that actually helps your users: Building documentation that actually helps