CLI: an integer for a number property is read as an entity id: 0 and negatives fail, and an existing value block's id stores that block's value
まだ誰も着手していません。
評価
調査の方向性
Start by reading batch-set-property! in deps/outliner/src/logseq/outliner/property.cljs and compare the CLI call with the plugin and HTTP API fix in logseq/logseq#13488. Trace how the CLI sends number values into convert-ref-property-value; the issue reports failures for zero and negative values and incorrect resolution when a number matches a value block ID. Done means CLI number properties store the supplied number in each case.
索引モデルが issue の本文から書いたものです。
説明
Search first
- I searched and no similar issues were found
What Happened?
Setting a number property with upsert block --update-properties and an integer value goes wrong in two ways:
0and negative integers fail withExpected number or lookup ref for entity id, got 0(orgot -1).0.0fails the same way.- A positive integer that happens to be the
db/idof an existing value block of the same property is taken as a reference to that block. The property then holds that block's value instead of the number given, without any error.
The first case also happens when the property is set in the call that creates the block, and with upsert page --update-properties. The second case needs the id of a value block of that same property, so it should be rare, but nothing signals it when it does happen.
Other positive numbers, such as 1, 28, 99999999 and 2.5, are stored correctly. The same value passed as a string ("0", "-1", "637") is stored as the number, which is my workaround.
Reproduce the Bug
G=demo # any DB graph
id() { jq '.data.result[0]'; }
logseq upsert page --graph $G --page number-repro >/dev/null
logseq upsert property --graph $G --name num-value --type number >/dev/null
P=$(logseq list property --graph $G | grep -o 'user.property/num-value-[^ ]*')
B=$(logseq upsert block --graph $G --target-page number-repro --content holder --output json | id)
value() { logseq query --graph $G --query "[:find ?x . :in \$ ?b :where [?b :$P ?v] [?v :logseq.property/value ?x]]" --inputs "[$B]"; }
logseq upsert block --graph $G --id $B --update-properties "{:$P 0}"
logseq upsert block --graph $G --id $B --update-properties "{:$P -1}"
logseq upsert block --graph $G --id $B --update-properties "{:$P 28}" >/dev/null; value
V=$(logseq query --graph $G --query "[:find ?v . :in \$ ?b :where [?b :$P ?v]]" --inputs "[$B]")
echo "value block of 28: $V"
logseq upsert block --graph $G --id $B --update-properties "{:$P $V}" >/dev/null; value
Output, run on 18-11-2026:
Failure(Expected number or lookup ref for entity id, got 0)
Failure(Expected number or lookup ref for entity id, got -1)
28
value block of 28: 649
28
The last line should be 649, the number that was set, but it is 28.
Expected Behavior
A number given for a number property is stored as that number, whatever its value.
Screenshots
No response
Files
No response
Browser, Desktop or Mobile Platform Information
Linux, logseq --version: revision dad8e9c (nightly 20261118).
Additional Context
batch-set-property! in deps/outliner/src/logseq/outliner/property.cljs documents :entity-id? false as the way to force a literal for :number properties, and leaving it out as automatic value/ref resolution. The CLI sends batch-set-property without that option. convert-ref-property-value then calls (d/entity db v) on the integer to check whether it is a value block of the property: that throws for 0 and negative numbers, and matches when the number is such a block's id.
This is #1323 for the CLI. logseq/logseq#13488 fixed it for the plugin and HTTP API by adding the :entity-id? option, but the CLI does not pass it.
Found with the help of an AI coding assistant driving the CLI.
Are you willing to submit a PR? If you know how to fix the bug.
- I'm willing to submit a PR (Thank you!)
- 主要言語
- 言語のデータがありません
- スター
- 29
- フォーク
- 2
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
logseq/db-test のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
Potential Dataloss: Deleting an entry from the property page's node table has no confirmation dialog対応中かも @tiensonqin が 59 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Disabling Flashcards in Settings does not disable Flashcard shortcuts or tags対応中かも @tiensonqin が 60 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
maroomir/storyboard#240 ·
-
[mesheryctl] Enforce exact argument validation in system restart and system stop対応中かも @madhavzanwar が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
CachyOS/distribution#645 ·
-
area:core area:install area:sandbox area:state area:tui os:windows
難易度 2/5 半日 初心者へのやさしさ 62/100