Skip to content

Commit 20fa7e1

Browse files
committed
hide plugin catalog cache ttl
1 parent 79330c3 commit 20fa7e1

8 files changed

Lines changed: 12 additions & 19 deletions

File tree

packages/data-designer/src/data_designer/cli/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ catalogs:
274274
- alias: research
275275
url: https://raw.githubusercontent.com/acme/dd-plugins/main/catalog/plugins.json
276276
trusted: false
277-
cache_ttl_seconds: 86400
278277
```
279278

280279
### `~/.data-designer/plugin-catalog-cache/`

packages/data-designer/src/data_designer/cli/commands/plugin.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,6 @@ def catalog_add_command(
218218
"--trusted",
219219
help="Mark the catalog as trusted for install-plan display and confirmations.",
220220
),
221-
cache_ttl_seconds: int = typer.Option(
222-
24 * 60 * 60,
223-
"--cache-ttl-seconds",
224-
min=0,
225-
help="Seconds before cached catalog metadata is refreshed. Use 0 to always refresh.",
226-
),
227221
) -> None:
228222
"""Add a plugin catalog alias."""
229223
_warn_if_parent_catalog_unused(ctx, "catalog management commands operate on aliases directly")
@@ -232,7 +226,6 @@ def catalog_add_command(
232226
alias=alias,
233227
url=url,
234228
trusted=trusted,
235-
cache_ttl_seconds=cache_ttl_seconds,
236229
)
237230

238231

packages/data-designer/src/data_designer/cli/controllers/plugin_catalog_controller.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,14 +323,12 @@ def run_catalog_list(self) -> None:
323323
table.add_column("Alias", style=NordColor.NORD14.value, no_wrap=True)
324324
table.add_column("URL", style=NordColor.NORD4.value)
325325
table.add_column("Trusted", style=NordColor.NORD13.value, justify="center")
326-
table.add_column("Cache TTL", style=NordColor.NORD9.value, justify="right")
327326

328327
for catalog in catalogs:
329328
table.add_row(
330329
catalog.alias,
331330
catalog.url,
332331
"yes" if catalog.trusted else "no",
333-
f"{catalog.cache_ttl_seconds}s",
334332
)
335333
console.print(table)
336334

@@ -340,15 +338,13 @@ def run_catalog_add(
340338
alias: str,
341339
url: str,
342340
trusted: bool,
343-
cache_ttl_seconds: int,
344341
) -> None:
345342
"""Add a plugin catalog alias."""
346343
try:
347344
catalog = self.catalog_service.add_catalog(
348345
alias,
349346
url,
350347
trusted=trusted,
351-
cache_ttl_seconds=cache_ttl_seconds,
352348
)
353349
except ValidationError as e:
354350
if any(tuple(error["loc"]) == ("alias",) for error in e.errors()):

packages/data-designer/src/data_designer/cli/repositories/plugin_catalog_repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def load(self) -> PluginCatalogRegistry | None:
5959

6060
def save(self, config: PluginCatalogRegistry) -> None:
6161
"""Save user-configured plugin catalogs."""
62-
config_dict = config.model_dump(mode="json", exclude_none=True)
62+
config_dict = config.model_dump(mode="json", exclude_none=True, exclude_defaults=True)
6363
save_config_file(self.config_file, config_dict)
6464

6565
def list_catalogs(self) -> list[PluginCatalogConfig]:

packages/data-designer/src/data_designer/cli/services/plugin_catalog_service.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,12 @@ def add_catalog(
148148
url: str,
149149
*,
150150
trusted: bool,
151-
cache_ttl_seconds: int,
152151
) -> PluginCatalogConfig:
153152
"""Add a plugin catalog alias."""
154153
return self.repository.add_catalog(
155154
alias,
156155
url,
157156
trusted=trusted,
158-
cache_ttl_seconds=cache_ttl_seconds,
159157
)
160158

161159
def remove_catalog(self, alias: str) -> None:

packages/data-designer/tests/cli/commands/test_plugin_command.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ def test_plugin_catalog_add_command_delegates_to_controller(mock_ctrl_cls: Magic
128128
"research",
129129
"https://github.com/acme/dd-plugins",
130130
"--trusted",
131-
"--cache-ttl-seconds",
132-
"60",
133131
],
134132
)
135133

@@ -138,7 +136,6 @@ def test_plugin_catalog_add_command_delegates_to_controller(mock_ctrl_cls: Magic
138136
alias="research",
139137
url="https://github.com/acme/dd-plugins",
140138
trusted=True,
141-
cache_ttl_seconds=60,
142139
)
143140

144141

packages/data-designer/tests/cli/controllers/test_plugin_catalog_controller.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,6 @@ def test_run_catalog_add_wraps_invalid_alias_validation_error(
615615
alias="foo/bar",
616616
url="https://github.com/acme/dd-plugins",
617617
trusted=False,
618-
cache_ttl_seconds=60,
619618
)
620619

621620
assert exc_info.value.exit_code == 1

packages/data-designer/tests/cli/repositories/test_plugin_catalog_repository.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ def test_add_catalog_normalizes_github_repository_url(tmp_path: Path) -> None:
5252
assert repository.get_catalog("research") == catalog
5353

5454

55+
def test_add_catalog_persists_only_public_catalog_fields(tmp_path: Path) -> None:
56+
repository = PluginCatalogRepository(tmp_path)
57+
58+
repository.add_catalog("research", "https://github.com/acme/dd-plugins")
59+
60+
saved_registry = repository.config_file.read_text()
61+
assert "alias: research" in saved_registry
62+
assert "url: https://raw.githubusercontent.com/acme/dd-plugins/main/catalog/plugins.json" in saved_registry
63+
assert "cache_ttl_seconds" not in saved_registry
64+
65+
5566
def test_add_catalog_normalizes_github_tree_url_with_subdirectory(tmp_path: Path) -> None:
5667
repository = PluginCatalogRepository(tmp_path)
5768

0 commit comments

Comments
 (0)