strictdoc-project / strictdoc

Software for technical documentation and requirements management.
https://strictdoc.readthedocs.io/en/stable/
Other
159 stars 26 forks source link

auto-uid strips RELATIONS if the REQUIREMENT has no UID/MID #1630

Closed KlfJoat closed 10 months ago

KlfJoat commented 10 months ago

This one got me a few times before I realized it was happening.

Given this strictdoc.toml file:

[project]
title = "myproj"

include_doc_paths = [
  "wip/*.sdoc"
]

features = [
  # Stable features that are enabled by default.
  "TABLE_SCREEN",
  "TRACEABILITY_SCREEN",
  "DEEP_TRACEABILITY_SCREEN",

  # Experimental features
  # "REQIF",
  # "HTML2PDF",
  "DIFF",
  "PROJECT_STATISTICS_SCREEN",
  # "STANDALONE_DOCUMENT_SCREEN",
  "REQUIREMENT_TO_SOURCE_TRACEABILITY"
]

And this SDoc file:

[DOCUMENT]
MID: a93dc5926d5b4e3bb1022d38cdfae467
TITLE: myproj
UID: MYDOC
VERSION: 0.1
OPTIONS:
  ENABLE_MID: True
  MARKUP: RST
  AUTO_LEVELS: On
  REQUIREMENT_STYLE: Table
  REQUIREMENT_IN_TOC: True

[GRAMMAR]
ELEMENTS:
- TAG: REQUIREMENT
  FIELDS:
  - TITLE: UID
    TYPE: String
    REQUIRED: False
  - TITLE: STATUS
    TYPE: String
    REQUIRED: False
  - TITLE: TAGS
    TYPE: Tag
    REQUIRED: False
  - TITLE: DISCTYPE
    TYPE: MultipleChoice(UNKNOWN, All, BDV, HFPA, BDROM, DVDV, DVDA, DVDROM, CDDA, CDROM)
    REQUIRED: True
  - TITLE: TITLE
    TYPE: String
    REQUIRED: True
  - TITLE: STATEMENT
    TYPE: String
    REQUIRED: False
  - TITLE: RATIONALE
    TYPE: String
    REQUIRED: False
  - TITLE: COMMENT
    TYPE: String
    REQUIRED: False
  RELATIONS:
  - TYPE: Parent
  - TYPE: File

[SECTION]
MID: bba9883c030e416e8bec2678d12ea248
TITLE: Section 1
REQ_PREFIX: SECT-

[FREETEXT]
Examples
[/FREETEXT]

[REQUIREMENT]
MID: c172051f771d4825be48f229d792b16f
UID: SECT-1
STATUS: Backlog
TAGS: func
DISCTYPE: All
TITLE: Vitae congue eu consequat
STATEMENT: Eget nullam non nisi est sit amet facilisis.
RATIONALE: Facilisis leo vel fringilla est ullamcorper eget nulla facilisi etiam.

[REQUIREMENT]
MID: 93b93f194f0e4ae0967ac80c77427e67
UID: SECT-2
STATUS: Active
TAGS: action
DISCTYPE: All
TITLE: Ut enim ad minim veniam
STATEMENT: Porttitor rhoncus dolor purus non.
RATIONALE: Netus et malesuada fames ac turpis egestas.
COMMENT: >>>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
<<<
RELATIONS:
- TYPE: Parent
  VALUE: SECT-1

[REQUIREMENT]
STATUS: Active
TAGS: func
DISCTYPE: All
TITLE: Vel pharetra vel turpis nunc
STATEMENT: Semper feugiat nibh sed pulvinar proin gravida hendrerit lectus.
RATIONALE: Quis auctor elit sed vulputate mi sit amet.
RELATIONS:
- TYPE: Parent
  VALUE: SECT-1

[/SECTION]

When I run strictdoc manage auto-uid --config strictdoc-van.toml ., it strips the RELATIONS. The last Requirement ends up looking like this:

[REQUIREMENT]
MID: f5db5e9177b04f8b9e2f18a64d5968f8
UID: SECT-3
STATUS: Active
TAGS: func
DISCTYPE: All
TITLE: Vel pharetra vel turpis nunc
STATEMENT: Semper feugiat nibh sed pulvinar proin gravida hendrerit lectus.
RATIONALE: Quis auctor elit sed vulputate mi sit amet.

The diff of that is:

--- Req-vanilla.sdoc.20240130.194937    2024-01-30 19:49:12.335488699 -0600
+++ Req-vanilla.sdoc    2024-01-30 19:49:42.836153159 -0600
@@ -75,14 +75,13 @@
 <<<

 [REQUIREMENT]
+MID: f5db5e9177b04f8b9e2f18a64d5968f8
+UID: SECT-3
 STATUS: Active
 TAGS: func
 DISCTYPE: All
 TITLE: Vel pharetra vel turpis nunc
 STATEMENT: Semper feugiat nibh sed pulvinar proin gravida hendrerit lectus.
 RATIONALE: Quis auctor elit sed vulputate mi sit amet.
-RELATIONS:
-- TYPE: Parent
-  VALUE: SECT-1

 [/SECTION]

This only happens if a UID and MID need to get added to the Requirement. If they already exist, the RELATIONS remain untouched.

stanislaw commented 10 months ago

I know exactly what is going on and will work on a fix.

This is a very good report that pushes me to complete a long series of refactorings related to REFS->RELATIONS migration.

stanislaw commented 10 months ago

This should have been fixed. Thanks again for reporting.

stanislaw commented 10 months ago

You could try the --pre Pip package.

KlfJoat commented 10 months ago

Sorry, I forgot to comment.

Yes, this fixes my issue. Thanks!