---
title: SAIF.Framework.Version business rules
summary: Enumerated business rules with per-rule trigger, enforcement, and outcomes.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.Version
reference_type: package
---

# SAIF.Framework.Version business rules

This page captures the parsing, normalization, and comparison rules enforced by the `Version` value object, including one possible copy-paste defect flagged during analysis.

## BR-001: Non-numeric leading characters in a version segment are coerced to 0

| Field | Value |
| --- | --- |
| **Statement** | When a version segment string does not start with digits, or otherwise fails numeric conversion, the segment is treated as `0` rather than raising an error. |
| **Trigger** | The `ToInt` extension method is called on a version segment string that does not start with digits, or whose conversion otherwise throws. |
| **Enforcement** | `SAIF.Framework.Version\Version.vb` — `ToInt` function; an empty `Catch` block swallows conversion errors. |
| **Outcome** | Comparisons and increments treat malformed segments as `0` rather than throwing an exception. |
| **Source** | `SAIF.Framework.Version\Version.vb` |

---

## BR-002: Missing trailing version segments default to "0" when parsing

| Field | Value |
| --- | --- |
| **Statement** | A version string with fewer than four dot-separated segments has its missing trailing segments (`Minor`, `Build`, `Revision`) defaulted to `"0"`. |
| **Trigger** | `Parse(input)` is called with fewer than 4 dot-separated segments. |
| **Enforcement** | `SAIF.Framework.Version\Version.vb` — `Parse` function. |
| **Outcome** | A partial version string such as `"2.1"` is treated as `"2.1.0.0"`. |
| **Source** | `SAIF.Framework.Version\Version.vb` |

---

## BR-003: A wildcard token in an Increment format means "auto-increment this segment"

| Field | Value |
| --- | --- |
| **Statement** | A `*` character in a segment's format token passed to `Increment` causes that segment's numeric value to be incremented by 1 relative to the version's prior value. |
| **Trigger** | `Increment(format)` is called with a token containing `*` (e.g., `"1.0.*.0"`). |
| **Enforcement** | `SAIF.Framework.Version\Version.vb` — `Increment` function. |
| **Outcome** | The corresponding segment's numeric value increases by 1 relative to its prior value. |
| **Source** | `SAIF.Framework.Version\Version.vb` |

---

## BR-004: An empty Increment format token means "retain the current segment value unchanged"

| Field | Value |
| --- | --- |
| **Statement** | An empty string token for a segment passed to `Increment` leaves that segment's value unchanged rather than resetting or blanking it. |
| **Trigger** | `Increment(format)` is called with an empty string token for a segment (e.g., a format missing a segment such as `"1.0"`). |
| **Enforcement** | `SAIF.Framework.Version\Version.vb` — `Increment` function, `ElseIf (value = "")` branch. |
| **Outcome** | The segment keeps its pre-increment value. |
| **Source** | `SAIF.Framework.Version\Version.vb` |

---

## BR-005: Increment format supports date template tokens {year}, {month}, {day}

| Field | Value |
| --- | --- |
| **Statement** | Literal `{year}`, `{month}`, `{day}` tokens present anywhere in the `format` string passed to `Increment` are substituted with the current date's year, month, and day (via `Now`) before the result is re-parsed. |
| **Trigger** | The `format` string passed to `Increment(format)` contains any of the `{year}`, `{month}`, `{day}` tokens. |
| **Enforcement** | `SAIF.Framework.Version\Version.vb` — `Increment` function. |
| **Outcome** | The resulting version segment reflects the current date at the time `Increment` is called. |
| **Source** | `SAIF.Framework.Version\Version.vb` |

---

## BR-006: Equality and ordering are defined purely by the four numeric components, not by string equality

| Field | Value |
| --- | --- |
| **Statement** | The `=`, `<>`, `<`, `>` operators and `CompareTo` compare `Version` instances using the `ToInt`-normalized numeric value of each segment, not the raw string values. |
| **Trigger** | Any use of `=`, `<>`, `<`, `>`, or `CompareTo` between two `Version` instances. |
| **Enforcement** | `SAIF.Framework.Version\Version.vb` — operator overloads and `CompareTo`. |
| **Outcome** | e.g., `"1.02.0.0"` and `"1.2.0.0"` compare as equal, since `ToInt` normalizes the numeric value of each segment. |
| **Source** | `SAIF.Framework.Version\Version.vb` |

---

## BR-007: Tautological Major-equality check in the `<` and `>` operators

| Field | Value |
| --- | --- |
| **Statement** | The "majors are equal, now compare minors" `ElseIf` branch in both the `<` and `>` operator overloads compares `v2.Major.ToInt = v2.Major.ToInt` — both operands reference `v2` — instead of the presumably intended `v1.Major.ToInt = v2.Major.ToInt`.* This is a likely copy-paste defect.* |
| **Trigger** | Any comparison using `<` or `>` where the preceding `Major`-based less-than/greater-than branch does not match, so control reaches the tautological `ElseIf`. |
| **Enforcement** | `SAIF.Framework.Version\Version.vb` — `<` and `>` operator overload implementations. |
| **Outcome** | Because `Major` is evaluated first and correctly gates entry into this branch, the tautological condition (always `True`) does not currently produce incorrect comparison results — the "majors are equal, now compare minors" branch is entered whenever it should be — but the condition itself does not verify what its structure implies and should be corrected for clarity and correctness.* |
| **Source** | `SAIF.Framework.Version\Version.vb` |

---

## Notes
- [BR-007](#br-007-tautological-major-equality-check-in-the--and--operators) is flagged as a likely copy-paste defect based on code structure and naming symmetry with the correctly-written equivalent branches elsewhere in the same operators; its intended behavior is inferred and has not been confirmed with the original authors.*
- Whether this tautology has ever caused an observable defect in a consuming build/version-stamping process is unknown — no consumer of this library was found within this repository's build graph.**

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Configuration](configuration.md)
- [API reference](api/index.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `SAIF.Framework.Version\Version.vb`
