A written quantity is a value, not a node - #586
Merged
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: WaylandYang <wayland0916@gmail.com>
This was referenced Sep 10, 2026
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.
面板上点开
$5 billion这个「实体」,底下挂着两件毫不相干的事:它们唯一的共同点是字符串一样。图上 SSI Inc. 与 Nvidia 因此隔着这个点两跳可达——一条没有含义的路径。同一个库里
$1 billion、$30 billion也这样。病灶:一道太窄的闸
「谓词未知 + 字面值宾语」那条路早就铺好了(
insert_value_fact,值进object_value、原词进proposed_predicate,采纳时只换谓词、形状不动)。提示词也写着(规则 8a,例子正是"$11.9 billion")。缺的是把守那条路的判据:"$5 billion"两条都不满足,于是掉进关系那条路,凭空造出一个节点;同名的再并成一个点。改动
parse_quantity(新,utopia-extract):一个整体就是一个量的字符串 → (数值, 单位)。可选货币符号 + 数字 + 可选量级词 + 可选百分号,此外一个词都不许有:$5 billion→ (5e9,$)900 million weekly active users52%→ (52,%)2025 Atlantic hurricane season3.5 million、35,000$10 billion investment、8GW data center3M(那是一家公司)、5k量级词只认全写,不认单字母后缀——把 3M、K2、B1 读成数字,代价是一个真实体被读没了,而那一头不可逆。单位照抄符号不猜币种:
$可能是美元也可能是澳元,猜出来的USD是一条没人负责的断言。looks_literal改用它(裸数字那一档它已包含)。normalize_attr_value("number", …)也认量,否则采纳属性时$5 billion一路「换不动」,事实永远拿不到谓词。$5B(Intl.NumberFormat紧凑写法):存的是乘开的数才能比大小,可念出来「5000000000 $」比原文难读。顺带修掉一个把整批打翻的坑
value_facts_for_forms把s.type_id解成裸Uuid,可这列本来就可空(0009:「抽到了东西但本体里没有对应的类」是正常状态)。批里只要有一条主语没类型,采纳就在解码那一步整个退出:实测一个库里攒着 2454 条等谓词的值事实,其中 58 条主语无类型——够把好几个说法卡死。改成
Option:没类型的不参与 domain(属性得声明挂在哪些类下),但照样跟着改写,否则一条有名有姓的事实会继续没有谓词。RED → GREEN 都跑过:改之前那条探针拿到上面那行解码错,改之后
an_untyped_subject_does_not_stall_the_batch在真库上通过。不做回迁
RC 阶段,语料重抽一遍就干净了,不值得为几十条记录去动双时态账本。已有的库不会自己变,要看效果得重抽。
验证
cargo fmt --all --check、cargo clippy --workspace --all-targets -- -D warnings干净。cargo test --workspace(CI 那条不带库的口径)86 个 test result 全绿。cargo test -p utopia-store在手工迁好的库上除rss_ledger_contract外全绿;那一条自己跑迁移,撞上我用 psql 铺的表(relation "organizations" already exists),是本地记账问题不是行为问题——CI 先sqlx migrate run,以它为准。pnpm test18 passed、pnpm build(style-guard + tsc + vite)干净。🤖 Generated with Claude Code