Skip to content

VerificationGate: the "?" question guard in unitIsClaimable is dead — splitIntoUnits eats the "?" first #2231

Description

@drpaulobernardy

Summary

unitIsClaimable has a question guard (if (u.includes("?")) return false;), but it can never fire: splitIntoUnits splits on [.!?;,]+ and consumes the ?, so every unit reaches the guard without it. A statement-shaped question is typed as a claim.

Repro (public main @ 5e2f2e8, LifeOS/install/hooks/VerificationGate.hook.ts)

import { classifyClaim, splitIntoUnits } from "./hooks/VerificationGate.hook";
splitIntoUnits("The site is live?");                        // ["The site is live"]  — "?" gone
classifyClaim("The site is live?")?.type;                   // "T1"
classifyClaim("The deploy succeeded, the site is live?")?.type; // "T1"
classifyClaim("Is the site live?")?.type;                   // null (caught by LEADING_INTERROGATIVE, not by the "?" guard)

English mostly hides this because questions usually start with an interrogative word or inverted verb. In languages where a yes/no question keeps statement word order and is marked only by "?" (Portuguese, Spanish, Italian: "O site está no ar?"), the "?" is the only signal, and it is lost before the guard runs. ISACloseGate's completionUnit shares splitIntoUnits, so "Done?" style questions hit the same path there.

Suggested fix (one line)

Drop the interrogative clause before the split, so a question never becomes a unit:

return text
  .replace(/[^\n.!?]*\?/g, "\n")
  .split(/\n+|(?<!\d)[.!?;,]+|[.!?;,]+(?!\d)/)

The clause is taken from the previous terminator to the "?", so a statement sitting before the question in the same message ("The site is live. Want me to check login?") is still read as a claim. Applied locally with tests for both cases; the existing hook suite stays green.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions