Skip to content

Commit 49a2c53

Browse files
authored
🐛 fix(cli): use DEFAULT_STACK_NAME constant for --name default (#416)
## Summary - CLI hardcoded `"limiter"` as the default for all 28 `--name` options, but `naming.py` defines `DEFAULT_STACK_NAME = "zae-limiter"` as the canonical default - Replaced all occurrences with the `DEFAULT_STACK_NAME` constant and switched to Click's `show_default=True` for help text - Updated 3 test assertions to match the new default ## Test plan - [x] All 2575 unit tests pass - [x] 100% diff coverage - [x] Pre-commit hooks pass (ruff, mypy, ruff-format) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents 481ce44 + bbc3c71 commit 49a2c53

2 files changed

Lines changed: 88 additions & 59 deletions

File tree

src/zae_limiter/cli.py

Lines changed: 85 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from .loadtest.cli import loadtest
1717
from .local import local
1818
from .models import StackOptions
19+
from .naming import DEFAULT_STACK_NAME
1920

2021
if TYPE_CHECKING:
2122
from .models import Limit
@@ -92,8 +93,9 @@ def cli() -> None:
9293
@click.option(
9394
"--name",
9495
"-n",
95-
default="limiter",
96-
help="Resource identifier used as the CloudFormation stack name. Default: limiter",
96+
default=DEFAULT_STACK_NAME,
97+
show_default=True,
98+
help="Resource identifier used as the CloudFormation stack name.",
9799
)
98100
@click.option(
99101
"--region",
@@ -1161,8 +1163,9 @@ async def _list() -> None:
11611163
@click.option(
11621164
"--name",
11631165
"-n",
1164-
default="limiter",
1165-
help="Resource identifier used as the CloudFormation stack name. Default: limiter",
1166+
default=DEFAULT_STACK_NAME,
1167+
show_default=True,
1168+
help="Resource identifier used as the CloudFormation stack name.",
11661169
)
11671170
@click.option(
11681171
"--region",
@@ -1287,8 +1290,9 @@ async def _version() -> None:
12871290
@click.option(
12881291
"--name",
12891292
"-n",
1290-
default="limiter",
1291-
help="Resource identifier used as the CloudFormation stack name. Default: limiter",
1293+
default=DEFAULT_STACK_NAME,
1294+
show_default=True,
1295+
help="Resource identifier used as the CloudFormation stack name.",
12921296
)
12931297
@click.option(
12941298
"--region",
@@ -1436,8 +1440,9 @@ async def _upgrade() -> None:
14361440
@click.option(
14371441
"--name",
14381442
"-n",
1439-
default="limiter",
1440-
help="Resource identifier used as the CloudFormation stack name. Default: limiter",
1443+
default=DEFAULT_STACK_NAME,
1444+
show_default=True,
1445+
help="Resource identifier used as the CloudFormation stack name.",
14411446
)
14421447
@click.option(
14431448
"--region",
@@ -1571,8 +1576,9 @@ def audit() -> None:
15711576
@click.option(
15721577
"--name",
15731578
"-n",
1574-
default="limiter",
1575-
help="Resource identifier used as the CloudFormation stack name. Default: limiter",
1579+
default=DEFAULT_STACK_NAME,
1580+
show_default=True,
1581+
help="Resource identifier used as the CloudFormation stack name.",
15761582
)
15771583
@click.option(
15781584
"--region",
@@ -1718,8 +1724,9 @@ def usage() -> None:
17181724
@click.option(
17191725
"--name",
17201726
"-n",
1721-
default="limiter",
1722-
help="Resource identifier used as the CloudFormation stack name. Default: limiter",
1727+
default=DEFAULT_STACK_NAME,
1728+
show_default=True,
1729+
help="Resource identifier used as the CloudFormation stack name.",
17231730
)
17241731
@click.option(
17251732
"--region",
@@ -1908,8 +1915,9 @@ async def _list() -> None:
19081915
@click.option(
19091916
"--name",
19101917
"-n",
1911-
default="limiter",
1912-
help="Resource identifier used as the CloudFormation stack name. Default: limiter",
1918+
default=DEFAULT_STACK_NAME,
1919+
show_default=True,
1920+
help="Resource identifier used as the CloudFormation stack name.",
19131921
)
19141922
@click.option(
19151923
"--region",
@@ -2159,8 +2167,9 @@ def resource() -> None:
21592167
@click.option(
21602168
"--name",
21612169
"-n",
2162-
default="limiter",
2163-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2170+
default=DEFAULT_STACK_NAME,
2171+
show_default=True,
2172+
help="Stack identifier used as the CloudFormation stack name.",
21642173
)
21652174
@click.option(
21662175
"--region",
@@ -2249,8 +2258,9 @@ async def _set() -> None:
22492258
@click.option(
22502259
"--name",
22512260
"-n",
2252-
default="limiter",
2253-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2261+
default=DEFAULT_STACK_NAME,
2262+
show_default=True,
2263+
help="Stack identifier used as the CloudFormation stack name.",
22542264
)
22552265
@click.option(
22562266
"--region",
@@ -2328,8 +2338,9 @@ async def _get() -> None:
23282338
@click.option(
23292339
"--name",
23302340
"-n",
2331-
default="limiter",
2332-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2341+
default=DEFAULT_STACK_NAME,
2342+
show_default=True,
2343+
help="Stack identifier used as the CloudFormation stack name.",
23332344
)
23342345
@click.option(
23352346
"--region",
@@ -2406,8 +2417,9 @@ async def _delete() -> None:
24062417
@click.option(
24072418
"--name",
24082419
"-n",
2409-
default="limiter",
2410-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2420+
default=DEFAULT_STACK_NAME,
2421+
show_default=True,
2422+
help="Stack identifier used as the CloudFormation stack name.",
24112423
)
24122424
@click.option(
24132425
"--region",
@@ -2496,8 +2508,9 @@ def system() -> None:
24962508
@click.option(
24972509
"--name",
24982510
"-n",
2499-
default="limiter",
2500-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2511+
default=DEFAULT_STACK_NAME,
2512+
show_default=True,
2513+
help="Stack identifier used as the CloudFormation stack name.",
25012514
)
25022515
@click.option(
25032516
"--region",
@@ -2597,8 +2610,9 @@ async def _set() -> None:
25972610
@click.option(
25982611
"--name",
25992612
"-n",
2600-
default="limiter",
2601-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2613+
default=DEFAULT_STACK_NAME,
2614+
show_default=True,
2615+
help="Stack identifier used as the CloudFormation stack name.",
26022616
)
26032617
@click.option(
26042618
"--region",
@@ -2678,8 +2692,9 @@ async def _get() -> None:
26782692
@click.option(
26792693
"--name",
26802694
"-n",
2681-
default="limiter",
2682-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2695+
default=DEFAULT_STACK_NAME,
2696+
show_default=True,
2697+
help="Stack identifier used as the CloudFormation stack name.",
26832698
)
26842699
@click.option(
26852700
"--region",
@@ -2789,8 +2804,9 @@ def entity() -> None:
27892804
@click.option(
27902805
"--name",
27912806
"-n",
2792-
default="limiter",
2793-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2807+
default=DEFAULT_STACK_NAME,
2808+
show_default=True,
2809+
help="Stack identifier used as the CloudFormation stack name.",
27942810
)
27952811
@click.option(
27962812
"--region",
@@ -2868,8 +2884,9 @@ async def _create() -> None:
28682884
@click.option(
28692885
"--name",
28702886
"-n",
2871-
default="limiter",
2872-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2887+
default=DEFAULT_STACK_NAME,
2888+
show_default=True,
2889+
help="Stack identifier used as the CloudFormation stack name.",
28732890
)
28742891
@click.option(
28752892
"--region",
@@ -2959,8 +2976,9 @@ async def _show() -> None:
29592976
@click.option(
29602977
"--name",
29612978
"-n",
2962-
default="limiter",
2963-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
2979+
default=DEFAULT_STACK_NAME,
2980+
show_default=True,
2981+
help="Stack identifier used as the CloudFormation stack name.",
29642982
)
29652983
@click.option(
29662984
"--region",
@@ -3060,8 +3078,9 @@ async def _set() -> None:
30603078
@click.option(
30613079
"--name",
30623080
"-n",
3063-
default="limiter",
3064-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
3081+
default=DEFAULT_STACK_NAME,
3082+
show_default=True,
3083+
help="Stack identifier used as the CloudFormation stack name.",
30653084
)
30663085
@click.option(
30673086
"--region",
@@ -3149,8 +3168,9 @@ async def _get() -> None:
31493168
@click.option(
31503169
"--name",
31513170
"-n",
3152-
default="limiter",
3153-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
3171+
default=DEFAULT_STACK_NAME,
3172+
show_default=True,
3173+
help="Stack identifier used as the CloudFormation stack name.",
31543174
)
31553175
@click.option(
31563176
"--region",
@@ -3244,8 +3264,9 @@ async def _delete() -> None:
32443264
@click.option(
32453265
"--name",
32463266
"-n",
3247-
default="limiter",
3248-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
3267+
default=DEFAULT_STACK_NAME,
3268+
show_default=True,
3269+
help="Stack identifier used as the CloudFormation stack name.",
32493270
)
32503271
@click.option(
32513272
"--region",
@@ -3326,8 +3347,9 @@ async def _list() -> None:
33263347
@click.option(
33273348
"--name",
33283349
"-n",
3329-
default="limiter",
3330-
help="Stack identifier used as the CloudFormation stack name. Default: limiter",
3350+
default=DEFAULT_STACK_NAME,
3351+
show_default=True,
3352+
help="Stack identifier used as the CloudFormation stack name.",
33313353
)
33323354
@click.option(
33333355
"--region",
@@ -3416,8 +3438,9 @@ def namespace() -> None:
34163438
@click.option(
34173439
"--name",
34183440
"-n",
3419-
default="limiter",
3420-
help="Stack identifier. Default: limiter",
3441+
default=DEFAULT_STACK_NAME,
3442+
show_default=True,
3443+
help="Stack identifier.",
34213444
)
34223445
@click.option(
34233446
"--region",
@@ -3481,8 +3504,9 @@ async def _register() -> None:
34813504
@click.option(
34823505
"--name",
34833506
"-n",
3484-
default="limiter",
3485-
help="Stack identifier. Default: limiter",
3507+
default=DEFAULT_STACK_NAME,
3508+
show_default=True,
3509+
help="Stack identifier.",
34863510
)
34873511
@click.option(
34883512
"--region",
@@ -3543,8 +3567,9 @@ async def _list() -> None:
35433567
@click.option(
35443568
"--name",
35453569
"-n",
3546-
default="limiter",
3547-
help="Stack identifier. Default: limiter",
3570+
default=DEFAULT_STACK_NAME,
3571+
show_default=True,
3572+
help="Stack identifier.",
35483573
)
35493574
@click.option(
35503575
"--region",
@@ -3607,8 +3632,9 @@ async def _show() -> None:
36073632
@click.option(
36083633
"--name",
36093634
"-n",
3610-
default="limiter",
3611-
help="Stack identifier. Default: limiter",
3635+
default=DEFAULT_STACK_NAME,
3636+
show_default=True,
3637+
help="Stack identifier.",
36123638
)
36133639
@click.option(
36143640
"--region",
@@ -3678,8 +3704,9 @@ async def _delete() -> None:
36783704
@click.option(
36793705
"--name",
36803706
"-n",
3681-
default="limiter",
3682-
help="Stack identifier. Default: limiter",
3707+
default=DEFAULT_STACK_NAME,
3708+
show_default=True,
3709+
help="Stack identifier.",
36833710
)
36843711
@click.option(
36853712
"--region",
@@ -3740,8 +3767,9 @@ async def _recover() -> None:
37403767
@click.option(
37413768
"--name",
37423769
"-n",
3743-
default="limiter",
3744-
help="Stack identifier. Default: limiter",
3770+
default=DEFAULT_STACK_NAME,
3771+
show_default=True,
3772+
help="Stack identifier.",
37453773
)
37463774
@click.option(
37473775
"--region",
@@ -3802,8 +3830,9 @@ async def _orphans() -> None:
38023830
@click.option(
38033831
"--name",
38043832
"-n",
3805-
default="limiter",
3806-
help="Stack identifier. Default: limiter",
3833+
default=DEFAULT_STACK_NAME,
3834+
show_default=True,
3835+
help="Stack identifier.",
38073836
)
38083837
@click.option(
38093838
"--region",

tests/unit/test_cli.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,7 +1891,7 @@ def test_audit_list_with_endpoint_url(self, mock_repo_class: Mock, runner: CliRu
18911891

18921892
assert result.exit_code == 0
18931893
mock_repo_class.open.assert_called_once_with(
1894-
"default", stack="limiter", region="us-east-1", endpoint_url="http://localhost:4566"
1894+
"default", stack="zae-limiter", region="us-east-1", endpoint_url="http://localhost:4566"
18951895
)
18961896

18971897
@patch("zae_limiter.repository.Repository")
@@ -4449,7 +4449,7 @@ def test_entity_set_limits_with_region(self, mock_repo_class: Mock, runner: CliR
44494449
assert result.exit_code == 0
44504450
# Verify Repository was called with region
44514451
mock_repo_class.open.assert_called_once_with(
4452-
"default", stack="limiter", region="us-west-2", endpoint_url=None
4452+
"default", stack="zae-limiter", region="us-west-2", endpoint_url=None
44534453
)
44544454

44554455
@patch("zae_limiter.repository.Repository")
@@ -4481,7 +4481,7 @@ def test_entity_set_limits_with_endpoint_url(
44814481
assert result.exit_code == 0
44824482
# Verify Repository was called with endpoint_url
44834483
mock_repo_class.open.assert_called_once_with(
4484-
"default", stack="limiter", region=None, endpoint_url="http://localhost:4566"
4484+
"default", stack="zae-limiter", region=None, endpoint_url="http://localhost:4566"
44854485
)
44864486

44874487
def test_entity_set_limits_repo_init_validation_error(self, runner: CliRunner) -> None:

0 commit comments

Comments
 (0)