Elements

graph TD; %% REQVIRE-AUTOGENERATED-DIAGRAM %% Graph styling classDef userRequirement fill:#D1C4E9,stroke:#7E57C2,stroke-width:2px; classDef systemRequirement fill:#E1D8EE,stroke:#673AB7,stroke-width:1.5px; classDef verification fill:#DCEDC8,stroke:#4CAF50,stroke-width:2px; classDef folder fill:#FAFAFA,stroke:#9E9E9E,stroke-width:3px; classDef file fill:#FFF8E1,stroke:#FFCA28,stroke-width:2px; classDef default fill:#F5F5F5,stroke:#424242,stroke-width:1.5px; subgraph 6c93988fc728d1f8["📁 requirements/Functional/Core/Verifications"] subgraph 622a654342e7abad["📄 AttachmentsVerifications.md"] 1c80039ebf669864["Attach Command Verification"]; class 1c80039ebf669864 verification; click 1c80039ebf669864 "AttachmentsVerifications.html#attach-command-verification"; 2b94b4f8deb0b47d["Attachment Identifier CRUD Verification"]; class 2b94b4f8deb0b47d verification; click 2b94b4f8deb0b47d "AttachmentsVerifications.html#attachment-identifier-crud-verification"; 43a55500f0bebfda["Attachment Output Rendering Verification"]; class 43a55500f0bebfda verification; click 43a55500f0bebfda "AttachmentsVerifications.html#attachment-output-rendering-verification"; d7cd30e5e333aa7["Attachment Scope Constraints Test"]; class d7cd30e5e333aa7 verification; click d7cd30e5e333aa7 "AttachmentsVerifications.html#attachment-scope-constraints-test"; 29ee19ee5dd27edc["Attachment Search Filters Verification"]; class 29ee19ee5dd27edc verification; click 29ee19ee5dd27edc "AttachmentsVerifications.html#attachment-search-filters-verification"; 3758f5f1c504cd42["Attachments Change Impact Verification"]; class 3758f5f1c504cd42 verification; click 3758f5f1c504cd42 "AttachmentsVerifications.html#attachments-change-impact-verification"; 18307065fb353848["Attachments Subsection Parsing Verification"]; class 18307065fb353848 verification; click 18307065fb353848 "AttachmentsVerifications.html#attachments-subsection-parsing-verification"; ff62a0266193ee63["Attachments Validation Verification"]; class ff62a0266193ee63 verification; click ff62a0266193ee63 "AttachmentsVerifications.html#attachments-validation-verification"; 285be0a87e4eada0["Detach Command Verification"]; class 285be0a87e4eada0 verification; click 285be0a87e4eada0 "AttachmentsVerifications.html#detach-command-verification"; 2f4e61e9544880a6["Move Asset Command Verification"]; class 2f4e61e9544880a6 verification; click 2f4e61e9544880a6 "AttachmentsVerifications.html#move-asset-command-verification"; 9ae645d347d4b31a["Remove Asset Command Verification"]; class 9ae645d347d4b31a verification; click 9ae645d347d4b31a "AttachmentsVerifications.html#remove-asset-command-verification"; end end d882e7ff8e1ffe95["test.sh"]; class d882e7ff8e1ffe95 default; click d882e7ff8e1ffe95 "../../../../tests/test-assets/test.sh"; 1c80039ebf669864 -->|satisfiedBy| d882e7ff8e1ffe95; 43a55500f0bebfda -->|satisfiedBy| d882e7ff8e1ffe95; 63f4742e633e3986["test.sh"]; class 63f4742e633e3986 default; click 63f4742e633e3986 "../../../../tests/test-attachment-constraints/test.sh"; d7cd30e5e333aa7 -->|satisfiedBy| 63f4742e633e3986; 29ee19ee5dd27edc -->|satisfiedBy| d882e7ff8e1ffe95; 4225cde0908b7474["test.sh"]; class 4225cde0908b7474 default; click 4225cde0908b7474 "../../../../tests/test-change-impact-attachments/test.sh"; 3758f5f1c504cd42 -->|satisfiedBy| 4225cde0908b7474; 18307065fb353848 -->|satisfiedBy| d882e7ff8e1ffe95; ff62a0266193ee63 -->|satisfiedBy| d882e7ff8e1ffe95; 285be0a87e4eada0 -->|satisfiedBy| d882e7ff8e1ffe95; 2f4e61e9544880a6 -->|satisfiedBy| d882e7ff8e1ffe95; 9ae645d347d4b31a -->|satisfiedBy| d882e7ff8e1ffe95;

