Skip to content

Changing a property's type away from Text leaves its closed values behind, invisible but still enforced #1069

Open
logseq/logseq
#13882

Description

@ChipNowacek

Summary

When a property that has closed values is changed to type Node, the
closed values are not removed. They also stop being visible anywhere in the UI,
because Logseq does not render a closed-value list for Node properties.

The result is a property that looks correctly configured in every screen the UI
offers, but still carries a stale enum in the database. That enum is still
enforced by validate-db's fix-non-closed-values! pass, which deletes any
value not in it — and since a Node property's values are node references while
the orphaned enum holds text choices, every value of that property is
eligible for deletion
.

This issue is about the orphaned state itself. The deletion behaviour is filed
separately as a companion issue, because the two are independently fixable: a
graph that already contains an orphaned enum stays dangerous even if the
deletion pass is corrected, and correcting the type-change path does nothing for
graphs already in this state.

Version

Logseq DB version, desktop macOS arm64 (build 2287).
db-worker-node build-time 2026-07-28T15:15:45Z, revision 9a11243-dirty.

Steps to reproduce

  1. Create a property with type Text and give it two closed values
    (e.g. raster, vector).
  2. Change the property's type to Node.
  3. Open the property's configuration and look for the closed values.

Expected: either the closed values were removed as part of the type change,
or they are shown somewhere so the user knows they still exist — or the type
change is refused while closed values exist, the way a many→one cardinality
change is already refused when data would be lost.

Actual: the closed values are still in the database, reachable via
:block/_closed-value-property, but appear in no UI surface. There is no way to
discover or delete them from within the app.

Evidence from a real graph

In the graph where this was found, the affected property was the only one of
eleven closed-value properties whose logseq.property/type was node; the
other ten were all default.

Creation timestamps show the ordering: the property was created at
1783816803975 and its first closed value at 1783816803982 — seven
milliseconds later
, i.e. created together as a Text property with an enum. The
second closed value followed about three days on. Both long predate the type
being node.

There is no UI path to add closed values to a Node property, so they cannot have
been added after the change. The only consistent reading is that the property
was retyped and the closed values were left behind.

Why it matters

The invisibility is the harmful part. A user inspecting the property sees a
correctly configured Node property. Nothing indicates that a stale enum exists,
that it is still being enforced, or that running "Validate graph" will delete
data because of it.

Verified fix in that graph: deleting the two orphaned closed-value entities
directly made the property behave correctly, because fix-non-closed-values!
selects on :block/_closed-value-property and skips properties with none. That
repair required going outside the app.

Suggested fixes

  1. Remove closed values when a property's type changes to one that does not
    support them.
  2. Or refuse the type change while closed values exist, with a message,
    matching the existing precedent for many→one cardinality changes.
  3. Failing either, surface orphaned closed values in the property
    configuration UI
    so they can be seen and removed.

Related

Companion issue: #1068 — validate-db's fix passes silently delete user data
(no notification, :debug-only logging, no :block/updated-at bump, no UI
refresh). That issue is what turned this configuration inconsistency into
actual lost work.

Activity

  1. transferred this issue fromlogseq/logseqon Aug 17, 2026
  2. self-assigned this
    on Aug 18, 2026
  3. tiensonqin commented on Aug 18, 2026

    @tiensonqin
    Contributor

    @ChipNowacek afaik property type can't be changed after it's used, can you provide more reproducible steps on how you manage to change the property type?

  4. added
    awaiting-response
    on Aug 18, 2026
  5. ChipNowacek commented on Aug 18, 2026

    @ChipNowacek
    Author

    The type change is blocked only while the property currently has values — update-property tests (seq (d/datoms @conn :avet db-ident)) (deps/outliner/src/logseq/outliner/property.cljs:323). Closed values don't produce those datoms, so clearing the assigned values makes the property count as unused again and the change goes through.

    On a fresh graph:

    1. Create property arm-a, type Text.
    2. Assign values raster and vector to two blocks.
    3. Promote both to closed values.
    4. Remove the property from both blocks.
    5. Change the type to Node — no error.

    The enum is still attached afterwards:

    [:find ?cv ?title ?prop
     :where [?cv :block/closed-value-property ?prop] [?cv :block/title ?title]]
    ;; => [198 "raster" 194], [200 "vector" 194]

    with 194's :logseq.property/type = node.

  6. yuxi-liu-wired commented on Oct 27, 2026

    @yuxi-liu-wired

    Fixed in logseq/logseq#13882 (fix(db): deleting or converting a node no longer leaves what depended on it broken). Its description has the cause and the test that pins it; it fails on current master and passes with the fix.

  7. added 8 commits that reference this issue on Oct 29, 2026
    6ad9819
    a32faa5
    0c0f3f3
    0d11e32
    2131d5b
    fca4d94
    fd84ea2
    6c5ae56
  8. added 14 commits that reference this issue on Nov 11, 2026
    a7962a2
    cc7f8fa
    90ae86c
    e7ab485
    a8b6afb
    8328329
    c966984
    1407328
    a83e23c
    f37c050
    3481e3f
    ae404d8
    e5e1461
    0781bd4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

awaiting-response

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions