Skip to content

Commit f92e7e8

Browse files
fix: accept 4+ digit spec numbers in tests and docs (#2094)
Two test assertions in test_timestamp_branches.py used the regex `\d{3}` (exactly 3 digits) instead of `\d{3,}` (3 or more digits). While the underlying shell scripts already handle spec numbers ≥ 1000 correctly — printf "%03d" and PowerShell '{0:000}' both expand naturally beyond 3 digits, and all detection regexes use {3,} — the overly-strict test assertions would fail with a misleading error if a fixture ever contained 1000+ spec directories. Documentation in README.md, spec-driven.md, and the CLI --branch-numbering help text implied that sequential spec numbers are always 3 digits, which could lead users to believe a hard limit of 999 exists. Changes: - tests/test_timestamp_branches.py: change two \d{3} assertions to \d{3,} - src/specify_cli/__init__.py: clarify help text to show numbers expand past 999 - README.md: update --branch-numbering docs to note numbers expand beyond 3 digits - spec-driven.md: update feature numbering description to include 4-digit example Fixes #2093 Co-authored-by: alex-zwingli <alex-zwingli@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4178b61 commit f92e7e8

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ The `specify` command supports the following options:
337337
| `--debug` | Flag | Enable detailed debug output for troubleshooting |
338338
| `--github-token` | Option | GitHub token for API requests (or set GH_TOKEN/GITHUB_TOKEN env variable) |
339339
| `--ai-skills` | Flag | Install Prompt.MD templates as agent skills in agent-specific `skills/` directory (requires `--ai`). Extension commands are also auto-registered as skills when extensions are added later. |
340-
| `--branch-numbering` | Option | Branch numbering strategy: `sequential` (default — `001`, `002`, `003`) or `timestamp` (`YYYYMMDD-HHMMSS`). Timestamp mode is useful for distributed teams to avoid numbering conflicts |
340+
| `--branch-numbering` | Option | Branch numbering strategy: `sequential` (default — `001`, `002`, `003`, …, `1000`, … — expands beyond 3 digits automatically) or `timestamp` (`YYYYMMDD-HHMMSS`). Timestamp mode is useful for distributed teams to avoid numbering conflicts |
341341

342342
### Examples
343343

spec-driven.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The SDD methodology is significantly enhanced through three powerful commands th
7878

7979
This command transforms a simple feature description (the user-prompt) into a complete, structured specification with automatic repository management:
8080

81-
1. **Automatic Feature Numbering**: Scans existing specs to determine the next feature number (e.g., 001, 002, 003)
81+
1. **Automatic Feature Numbering**: Scans existing specs to determine the next feature number (e.g., 001, 002, 003, …, 1000 — expands beyond 3 digits automatically)
8282
2. **Branch Creation**: Generates a semantic branch name from your description and creates it automatically
8383
3. **Template-Based Generation**: Copies and customizes the feature specification template with your requirements
8484
4. **Directory Structure**: Creates the proper `specs/[branch-name]/` structure for all related documents

src/specify_cli/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ def init(
840840
ai_skills: bool = typer.Option(False, "--ai-skills", help="Install Prompt.MD templates as agent skills (requires --ai)"),
841841
offline: bool = typer.Option(False, "--offline", help="Deprecated (no-op). All scaffolding now uses bundled assets.", hidden=True),
842842
preset: str = typer.Option(None, "--preset", help="Install a preset during initialization (by preset ID)"),
843-
branch_numbering: str = typer.Option(None, "--branch-numbering", help="Branch numbering strategy: 'sequential' (001, 002, ...) or 'timestamp' (YYYYMMDD-HHMMSS)"),
843+
branch_numbering: str = typer.Option(None, "--branch-numbering", help="Branch numbering strategy: 'sequential' (001, 002, …, 1000, … — expands past 999 automatically) or 'timestamp' (YYYYMMDD-HHMMSS)"),
844844
integration: str = typer.Option(None, "--integration", help="Use the new integration system (e.g. --integration copilot). Mutually exclusive with --ai."),
845845
integration_options: str = typer.Option(None, "--integration-options", help='Options for the integration (e.g. --integration-options="--commands-dir .myagent/cmds")'),
846846
):

tests/test_timestamp_branches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def test_sequential_default_with_existing_specs(self, git_repo: Path):
134134
if line.startswith("BRANCH_NAME:"):
135135
branch = line.split(":", 1)[1].strip()
136136
assert branch is not None
137-
assert re.match(r"^\d{3}-new-feat$", branch), f"unexpected branch: {branch}"
137+
assert re.match(r"^\d{3,}-new-feat$", branch), f"unexpected branch: {branch}"
138138

139139
def test_sequential_ignores_timestamp_dirs(self, git_repo: Path):
140140
"""Sequential numbering skips timestamp dirs when computing next number."""
@@ -289,7 +289,7 @@ def test_e2e_sequential(self, git_repo: Path):
289289
capture_output=True,
290290
text=True,
291291
).stdout.strip()
292-
assert re.match(r"^\d{3}-seq-feat$", branch), f"branch: {branch}"
292+
assert re.match(r"^\d{3,}-seq-feat$", branch), f"branch: {branch}"
293293
assert (git_repo / "specs" / branch).is_dir()
294294
val = source_and_call(f'check_feature_branch "{branch}" "true"')
295295
assert val.returncode == 0

0 commit comments

Comments
 (0)