Skip to content

attributes.defaults.doc (publish metadata) is copied into every new item: intended? #866

Open

Description

@simonwalbrun-lab

Summary

The document metadata used for publishing (name, title, ref, by, major/minor revision, copyright) is configured under attributes: defaults: doc: in .doorstop.yml. doorstop add applies everything under attributes.defaults to the new item, so every new item also gets a copy of the document's doc: block. Is this intended?

Steps to reproduce

  1. In a git repo: doorstop create REQ ./reqs

  2. Set reqs/.doorstop.yml to:

    settings:
      digits: 3
      prefix: REQ
      sep: ''
    attributes:
      defaults:
        owner: me
        doc:
          title: 'My Spec'
          major: '3'
          minor: 'B'
  3. doorstop add REQ

  4. Open reqs/REQ001.yml.

Actual

The new item contains the document metadata as an item attribute:

doc:
  major: '3'
  minor: B
  title: My Spec
owner: me

Expected

Only owner: me. The doc: block configures the published document, not its items.

Why it matters

  • The document revision (major/minor) is copied into each item at creation time. When the revision is bumped later, older items keep the old value, so items end up with stale, inconsistent revision data.
  • It happens in this repository too: items created in reqs/ get a doc: attribute.

Question

Is this intended? Reusing attributes.defaults for document metadata looks like a side effect: as far as I can tell, doc was added to defaults for the LaTeX publisher around #628. defaults is documented as "values copied into new items".

If it is not intended, I have a fix ready and can open a PR:

  • New key attributes: doc: (next to defaults, publish, reviewed), read by get_document_attributes() for LaTeX, HTML and Markdown.
  • Backward compatible: an existing attributes: defaults: doc: keeps working. It is moved out of the item defaults on load (so it no longer leaks) and logs a deprecation warning.
  • Tests, docs (docs/reference/document.md) and the repo's own reqs/*.doorstop.yml updated.

If you'd prefer a different location (e.g. a top-level doc: section), or would rather just exclude doc from the defaults applied by doorstop add, I'm happy to adapt.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions