Skip to content

Restrict subbucket ranges to bucket-specific values in nomenclature validator#19

Merged
AmedeoPelliccia merged 6 commits intomainfrom
copilot/restrict-subbucket-usage
Dec 15, 2025
Merged

Restrict subbucket ranges to bucket-specific values in nomenclature validator#19
AmedeoPelliccia merged 6 commits intomainfrom
copilot/restrict-subbucket-usage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 15, 2025

Enforces subject category field constraints: LC01-LC14 for lifecycle artifacts (BUCKET=00), and bucket-specific subbucket ranges for domain artifacts (BUCKET≠00). Previously allowed SB00-SB99 for all non-lifecycle buckets.

Changes

Validation Logic (validate_nomenclature.py)

  • Updated regex patterns: SB\d{2}SB(1[5-9]|[2-9]\d) in PRIMARY_PATTERN and SB_PATTERN
  • Added BUCKET_SUBBUCKET_RANGES dictionary mapping each bucket to its specific allowed ranges
  • Enhanced validation to enforce bucket-specific subbucket ranges
  • Error messages now show bucket-specific allowed ranges (e.g., "BUCKET=70 requires SB70-SB79")
  • Added defensive error handling for subbucket number extraction

Documentation

  • Updated field constraints table with bucket-specific subbucket ranges
  • Updated all examples to use bucket-appropriate subbuckets
  • Clarified sub-bucket mapping removes SB00-SB14 reserved range
  • Updated quick reference guide with bucket-specific ranges table

Bucket-Specific Subbucket Ranges

BUCKET Domain Allowed Subbuckets
00 Lifecycle LC01-LC14
10 Operations SB15-SB19, SB80-SB85
20 Primary Subsystem SB20-SB29
30 Circularity SB30-SB39
40 Software SB40-SB49
50 Structures SB50-SB59
60 Storages SB60-SB69
70 Propulsion SB70-SB79
80 Energy SB86-SB89
90 Tables/Schemas/Diagrams SB90-SB99

Validation Behavior

# Valid: LC category for BUCKET=00
"00_00_PLAN_LC02_SPACET_safety-program_v01.md"# Valid: SB category with correct range for bucket
"00_70_FHA_SB70_SYS_propulsion_v01.md""00_40_REQ_SB40_SW_software-reqs_v01.md"# Rejected: SB00-SB14 now invalid (reserved)
"00_70_FHA_SB00_SYS_propulsion_v01.md"# Rejected: Wrong subbucket range for bucket
"00_70_FHA_SB40_SYS_propulsion_v01.md"  ✗ (BUCKET=70 requires SB70-SB79)

# Rejected: Wrong category for bucket
"00_00_PLAN_SB15_SPACET_project_v01.md"  ✗ (BUCKET=00 requires LC)
"00_70_FHA_LC01_SYS_propulsion_v01.md"  ✗ (BUCKET00 requires SB)

No existing files affected (593/593 files remain valid).

Original prompt

On validate_nomenclature.py, restrict subbucket usage [15-99]


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 15, 2025 11:26
Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
Copilot AI changed the title [WIP] Restrict subbucket usage to range 15-99 Restrict subbucket range to SB15-SB99 in nomenclature validator Dec 15, 2025
@AmedeoPelliccia
Copy link
Copy Markdown
Owner

@copilot | 00 | Lifecycle | Uses LC01-LC14 | | 10 | Operations | Uses SB15-SB19 + SB80-SB85 | | 20 | Primary Subsystem | Uses SB20-SB29 | | 30 | Circularity | Uses SB30-SB39 | | 40 | Software | Uses SB40-SB49 | | 50 | Structures | Uses SB50-SB59 | | 60 | Storages | Uses SB60-SB69 | | 70 | Propulsion | Uses SB70-SB79 | | 80 | Energy | Uses SB86-SB89 |

Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 15, 2025

@copilot | 00 | Lifecycle | Uses LC01-LC14 | | 10 | Operations | Uses SB15-SB19 + SB80-SB85 | | 20 | Primary Subsystem | Uses SB20-SB29 | | 30 | Circularity | Uses SB30-SB39 | | 40 | Softwar...

Implemented bucket-specific subbucket ranges as specified. Each bucket now enforces its designated range:

  • BUCKET=10: SB15-SB19, SB80-SB85
  • BUCKET=20: SB20-SB29
  • BUCKET=30: SB30-SB39
  • BUCKET=40: SB40-SB49
  • BUCKET=50: SB50-SB59
  • BUCKET=60: SB60-SB69
  • BUCKET=70: SB70-SB79
  • BUCKET=80: SB86-SB89
  • BUCKET=90: SB90-SB99

