Skip to content

Normalised curation-history prose would read better as block scalars (|) #347

Description

@realmarcin

Raised in review of PR #344 (#322's corpus normalisation). Deliberately not done there —
it changes the emitted format, which would mean re-normalising all 477 records inside a PR
already under review.

The observation

safe_dump's default for a long string is a folded/wrapped plain scalar, so the ~50
curation_history.changes entries — which are multi-sentence prose explaining why a
change was made — now come back re-wrapped at the emitter's width:

  changes: Re-grounded 2 causal edge(s) off enables/RO:0002327 with a TRAIT object (1
    to has electron acceptor, 1 to confers), issue 302. RO:0002327 has range 'biological
    process or activity', which a trait (a disposition) cannot satisfy, so the previous

A str representer emitting block literal style (|) for multi-line or long values
would keep them readable and, more usefully, make their diffs line-oriented — an edit to one
sentence would show as one changed line rather than re-flowing the whole paragraph.

Why it wasn't done in #344

  • It changes EMIT_OPTS/the representer, so every record would need re-normalising again.
  • test_the_whole_corpus_round_trips would enforce whatever form is chosen, so the decision
    is one-way once taken — worth making deliberately rather than inside a 350-file PR.
  • Normalise the corpus so the round-trip claim becomes enforceable (#322) #344's property (byte-identical round-trip) holds either way; this is about which stable
    form to standardise on.

If taken

  1. Register a representer for str choosing | when the value contains a newline or
    exceeds some length.
  2. Re-run the normaliser (scripts/-side, two-pass with the semantic check as in Normalise the corpus so the round-trip claim becomes enforceable (#322) #344).
  3. The existing round-trip tests then enforce the new form with no change.

Worth checking the diff-noise claim first on one record, since block scalars are also
whitespace-sensitive in a way plain scalars are not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions