Skip to content

A value keeps its undeclared object as part of the predicate - #686

Merged
WaylandYang merged 1 commit into
devfrom
fix/a-value-keeps-its-undeclared-object
Sep 13, 2026
Merged

WaylandYang merged 1 commit into
devfrom
fix/a-value-keeps-its-undeclared-object

Conversation

@WaylandYang

Copy link
Copy Markdown
Contributor

Fixes #685.

What was wrong

A fact can carry both a value and an object that the model never declared as an entity:

{"subject_ref": "k2", "predicate": "build", "object": "new energy generation", "object_ref": null,
 "value": "at least 10 GW", "quote": "SB Energy and SoftBank will build at least 10 GW of new energy generation"}

None of the literal branches in extraction.rs accepted (value, undeclared non-literal object). The fact went down the relation path, where span verification marked the object as a description. It then landed as a literal whose value was the object phrase ("new energy generation"), with an object_undeclared drop, and the number was thrown away. Written value-only, the same sentence keeps its figure. So whether "at least 10 GW", "at least $4.2 billion" and "incremental $40 million" reach the graph depended on which of two equally reasonable shapes the model chose. This explains the SB Energy exhibit losing all three in one recall round tonight (15/15 → 10/15 on that document). The shape appears in 0–1.5% of facts per round, on builds from before #637 through current dev.

What changed

A new literal branch, structure only: when a value is present and the object has no handle and isn't a name declared in the response or earlier in the document (case-insensitive), the fact is a value fact. The object phrase goes into the surface predicate (build new energy generation), so it is kept, not discarded, and the quote stays as evidence. A referenced or declared object still takes the relation path. The existing branches (value only, a quantity as object, an undeclared literal under an unknown predicate) are unchanged; they now also return the surface predicate, which is the model's predicate.

Verification

  • Unit test a_phrase_beside_a_value_is_not_an_entity covers the helper: no handle and undeclared → value; handle, declared name (any case) or blank → not.
  • End to end, on a real server with a scripted OpenAI-compatible endpoint returning that exact reply shape, on a copy of the bench base:
build the build fact drops
dev value "new energy generation", surface build (the figure is lost) object_undeclared
this branch value "at least 10 GW", surface build new energy generation none

In both builds the second fact in the reply, whose object SoftBank is declared (object_ref: e2), is an edge.

  • utopia-server and utopia-extract tests: 323 passed on a migrated database. Clippy -D warnings and fmt are clean.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: WaylandYang <wayland0916@gmail.com>
@WaylandYang
WaylandYang merged commit 303dfcb into dev Sep 13, 2026
4 checks passed
@WaylandYang
WaylandYang deleted the fix/a-value-keeps-its-undeclared-object branch September 13, 2026 18:08
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.

A fact with a value and an undeclared object loses the value

1 participant