Restrict subbucket ranges to bucket-specific values in nomenclature validator#19
Conversation
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 | |
Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
Implemented bucket-specific subbucket ranges as specified. Each bucket now enforces its designated range:
All existing files remain valid. Error messages now show bucket-specific allowed ranges. (986e453) |
Co-authored-by: AmedeoPelliccia <164860269+AmedeoPelliccia@users.noreply.github.com>
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
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.
| - Example: ✅ `00_70_FHA_SB15_SYS_propulsion_v01.md` | |
| - Example: ✅ `00_70_FHA_SB70_SYS_propulsion_v01.md` |
| * 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_...` |
There was a problem hiding this comment.
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.
| * Example: avoid `..._FHA_SYS_propulsion-fha_...` → use `..._FHA_SB15_SYS_propulsion_...` | |
| * Example: avoid `..._FHA_SYS_propulsion-fha_...` → use `..._FHA_SB70_SYS_propulsion_...` |
| 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}" | ||
| ) |
There was a problem hiding this comment.
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.
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)SB\d{2}→SB(1[5-9]|[2-9]\d)in PRIMARY_PATTERN and SB_PATTERNBUCKET_SUBBUCKET_RANGESdictionary mapping each bucket to its specific allowed rangesDocumentation
Bucket-Specific Subbucket Ranges
00102030405060708090Validation Behavior
No existing files affected (593/593 files remain valid).
Original prompt
💡 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.