Skip to content

Latest commit

 

History

History
231 lines (155 loc) · 8.97 KB

API_V2_REPORT.md

File metadata and controls

231 lines (155 loc) · 8.97 KB

API V2 IXP Compatibility Report

Date: 2026-07-16

Executive Summary

LoopDoc does not fully support UiPath API V2 IXP output.

The current adapter supports direct extraction results, the synchronous V2 extractionResult wrapper, scalar fields, token coordinates, and classic Document Understanding tables. It does not support the asynchronous V2 polling envelope or native IXP field-group data stored under ResultsValue.components.

Field-group-heavy IXP models should not be considered safe to review and submit because nested fields are not exposed in canonical state and repeated values can be discarded during output generation.

Supported Input Shapes

The adapter currently recognizes:

{
  "documentId": "...",
  "resultsDocument": {}
}
{
  "DocumentId": "...",
  "ResultsDocument": {}
}
{
  "extractionResult": {
    "resultsDocument": {}
  }
}

The PascalCase ExtractionResult wrapper is also recognized. PascalCase extraction results are recursively converted to camelCase.

References:

  • src/lib/adapters/uipath/sdkNormalize.ts:35-86
  • src/lib/adapters/uipath/index.ts:260-278

Findings

Critical: Asynchronous API V2 responses are rejected

The installed UiPath SDK defines the asynchronous polling result as:

{
  "status": "Succeeded",
  "result": {
    "extractionResult": {
      "resultsDocument": {}
    }
  }
}

sdkExtractionResultFromRaw only descends through extractionResult or ExtractionResult. It does not descend through result or Result.

Consequences:

  • Registry detection returns unknown for an async V2 response.
  • Artifact ingestion reports that the artifact does not contain a UiPath extraction result.

References:

  • src/lib/adapters/uipath/sdkNormalize.ts:72-86
  • src/lib/adapters/registry.ts:28-44
  • src/lib/uipath/validationArtifacts.ts:317-324
  • node_modules/@uipath/uipath-typescript/dist/document-understanding/index.d.ts:783-793

Critical: Native IXP field-group components are not normalized

The V2 SDK represents nested field-group content under ResultsValue.components. The adapter recognizes FieldGroup as a type but does not traverse these components while constructing canonical fields or tables.

The parent field group can appear in canonical state, but its child fields and repeating group rows are not exposed for review.

References:

  • src/lib/adapters/uipath/sdkNormalize.ts:122-151
  • src/lib/adapters/uipath/sdkNormalize.ts:194-223
  • node_modules/@uipath/uipath-typescript/dist/document-understanding/index.d.ts:420-431
  • node_modules/@uipath/uipath-typescript/dist/document-understanding/index.d.ts:493-505

High: Multiple field values are collapsed during submission

Normalization records all top-level field values, but output generation always writes at most one value:

values: field.isMissing ? [] : [valueForField(field, target.values?.[0])]

This can discard the second and subsequent values of multi-valued fields. It is especially unsafe for repeating IXP field groups, where each parent value may contain a distinct set of components.

Reference: src/lib/adapters/uipath/toExtractionResult.ts:39-50.

High: Multiple table values are collapsed

Table normalization reads only table.values[0], and output generation emits a single table value. Additional table values are ignored and can be removed during submission.

References:

  • src/lib/adapters/uipath/sdkNormalize.ts:230-233
  • src/lib/adapters/uipath/toExtractionResult.ts:81-83
  • src/lib/adapters/uipath/toExtractionResult.ts:108-130

High: The original API wrapper and casing are not preserved

Artifact loading extracts and stores the inner ExtractionResult. PascalCase input is converted to camelCase. Submission uploads the bare camelCase extraction result rather than preserving the original synchronous or asynchronous envelope.

Only the plain JSON versus ZIP format and ZIP member filename are retained.

References:

  • src/lib/adapters/uipath/sdkNormalize.ts:53-86
  • src/lib/uipath/validationArtifacts.ts:317-325
  • src/lib/uipath/validationArtifacts.ts:464-479

High: Edited values can retain stale source metadata

Output generation spreads the original ResultsValue and replaces its text, confidence, and confirmation state. Existing token references, bounding boxes, and derived fields remain attached to the edited value.

