feat(extract): distinguish anchor_value_blank from anchor_not_found (P1-4)#29
Open
dev360 wants to merge 1 commit into
Open
feat(extract): distinguish anchor_value_blank from anchor_not_found (P1-4)#29dev360 wants to merge 1 commit into
dev360 wants to merge 1 commit into
Conversation
An anchored ``nullable: true`` field used to be completely silent when its label was present on the sheet but the adjacent value cell was empty — operationally indistinguishable from the case where the label itself was missing. The two cases require different operator responses (fix the file vs. update the template), and the report had no way to tell them apart. Anchored extraction now distinguishes the two: - Label not found at all → ``anchor_not_found`` (existing code), now tagged with ``ctx.label_was: "absent"``. - Label found, adjacent value cell empty, field ``nullable: true`` → new ``anchor_value_blank`` informational code with ``ctx.label_was: "present"``. Fires regardless of whether ``nullable: true`` would otherwise have suppressed the error, precisely because the operator asked to be notified of the slot. - Label found, value empty, field non-nullable → existing ``missing_required`` code, additionally tagged with ``ctx.label_was: "present"`` so consumers can distinguish "value required and missing" from "label and value both missing" without inferring it from co-occurring errors. ``RowExtractError`` carries a new ``label_was`` field that the validator lifts into ``Error.ctx``. README error taxonomy and the validator's row-message map are updated with the new code. Graduates the P1-4 xfail test. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
550b04c to
fa04b45
Compare
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.
Summary
Closes P1-4 — anchored fields used to be completely silent when their label was present on the sheet but the adjacent value cell was empty. That's operationally indistinguishable from the case where the label itself was missing, even though the two require very different operator responses (fix the file vs. update the template).
This PR splits the cases via a new informational code and a new context key.
Behavior
anchor_not_found(existing code), now tagged withctx.label_was: "absent".nullable: truefield → newanchor_value_blankinformational code, tagged withctx.label_was: "present". Fires despitenullable: trueprecisely because the operator asked to be notified of the slot.missing_requiredcode, additionally tagged withctx.label_was: "present"so consumers can distinguish "value required and missing" from "label and value both missing" without inferring it from co-occurring errors.RowExtractErrorcarries a newlabel_wasfield that the validator lifts intoError.ctx.Test plan
uv run pytest tests/test_field_scan_gaps.py -q— P1-4 graduates.uv run pytest -q— 105 passed, 36 xfailed.uvx --from 'ruff==0.6.9' ruff check .andruff format --check .— clean.All fixtures and copy use only fictitious values per CLAUDE.md.
🤖 Generated with Claude Code