Attach Command Verification

Verify attach command creates Attachments subsection and adds links.

Details

Test cases for file attachments:

  • Create Attachments subsection if missing
  • Add link with format [filename](path)
  • Idempotent: duplicate attach doesn’t create duplicate entry
  • Many-to-many: same file attaches to multiple elements
  • Dry-run mode makes no changes
  • Validation passes after attach

Test cases for element attachments:

  • Attach Refinement element by display name
  • Auto-detect: file path takes priority over element name when file exists
  • Element identifier format: [Name](#id) for same-file, [Name](file.html#id) for cross-file
  • Only Refinement types allowed (constraint, behavior, specification)
  • Error when attaching non-Refinement element (requirement, verification, etc.)
  • Error when neither file nor element found

Metadata

  • type: test-verification

Relations


Attachment Identifier CRUD Verification

Verify that moving or renaming Refinement elements updates attachment identifiers throughout the model.

Details

Test cases for move operations:

  • Moving a Refinement element updates all attachment identifiers referencing it
  • All files with referencing attachments are modified
  • Attachment format remains valid after move

Test cases for rename operations:

  • Renaming a Refinement element updates all attachment identifiers referencing it
  • All files with referencing attachments are modified
  • Attachment format remains valid after rename

Test cases for consistency:

  • Behavior matches relation target updates (same update logic)
  • Validation passes after CRUD operations
  • No orphaned or broken attachment references

Metadata

  • type: test-verification

Relations


Attachment Output Rendering Verification

Verify attachments render correctly in all output formats.

Details

Test cases for file paths:

  • Markdown output preserves format
  • HTML export renders clickable links
  • JSON includes attachments array
  • JSON file_path field contains git-root-relative path
  • Consistent indentation in markdown

Test cases for element identifiers:

  • JSON includes element identifiers in attachments array as strings
  • Element identifier format: "file.md#element-name"
  • HTML export renders clickable links to Refinement elements
  • Mixed file path and element identifier attachments display correctly

Metadata

  • type: test-verification

Relations


Attachment Scope Constraints Test

Verify that attachment scope constraints (hierarchical independence, satisfy requirement, and upstream propagation) are enforced for both refinement elements and file assets.

Details

Test cases for refinement hierarchical independence:

  • Model with attachment to refinement from same hierarchy causes validate to fail
  • Error when attaching requirement has satisfiedBy to the refinement
  • Error when attaching requirement is parent of the defining requirement
  • Error when attaching requirement is child/grandchild of the defining requirement
  • Accept attachment when attaching requirement is in a separate branch

Test cases for file attachment hierarchical independence:

  • Error when attaching file that is owned via satisfiedBy by the same requirement
  • Error when attaching file owned by parent requirement in hierarchy
  • Error when attaching file owned by child requirement in hierarchy
  • Accept file attachment when attaching requirement is in a separate branch from owner

Test cases for upstream attachment propagation:

  • Error when ancestor requirement already has the same attachment (refinement or file)
  • Error when descendant requirement already has the same attachment (suggest move)
  • Attachments propagate downstream - descendants cannot re-attach
  • Accept attachment when no ancestor or descendant has the same attachment

Error message formats:

  • Refinement hierarchy: '<refinement>' cannot be attached to '<element>' because it is within the refinement's defining hierarchy
  • File ownership: '<file>' cannot be attached to '<element>' because it is within the file owner's hierarchy (owned by '<owner>')
  • Ancestor propagation: '<attachment>' is already attached at '<ancestor>' which is an ancestor. Attachments propagate downstream.
  • Descendant conflict: '<attachment>' is already attached at '<descendant>' which is a descendant. Move attachment to '<element>' if you want it at higher level.

Test cases for satisfy requirement:

  • Model with attachment to orphan refinement (no satisfy relations) causes validate to fail
  • Error message indicates refinement must satisfy a requirement
  • Accept attachment to refinement with satisfy relations

Test cases for attach command:

  • link REQ attaching REFINEMENT fails when REQ is in same hierarchy
  • link REQ attaching ORPHAN-REFINEMENT fails when refinement has no satisfy
  • link REQ attaching FILE fails when FILE is owned by requirement in same hierarchy
  • Error messages are consistent with validate error format

Test cases for merge command:

  • merge TARGET SOURCE fails when SOURCE has attachment that violates hierarchy constraint for TARGET
  • merge TARGET SOURCE fails when SOURCE has attachment to orphan refinement
  • Error message indicates which attachment violates the constraint

Metadata

  • type: test-verification

Relations


Attachment Search Filters Verification

Verify search filters correctly find elements by attachments.

Details

Test cases:

  • --has-attachments finds only elements with attachments
  • --filter-attachment with glob pattern matches correctly
  • Pattern *.pdf matches PDF files only
  • Pattern docs/* matches all files in docs directory
  • No false positives or false negatives

Metadata

  • type: test-verification

Relations


Attachments Change Impact Verification

Verify Refinement element operations are tracked in change impact analysis.

Details

Test cases for Refinement element content changes:

  • Refinement element content change is detected in change-impact report
  • Same-file, cross-file, and cross-directory Refinement references are validated

Test cases for Refinement element mv operations:

  • mv to different file: relocation reported, attachment identifiers updated automatically
  • mv to different directory: relocation reported, attachment identifiers updated automatically
  • Behavior matches relation target relocation handling

Test cases for Refinement element rm operations:

  • rm of attached Refinement element: validation fails with clear error about broken attachment

Metadata

  • type: test-verification

Relations


Attachments Subsection Parsing Verification

Verify the system correctly parses Attachments subsections including both file paths and element identifiers.

Details

Test cases for file paths:

  • Parse markdown links in Attachments subsection
  • Extract paths where link text equals href
  • Normalize paths to git-root-relative
  • Handle multiple attachments in single element
  • Reject links where text ≠ href (for file paths)

Test cases for element identifiers:

  • Parse markdown links to Refinement elements (constraint, behavior, specification)
  • Normalize element identifiers like relation targets
  • Support full identifier format file.md#element-name
  • Support same-file format #element-name
  • Handle mixed file path and element identifier attachments

Metadata

  • type: test-verification

Relations


Attachments Validation Verification

Verify the system validates attachment targets including file existence and element identifier validity.

Details

Test cases for file paths:

  • Validation passes when attachment files exist
  • Validation fails for missing attachment files
  • Error message includes element identifier and missing path
  • Validation occurs in Pass 2

Test cases for element identifiers:

  • Accept Refinement element identifiers (constraint, behavior, specification)
  • Reject non-Refinement element identifiers (requirement, user-requirement, verification)
  • Error message indicates expected Refinement type
  • Validation fails for non-existent element identifiers

Metadata

  • type: test-verification

Relations


Detach Command Verification

Verify detach command removes links and cleans up empty subsections.

Details

CRITICAL: Must verify detach triggers change impact.

Test cases for file attachments:

  • Remove link from Attachments subsection
  • Remove subsection when no attachments remain
  • Detach from one element doesn’t affect others
  • Dry-run mode makes no changes
  • Change impact analysis shows element as changed

Test cases for element attachments:

  • Detach Refinement element by display name
  • Auto-detect: match element name against existing attachments
  • Works for both same-file and cross-file element attachments

Metadata

  • type: test-verification

Relations


Move Asset Command Verification

Verify mv-asset moves InternalPath files and updates all references across the model.

Details

Test cases for Attachments subsection updates:

  • Find all elements with InternalPath attachment matching old path
  • Update link text to new path
  • Update link href to new path
  • Handle relative path resolution from element’s file location

Test cases for Relations updates:

  • Find all satisfiedBy relations with InternalPath matching old path
  • Find all satisfy relations with InternalPath matching old path
  • Find all trace relations with InternalPath matching old path
  • Update relation target to new path
  • Handle relative path resolution from element’s file location

Test cases for filesystem and reporting:

  • Move/rename physical file on filesystem
  • Report count of affected Attachments
  • Report count of affected Relations
  • Report list of modified specification files
  • Dry-run mode: show changes without applying (file not moved)
  • Validation passes after move

Metadata

  • type: test-verification

Relations


Remove Asset Command Verification

Verify rm-asset deletes InternalPath files and removes all references from the model.

Details

Test cases for Attachments subsection updates:

  • Find all elements with InternalPath attachment matching path
  • Remove attachment link from Attachments subsection
  • Remove empty Attachments subsection if no attachments remain

Test cases for Relations updates:

  • Find all satisfiedBy relations with InternalPath matching path
  • Find all satisfy relations with InternalPath matching path
  • Find all trace relations with InternalPath matching path
  • Remove entire relation line from element

Test cases for filesystem and reporting:

  • Delete physical file from filesystem
  • Report count of removed Attachments
  • Report count of removed Relations
  • Report list of modified specification files
  • Dry-run mode: show changes without applying (file not deleted)
  • Validation passes after removal

Metadata

  • type: test-verification

Relations