Canonical bounding-box changes are not converted back into UiPath reference.tokens. A changed date can similarly retain derived date fields associated with the previous value.

References:

  • src/lib/adapters/uipath/toExtractionResult.ts:21-29
  • src/lib/adapters/uipath/toExtractionResult.ts:53-61

Medium: Zero-based table data can lose its first row

The normalizer assumes row zero is a header whenever any cell has rowIndex === 0, even when isHeader is false:

const firstDataRow =
  cells.some((cell) => cell.isHeader || cell.rowIndex === 0) ? 1 : 0;

A zero-based table without a header therefore loses its first data row. Output generation makes a similar assumption when preserving header cells.

References:

  • src/lib/adapters/uipath/sdkNormalize.ts:240-268
  • src/lib/adapters/uipath/toExtractionResult.ts:81-92

Medium: Empty tables can gain a phantom row

For a table value with no cells, maxRow defaults to zero and the row-building loop creates row zero. This can turn an empty table into one generated row of missing cells.

Reference: src/lib/adapters/uipath/sdkNormalize.ts:240-268.

Medium: Detection accepts malformed extraction results

Detection checks only that resultsDocument exists and has JavaScript type object. Because typeof null === "object", a null document passes detection and then fails during normalization. Invalid fields or tables values can similarly pass detection and fail when .map is called.

References:

  • src/lib/adapters/uipath/sdkNormalize.ts:35-50
  • src/lib/adapters/uipath/sdkNormalize.ts:281-301

Medium: Bounding boxes are not validated against the canonical contract

The canonical model requires normalized coordinates in the range [0, 1]. The SDK normalizer checks box length and positive page dimensions but does not reject non-finite, negative, or out-of-page coordinates.

References:

  • src/types/canonical.ts:1-4
  • src/types/canonical.ts:22-29
  • src/lib/adapters/uipath/sdkNormalize.ts:89-100

Compatibility Matrix

API V2 capability Status
Direct camelCase ExtractionResult Supported
Direct PascalCase extraction result Supported
Synchronous { extractionResult } wrapper Supported
Asynchronous { result: { extractionResult } } wrapper Not supported
Scalar fields Supported
Multiple scalar values on input Partially supported
Multiple scalar values on output Not safely supported
Token-based field coordinates Supported
Classic resultsDocument.tables Partially supported
Native ResultsValue.components Not supported
Repeating IXP field groups Not safely supported
Multiple table values Not safely supported
Wrapper-preserving round trip Not supported
Canonical-to-UiPath coordinate write-back Not supported

Test Coverage

npm test completed successfully on 2026-07-16:

  • 112 tests passed
  • 0 tests failed

The passing suite does not establish full V2 IXP compatibility. Missing behavioral coverage includes:

  • Synchronous and asynchronous V2 response envelopes
  • Native values[].components field groups
  • Repeating field-group values
  • Multiple scalar and table values
  • Wrapper- and casing-preserving round trips
  • Zero-based tables without headers
  • Empty tables
  • Updated token references after value attribution changes
  • A representative production IXP API V2 fixture

Several existing adapter tests assert source-code patterns instead of executing representative input/output transformations:

  • src/lib/adapters/uipath/sdkNormalize.test.mjs:11-27
  • src/lib/adapters/uipath/toExtractionResult.test.mjs:5-24

Recommended Remediation Order

  1. Add representative V2 fixtures for synchronous output, asynchronous output, nested field groups, repeating groups, and classic tables.
  2. Extend response unwrapping to support the async result.extractionResult envelope while handling non-success statuses explicitly.
  3. Define the canonical representation for nested and repeating IXP field groups, then normalize ResultsValue.components into it.
  4. Make output generation preserve untouched values, components, table values, wrappers, and casing.
  5. Rebuild or clear references and derived fields when reviewed values change.
  6. Correct table header detection and add empty-table safeguards.
  7. Strengthen structural validation and coordinate validation at adapter boundaries.

Overall Assessment

LoopDoc currently supports synchronous, classic DU-shaped subsets of API V2 output. It should not be declared generally compatible with API V2 IXP output until asynchronous envelopes and native field-group components are supported and round-trip behavior is proven lossless with representative fixtures.