spec-sync(v2): parse: add confidence to word-level atomic grounding - #145
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the mirrored V2 OpenAPI snapshot and regenerated reference models to track upstream drift.
Changes:
- Refreshes the V2 specification snapshot.
- Regenerates reference Pydantic models from the updated specification.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
specs/v2-aide.json |
Updates the mirrored upstream specification. |
specs/_generated/v2_models.py |
Regenerates reference models from the snapshot. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (1)
tests/contract/test_v2_smoke.py:104
- This live test can pass without exercising the new field: it does not select
dpt-3-fast, and it never requires an atomic segment or a non-Noneconfidence. A default line-granularity response—or a regression that drops all confidence values—therefore leaves the test green. Request the word-granularity model and require at least one segment plus a valid confidence on every returned segment.
resp = staging_client.v2.parse(document=pdf, options={"atomic_grounding": True})
…sses The AI commit annotated `_walk`'s parameter as `object` and silenced the resulting attribute access with a `type: ignore`, which left every value inside the loop untyped -- 6 `reportUnknown*` errors under the repo's strict pyright config, failing CI lint. Annotate the recursion properly with `List[V2ParseElement]` and move the None-coalescing to the call site. No behavior change. Co-Authored-By: Claude Opus 5 <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
Suppressed comments (2)
tests/contract/test_v2_smoke.py:105
- This contract test can pass without exercising the new wire field: it neither selects
dpt-3-fastnor requires any atomic segment or confidence value to exist. A line-granularity response, an emptyatomic_grounding, or a client that dropsconfidenceall satisfy the current assertions. Request the word-granularity model and require at least one bounded confidence value so the staging contract is actually verified.
def test_parse_atomic_grounding_confidence(staging_client: LandingAIADE) -> None:
# `atomic_grounding` segments carry an optional per-segment `confidence` in
# [0, 1] on word-granularity models (`dpt-3-fast`); line-granularity models
# omit it. Tolerate either: assert every present value is a valid probability.
pdf = Path(__file__).parent / "sample.pdf"
resp = staging_client.v2.parse(document=pdf, options={"atomic_grounding": True})
docs/v2-testing.md:47
- The PR description says the table-cell empty-list cases are documented, but this guide only explains when the field is omitted. Consumers still cannot tell that
[]is expected for table cells on line-granularity models or when escaped pipe/HTML rendering prevents reliable word offsets. Add those cases here (and the suppressed-Markdown case) to keep the reviewable SDK documentation aligned with the stated behavior.
Each segment reuses the node-grounding shape (`page`, `range`, `box`) and, on
word-granularity models only, an optional `confidence` in `[0, 1]` (the
lowest per-character OCR confidence in the word; `None` on line-granularity
models and on node-level grounding). Omitted when `options.atomic_grounding`
is `false`.
This was referenced Aug 17, 2026
tian-lan-landing
approved these changes
Aug 17, 2026
tian-lan-landing
added a commit
that referenced
this pull request
Aug 17, 2026
The V2 AI wiring step runs with no shell (deliberately -- it holds the checkout's push credentials and the fetched spec is untrusted input), so nothing type-checked its output: the step after it only formats. Every mistake pyright can see therefore landed as a red `lint` job on a PR that otherwise looked review-ready. - Run `./scripts/lint` in the existing trusted step and hand its output to a second shell-less Claude pass that fixes what it reports, then re-apply the product-code allowlist and re-lint. Closes the loop without granting a shell. The repair prompt forbids silencing (`# type: ignore`, widening to `object`/`Any`, deleting the failing assertion) so it fixes causes. The Slack reply now says whether lint ended clean, self-repaired, or is still failing, instead of implying the wiring is clean. - Two wiring-prompt rules for what the AI actually got wrong on #145/#110: read optionality from the schema's `required` array rather than the description prose (and treat absent and null alike), and never pin `model=` in a live contract test or assert an optional field is populated -- value assertions belong in the mocked tests. - Contract smoke tests: cap a request at 45s with no retries instead of the SDK's 8-minute/2-retry default, so a dead upstream fails in 45s naming the route rather than burning the gate. Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated V2 spec-sync PR (
client.v2).Gates (surface-lock, V2 contract tests, lint/test/typecheck) must pass. When present, the AI commit is a draft a human finishes (the V2 ergonomic layer — unified Job, dual-host, schema coercion — is not in the spec). Human review required before merge.
What changed
AI-generated from the PR diff — verify against the actual changes.
This PR adds a
confidencefield to word-granularity atomic grounding segments in parse responses; the spec snapshot also gains new/v1/extract*routes but those are not wired into the client surface.Changes:
confidencefield toV2ParseNodeGrounding, populated only on word-granularity (dpt-3-fast)atomic_groundingentries.atomic_groundingto clarify granularity varies by model (line-level fordpt-3-pro, word-level fordpt-3-fast) and to describe the newconfidencesemantics, including the empty-list cases for table cells.atomic_groundingmay be[]when word offsets can't be reliably located in escaped pipe/HTML table text./v1/extract,/v1/extract/build-schema, and related job-polling routes plusV1ExtractMetadata/V1BuildSchemaMetadatamodels, but these are not exposed through the SDK client.