All existing files remain valid. Error messages now show bucket-specific allowed ranges. (986e453)

Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
Copilot AI changed the title Restrict subbucket range to SB15-SB99 in nomenclature validator Restrict subbucket ranges to bucket-specific values in nomenclature validator Dec 15, 2025
@AmedeoPelliccia AmedeoPelliccia marked this pull request as ready for review December 15, 2025 11:48
Copilot AI review requested due to automatic review settings December 15, 2025 11:48
@AmedeoPelliccia AmedeoPelliccia merged commit cdd4a0a into main Dec 15, 2025
9 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enforces bucket-specific subbucket ranges in the nomenclature validator, restricting each domain bucket to use only its designated subbucket ranges instead of allowing SB00-SB99 globally. This change removes the SB00-SB14 reserved range and ensures proper categorization of artifacts.

Key Changes:

  • Updated validation regex to restrict subbuckets to SB15-SB99 range
  • Added BUCKET_SUBBUCKET_RANGES dictionary mapping each bucket to specific allowed subbucket ranges
  • Enhanced error messages to show bucket-specific allowed ranges
  • Updated documentation with bucket-specific subbucket range tables and corrected examples

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
validate_nomenclature.py Updated regex patterns to SB15-SB99, added BUCKET_SUBBUCKET_RANGES dictionary with bucket-specific ranges, and enhanced validation logic to enforce these ranges with clear error messages
00_00_STD_LC01_SPACET_nomenclature-standard_v02.md Updated field constraints table and regex documentation to reflect SB15-SB99 range, added bucket-specific subbucket ranges table, and updated all examples to use bucket-appropriate subbuckets
00_00_CAT_LC01_SPACET_nomenclature-quick-reference_v02.md Updated pattern documentation, field rules, bucket values table with subbucket ranges, and examples to demonstrate valid bucket-specific subbucket usage

❌ `00_00_PLAN_SPACET_safety-program_v01.md`
**If `BUCKET≠00`** → Use **SB** (Sub-bucket) category:
- `LC_OR_SUBBUCKET` **MUST** be `SB15` through `SB99`
- Example: ✅ `00_70_FHA_SB15_SYS_propulsion_v01.md`
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example shown as valid is actually invalid according to the bucket-specific subbucket ranges. BUCKET=70 (Propulsion) requires subbuckets in the range SB70-SB79, not SB15. This example should use SB70 instead of SB15.

Suggested change
- Example: ✅ `00_70_FHA_SB15_SYS_propulsion_v01.md`
- Example: ✅ `00_70_FHA_SB70_SYS_propulsion_v01.md`

Copilot uses AI. Check for mistakes.
* Must be lowercase kebab-case.
* Must not duplicate semantic content already encoded in `TYPE` or `BUCKET`.
* Example: avoid `..._FHA_SYS_propulsion-fha_...` → use `..._FHA_SB00_SYS_propulsion_...`
* Example: avoid `..._FHA_SYS_propulsion-fha_...` → use `..._FHA_SB15_SYS_propulsion_...`
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example uses SB15 which is only valid for BUCKET=10 (Operations). However, FHA documents are typically not in the Operations bucket. This example should either specify the bucket context or use a more appropriate subbucket value. For instance, if this is meant for a propulsion FHA, it should use SB70 instead of SB15.

Suggested change
* Example: avoid `..._FHA_SYS_propulsion-fha_...` → use `..._FHA_SB15_SYS_propulsion_...`
* Example: avoid `..._FHA_SYS_propulsion-fha_...` → use `..._FHA_SB70_SYS_propulsion_...`

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +218
else:
# Validate bucket-specific subbucket range
if bucket in self.BUCKET_SUBBUCKET_RANGES:
try:
# Extract numeric part from stage (e.g., "SB15" -> 15)
sb_num = int(stage[2:])
ranges = self.BUCKET_SUBBUCKET_RANGES[bucket]

# Check if subbucket number is in any of the allowed ranges for this bucket
in_range = any(start <= sb_num <= end for start, end in ranges)

if not in_range:
# Format ranges for error message
range_strs = [f"SB{start:02d}-SB{end:02d}" for start, end in ranges]
allowed = " or ".join(range_strs)
errors.append(
f"BUCKET={bucket} requires LC_OR_SUBBUCKET to be {allowed}, got '{stage}'"
)
except (ValueError, IndexError):
# This should not happen if SB_PATTERN matched, but handle defensively
errors.append(
f"Invalid subbucket format '{stage}' for BUCKET={bucket}"
)
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic only checks bucket-specific ranges if the bucket exists in BUCKET_SUBBUCKET_RANGES dictionary. If a new bucket is added to ALLOWED_BUCKETS but not to BUCKET_SUBBUCKET_RANGES, it will silently pass validation for any SB15-SB99 value. Consider adding a validation check to ensure all non-00 buckets in ALLOWED_BUCKETS have corresponding entries in BUCKET_SUBBUCKET_RANGES, or refactor to make this validation mandatory for all non-00 buckets.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants