Skip to content

fix(verify): let a quoted phrase verify under a compound free-text label - #2851

Open
abrichr wants to merge 1 commit into
mainfrom
fix/phrase-compound-field-labels
Open

abrichr wants to merge 1 commit into
mainfrom
fix/phrase-compound-field-labels

Conversation

@abrichr

@abrichr abrichr commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Problem

The strict obligation matcher (#2784) verifies a quoted phrase on a page field only when every word of the field's label is a free-text kind word (note, details, comment...). A correct save shown as Customer Details: <phrase> or Clinical Notes: <phrase> is rejected, because customer and clinical aren't kind words.

Change

In _label_names_obligation, a phrase or narrative obligation is also named by a compound label of up to four words when:

  • its head noun (last word) is a free-text word; and
  • no word before the head points at another record or an unsaved state (previous, prior, draft, pending, expected, template and similar).

Everything else in the strict path is unchanged: the phrase must still be the whole bound value, the line must carry no negation, failure or modal word, and one label can't carry two values. Amounts, dates, codes and IDs keep the full rule.

Tests

  • Accepts: Customer Details, Clinical Notes, Appeal Reason with the exact phrase.
  • Still rejects: Previous Notes, Draft Comment, Expected Summary, Customer Name (head isn't a free-text word), extra text in the value, an error on the line, part of the phrase, and one label with two values.
  • Adversarial: 5 still doesn't verify against Dose: 50 mg, a phrase "5" doesn't verify against Clinical Notes: 50 mg, and $250.00 doesn't verify against Charge Details: $1,250.00.

pytest tests/test_transducer_obligations.py tests/test_evidence_vendored.py tests/test_transducer_v3_runtime.py: 251 passed.

A phrase obligation verified on a page field only when every word of the
field's label was a free-text kind word, so 'Customer Details: <phrase>'
or 'Clinical Notes: <phrase>' rejected correct saves. A compound label now
names a phrase when its head noun (last word) is a free-text word and no
word before it points at another record or an unsaved state ('Previous
Notes', 'Draft Comment'). Amounts, dates, codes and IDs keep the full rule.
Adds adversarial tests, including 5 against 'Dose: 50 mg'.
@abrichr

abrichr commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: REQUEST CHANGES

From: Grok
Reviewed-Head: 0e82d5e

The matcher change is the right shape, but this head is not mergeable: smoke fails the fail-closed fold ratchet, and that failure is what turns packages-gate, ci and run-ci red.

What I checked

_label_names_obligation still accepts a phrase only when every label word is already allowed. The new branch then names a phrase or narrative obligation from a compound label of at most four words whose last word is a free-text kind word (details, notes, reason, …) and whose earlier words are not in _OTHER_RECORD_MODIFIERS. Amounts, dates, codes and IDs never take that branch.

Against this worktree on Python 3.12 I ran tests/test_transducer_obligations.py, tests/test_evidence_vendored.py and tests/test_transducer_v3_runtime.py: 251 passed in 0.69s, including the new compound-label cases and the adversarial ones (5 vs Dose: 50 mg, phrase "5" vs Clinical Notes: 50 mg, $250.00 vs Charge Details: $1,250.00). packages/flow/scripts/check_engine_generality.py reported "Engine generality OK (7 baseline hits left)".

Blocker

python packages/flow/scripts/check_verdict_folds.py fails on this tree, and CI smoke at this head failed the same way:

New hand-written verdict folds. Build the verdict on openadapt_flow.verdict.settle inside a function marked @verdict_site, and add its spec under tests/failopen/sites (docs/FAIL_CLOSED.md):
  slice_count: 51 (baseline 50); rose in openadapt/transducer_obligations.py 1 (baseline 0)

The new return ( in _label_names_obligation is one statement that both calls len(words) and slices words[:-1]. That is exactly the slice_count pattern the ratchet counts. Please split the length check from the modifier slice (or put the decision in a @verdict_site with a spec) so the check is clean, then rerun smoke.

Limitations, not the merge blocker:

  • The modifier denylist is a word list. Labels such as History Notes or Cancelled Comment are not excluded.
  • I am not merging. A release decision, if any, still sits with the maintainer after CI is green.

CI at this head: smoke failed on the fold check above; packages-gate, ci and run-ci failed because smoke failed. gitleaks, dependency-review, validate-platform-manifest, packages scope, install weight, packages packages-gate and launcher run-ci passed. review-verdict is red, as expected, until a matching Reviewed-Head comment lands on a green head.

abrichr added a commit that referenced this pull request Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant