Skip to content

A frontmatter list with one item is classified as an enum, so an attribute changes kind when a second value arrives #70

Description

@heitorrapcinski

The need, distilled

FacetExtractor decides the kind of an attribute by the number of values it happens to hold, not by the form the author wrote. kindOf only answers list when values.length > 1, so a frontmatter written as a list of one item is classified as enum:

tags: [contracts]          # kind: enum
tags: [contracts, budget]  # kind: list

The same attribute therefore has two different kinds across the notes of one vault, decided by a fact about a single note. Everything downstream that reads the kind — the display of a value as a chip or as text, and prefix matching once dates match by prefix — becomes inconsistent for reasons nobody can see from the note.

It also breaks a property worth keeping: adding a second value to an attribute MUST NOT change what that attribute is.

This was found by running the published conformance suite of the Markdown Profile against the extractors, which is the first thing that suite did.

Type

Defect, the product diverges from what the document already states.

Business rules created or changed

None. RN-DSC-020 already says the classification is by the shape of the value, and a list written with one item is a list. This is the code disagreeing with the rule, not the rule needing a new one.

Documents this delivery will update

  • None. The rule already says it; the fix makes the code obey it. The justification is in the definition of done.

Definition of done

  • tags: [contracts] and a dash list with a single item are classified as list.
  • A scalar value stays enum: it is the written form that decides, not the count.
  • The conformance case frontmatter/a-list-of-one-is-still-a-list passes.
  • The frontend, which today infers a list from the brackets in splitFrontmatter, agrees with the extractor rather than reaching the same answer by another road.

What is declaredly left out

Any change to the forty-character prose ceiling or to the cardinality ceiling.

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

    bugSomething isn't workingdomain:discoveryDiscovery: graph, search, facets

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions