Skip to content

gtdb_ground.py --emit-yaml and --apply dump at different widths, producing wrapped blocks #380

Description

@realmarcin

Found reviewing PR #379, and the root cause of the corruption that PR had to fix.

apply_to_community dumps blocks with width=4096, so each key is one line. The --emit-yaml path dumps at the default width (~100), so long scalars — gtdb_lineage, mapping_source — wrap onto continuation lines indented deeper than the block keys.

13 records in kb/communities/ carry such a wrapped block today, pasted in from --emit-yaml output.

That inconsistency is what made #378 hard: any line-level editor has to handle both shapes, and the first version matched exactly six spaces and orphaned the continuations into duplicate keys. --refresh now normalises them (the swept diff is net −30 lines, all unwrapping), but the two paths still disagree, so a fresh --emit-yaml paste reintroduces the shape.

Fix: dump at the same width in both paths — width=4096 in _block's --emit-yaml rendering — so a pasted block is byte-identical to an applied one.

Secondary, worth considering with it: --refresh without --apply is silently a no-op, and --refresh with --ncbi-id/--name is silently ignored. Argparse enforces neither.

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