simple-module-core 0.0.42__tar.gz → 0.0.44__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/.gitignore +3 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/PKG-INFO +2 -2
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/pyproject.toml +2 -2
- simple_module_core-0.0.44/simple_module_core/diagnostics/_durable_names.py +71 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_module.py +2 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/invalidation.py +1 -1
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/leases.py +17 -4
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/secret_fields.py +13 -2
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/settings_base.py +1 -1
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/settings_hydrate.py +6 -1
- simple_module_core-0.0.44/simple_module_core/singleflight.py +96 -0
- simple_module_core-0.0.44/tests/test_core_settings_source_cache.py +45 -0
- simple_module_core-0.0.44/tests/test_core_singleflight.py +100 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_sm003_page_render.py +2 -2
- simple_module_core-0.0.44/tests/test_sm034_durable_names.py +53 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/LICENSE +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/README.md +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/__init__.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/__main__.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_data_doctor.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_i18n_flatten.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_i18n_translator.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_permission_grants.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_request_hooks.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/activity_feed.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/app_state.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/audit_links.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/body_limits.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/correlation.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/cors.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/csp.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/data_compatibility.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/datetimes.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/deprecation.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/design_packs.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/__init__.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_coupling.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_css.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_db_extensions.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_dependencies.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_expression_index.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_heavy_task_imports.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_i18n.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_inertia_api.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_js_workspace.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_migration.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_pages.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_runner.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_spa_mount.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_tenancy.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_types.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/discovery.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/dotenv.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/durable_events.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/environments.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/events.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/exceptions.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/feature_flags.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/health.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/i18n.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/i18n_overrides.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/invalidation_refresh.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/mail.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/menu.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/module.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/module_meta.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/module_settings.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/path_rules.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/permission_denied.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/permissions.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/public_routes.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/py.typed +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/rate_limit.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/redirect_safety.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/resources.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/services.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/setup_steps.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/spa_mount.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/stored_settings.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/tenancy.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/tenant_events.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/user_directory.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/user_events.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/versioning.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_audit_links.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_auth_provider_selection.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_app_state.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_data_compatibility_doctor.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_datetimes.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_inline_delivery_context.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_invalidation_refresh.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_leases.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_lifecycle_docs.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_mail_resolution.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_module_settings.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_user_directory.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_csp_registry.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_css_diagnostics.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_css_scanner.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_db_extensions_diagnostics.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_deprecation_helper.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_design_packs.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_diagnostics.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_diagnostics_tenancy.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_discovery.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_discovery_missing_deps.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_doctor_cli_overrides.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_dotenv.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_durable_events.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_environments.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_events.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_events_inline.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_expression_index_diagnostics.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_feature_flags.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_feature_flags_decorator.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_health_registry.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_heavy_task_imports_diagnostics.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_i18n.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_i18n_diagnostics.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_i18n_overrides.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_invalidation.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_invalidation_handlers.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_menu.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_module_base.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_module_diagnostics.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_path_rule_registries.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_permission_sources.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_permissions.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_permissions_admin_principal.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_public_routes.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_public_routes_rate_precedence.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_redirect_safety.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_services.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_settings_base.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_sm009_dynamic_coupling.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_tenant_exists.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_tenant_roles.py +0 -0
- {simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_versioning.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: simple_module_core
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.44
|
|
4
4
|
Summary: Module-system primitives for the simple_module framework — ModuleBase, discovery, diagnostics, events
|
|
5
5
|
Project-URL: Homepage, https://github.com/antosubash/simple_module_python
|
|
6
6
|
Project-URL: Repository, https://github.com/antosubash/simple_module_python
|
|
@@ -22,7 +22,7 @@ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
|
22
22
|
Classifier: Typing :: Typed
|
|
23
23
|
Requires-Python: >=3.12
|
|
24
24
|
Requires-Dist: babel<3,>=2.14
|
|
25
|
-
Requires-Dist: fastapi<0.
|
|
25
|
+
Requires-Dist: fastapi<0.163,>=0.140
|
|
26
26
|
Requires-Dist: packaging<27,>=23.0
|
|
27
27
|
Requires-Dist: pydantic-settings<3,>=2.0
|
|
28
28
|
Requires-Dist: pydantic<3,>=2.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "simple_module_core"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.44"
|
|
4
4
|
description = "Module-system primitives for the simple_module framework — ModuleBase, discovery, diagnostics, events"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
]
|
|
23
23
|
dependencies = [
|
|
24
24
|
"babel>=2.14,<3",
|
|
25
|
-
"fastapi>=0.140,<0.
|
|
25
|
+
"fastapi>=0.140,<0.163",
|
|
26
26
|
"packaging>=23.0,<27",
|
|
27
27
|
"pydantic>=2.0,<3",
|
|
28
28
|
"pydantic-settings>=2.0,<3",
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"""SM034: flag a ``subscribe_durable(...)`` call without an explicit ``name=``.
|
|
2
|
+
|
|
3
|
+
A durable handler's outbox rows are keyed by its name, which defaults to the
|
|
4
|
+
handler's import path. Moving or renaming the handler module silently strands
|
|
5
|
+
every undelivered row (it retries as an unknown handler, then goes ``dead``).
|
|
6
|
+
Uses ``ast`` and never imports the module being checked.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import ast
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from typing import TYPE_CHECKING
|
|
14
|
+
|
|
15
|
+
from simple_module_core.diagnostics._types import Diagnostic, DiagnosticLevel
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from simple_module_core.module import ModuleBase
|
|
19
|
+
|
|
20
|
+
_SKIP_DIRS = frozenset({"tests", "node_modules", "__pycache__"})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _is_unnamed_subscribe(node: ast.AST) -> bool:
|
|
24
|
+
if not isinstance(node, ast.Call):
|
|
25
|
+
return False
|
|
26
|
+
func = node.func
|
|
27
|
+
called = func.attr if isinstance(func, ast.Attribute) else getattr(func, "id", None)
|
|
28
|
+
if called != "subscribe_durable":
|
|
29
|
+
return False
|
|
30
|
+
# A ``**kwargs`` spread may carry ``name``; give it the benefit of the doubt.
|
|
31
|
+
return not any(kw.arg is None or kw.arg == "name" for kw in node.keywords)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _source_files(src_dir: Path) -> list[Path]:
|
|
35
|
+
return sorted(
|
|
36
|
+
p
|
|
37
|
+
for p in src_dir.rglob("*.py")
|
|
38
|
+
if not _SKIP_DIRS.intersection(p.relative_to(src_dir).parts)
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def check_durable_names(mod: ModuleBase, src_dir: Path) -> list[Diagnostic]:
|
|
43
|
+
"""Warn on each ``subscribe_durable`` call in the package that omits ``name=``."""
|
|
44
|
+
diags: list[Diagnostic] = []
|
|
45
|
+
for path in _source_files(src_dir):
|
|
46
|
+
try:
|
|
47
|
+
tree = ast.parse(path.read_text(), filename=str(path))
|
|
48
|
+
except (OSError, SyntaxError, UnicodeDecodeError):
|
|
49
|
+
continue
|
|
50
|
+
for node in ast.walk(tree):
|
|
51
|
+
if not _is_unnamed_subscribe(node):
|
|
52
|
+
continue
|
|
53
|
+
diags.append(
|
|
54
|
+
Diagnostic(
|
|
55
|
+
level=DiagnosticLevel.WARNING,
|
|
56
|
+
code="SM034",
|
|
57
|
+
message=(
|
|
58
|
+
"subscribe_durable(...) has no name= — the default name is the "
|
|
59
|
+
"handler's import path, so moving or renaming the handler strands "
|
|
60
|
+
"its undelivered outbox rows"
|
|
61
|
+
),
|
|
62
|
+
module_name=mod.meta.name,
|
|
63
|
+
file=f"{path}:{node.lineno}",
|
|
64
|
+
suggestion=(
|
|
65
|
+
"Pass name= with a constant from constants.py whose value is the "
|
|
66
|
+
"current default name (module.path.function), so delivery state "
|
|
67
|
+
"survives refactors."
|
|
68
|
+
),
|
|
69
|
+
)
|
|
70
|
+
)
|
|
71
|
+
return diags
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_module.py
RENAMED
|
@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
|
|
|
9
9
|
from simple_module_core.diagnostics._coupling import check_framework_module_coupling
|
|
10
10
|
from simple_module_core.diagnostics._css import check_module_css
|
|
11
11
|
from simple_module_core.diagnostics._dependencies import check_missing_dependencies
|
|
12
|
+
from simple_module_core.diagnostics._durable_names import check_durable_names
|
|
12
13
|
from simple_module_core.diagnostics._heavy_task_imports import check_heavy_task_imports
|
|
13
14
|
from simple_module_core.diagnostics._inertia_api import check_inertia_api_calls
|
|
14
15
|
from simple_module_core.diagnostics._js_workspace import check_js_workspace_files
|
|
@@ -48,6 +49,7 @@ class ModuleDiagnostics:
|
|
|
48
49
|
diagnostics.extend(check_inertia_api_calls(mod, src_dir))
|
|
49
50
|
diagnostics.extend(check_module_css(mod, src_dir))
|
|
50
51
|
diagnostics.extend(check_heavy_task_imports(mod, src_dir))
|
|
52
|
+
diagnostics.extend(check_durable_names(mod, src_dir))
|
|
51
53
|
|
|
52
54
|
return diagnostics
|
|
53
55
|
|
|
@@ -86,7 +86,7 @@ class Invalidation:
|
|
|
86
86
|
channel: str
|
|
87
87
|
#: Which entry, or ``None`` for "the whole channel". A string because it has
|
|
88
88
|
#: to survive JSON; a consumer keyed by something else converts on the way
|
|
89
|
-
#: back in (see ``users.session_revocation``).
|
|
89
|
+
#: back in (see ``users.accounts.session_revocation``).
|
|
90
90
|
key: str | None = None
|
|
91
91
|
#: The publishing process's :attr:`InvalidationBus.origin`. Lets a bus
|
|
92
92
|
#: ignore its own broadcast coming back off the transport, which it has
|
|
@@ -20,13 +20,14 @@ The backend is process-global (Celery workers have no ``app.state``): the host
|
|
|
20
20
|
installs one with :func:`configure_leases` when the app is built and when a
|
|
21
21
|
worker boots — Redis when ``SM_REDIS_URL`` is set, else the ``sm_lease`` table,
|
|
22
22
|
else :class:`InProcessLeaseBackend`, which only coordinates one process.
|
|
23
|
-
|
|
24
|
-
as held.
|
|
23
|
+
Acquire timeouts and connectivity failures log a warning and return False.
|
|
24
|
+
Other backend errors propagate; an unconfirmed lease is never reported as held.
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
from __future__ import annotations
|
|
28
28
|
|
|
29
29
|
import asyncio
|
|
30
|
+
import logging
|
|
30
31
|
import random
|
|
31
32
|
import threading
|
|
32
33
|
import time
|
|
@@ -50,6 +51,10 @@ __all__ = [
|
|
|
50
51
|
# Seconds between attempts while waiting for a held lease.
|
|
51
52
|
_POLL = 0.05
|
|
52
53
|
_POLL_MAX = 0.5
|
|
54
|
+
# Shortest deadline one acquire attempt gets, even when the wait has run out:
|
|
55
|
+
# ``wait=0`` means "don't queue", not "fail a healthy backend that takes 60 ms".
|
|
56
|
+
_ATTEMPT_FLOOR = 1.0
|
|
57
|
+
logger = logging.getLogger(__name__)
|
|
53
58
|
|
|
54
59
|
|
|
55
60
|
class LeaseNotAcquiredError(RuntimeError):
|
|
@@ -62,7 +67,8 @@ class LeaseBackend(Protocol):
|
|
|
62
67
|
``acquire``/``semaphore_acquire`` return the new fence number, or ``None``
|
|
63
68
|
when the lease (or every slot) is held by someone else. ``refresh`` and
|
|
64
69
|
``release`` return ``False`` when *token* no longer holds it — expired,
|
|
65
|
-
released, or taken by another owner.
|
|
70
|
+
released, or taken by another owner. Connectivity failures during acquire
|
|
71
|
+
should raise built-in ConnectionError; release may log and return False.
|
|
66
72
|
"""
|
|
67
73
|
|
|
68
74
|
async def acquire(self, name: str, token: str, ttl: float) -> int | None: ...
|
|
@@ -216,7 +222,14 @@ class Lease:
|
|
|
216
222
|
deadline = None if wait is None else time.monotonic() + wait
|
|
217
223
|
delay = _POLL
|
|
218
224
|
while True:
|
|
219
|
-
|
|
225
|
+
remaining = (
|
|
226
|
+
None if deadline is None else max(_ATTEMPT_FLOOR, deadline - time.monotonic())
|
|
227
|
+
)
|
|
228
|
+
try:
|
|
229
|
+
fence = await asyncio.wait_for(self._try(), remaining)
|
|
230
|
+
except (TimeoutError, ConnectionError):
|
|
231
|
+
logger.warning("Lease %r acquire timed out or backend unavailable", self.name)
|
|
232
|
+
return False
|
|
220
233
|
if fence is not None:
|
|
221
234
|
self.fence = fence
|
|
222
235
|
return True
|
|
@@ -9,7 +9,7 @@ longer depends on the ``settings`` plugin being installed or enabled.
|
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
11
11
|
import re
|
|
12
|
-
from typing import Any, get_args, get_origin
|
|
12
|
+
from typing import Any, Final, get_args, get_origin
|
|
13
13
|
from urllib.parse import urlsplit
|
|
14
14
|
|
|
15
15
|
from pydantic import BaseModel, SecretBytes, SecretStr
|
|
@@ -20,7 +20,15 @@ from pydantic import BaseModel, SecretBytes, SecretStr
|
|
|
20
20
|
_SECRET_PATTERNS = re.compile(
|
|
21
21
|
r"(password|secret|api[_-]?key|private[_-]?key|token[_-]?secret)", re.I
|
|
22
22
|
)
|
|
23
|
+
|
|
23
24
|
SECRET_MASK = "••••••••"
|
|
25
|
+
# Keys whose stored value must never leave the settings API, the raw
|
|
26
|
+
# key/value browse screen or the audit trail. ``host.secret_key`` is the session-signing key: the
|
|
27
|
+
# hosting layer generates and persists it here when SM_SECRET_KEY is unset, and
|
|
28
|
+
# anyone who can read it can forge a session cookie for any account. Masked on
|
|
29
|
+
# the way out only — the boot-time reader goes straight to SQL, so hiding it
|
|
30
|
+
# here costs nothing.
|
|
31
|
+
SENSITIVE_KEYS: Final = frozenset({"host.secret_key"})
|
|
24
32
|
|
|
25
33
|
# Value types that cannot carry credential material, so a secret-ish *name*
|
|
26
34
|
# on one of them is a false positive rather than something to hide.
|
|
@@ -92,7 +100,10 @@ def conceals_secret(name: str, value: Any, value_type: str | None = None) -> boo
|
|
|
92
100
|
``broker_url``, while that field's password-free default is still shown.
|
|
93
101
|
"""
|
|
94
102
|
return (
|
|
95
|
-
name in
|
|
103
|
+
name in SENSITIVE_KEYS
|
|
104
|
+
or name in _TYPED_SECRET_KEYS
|
|
105
|
+
or is_named_secret(name, value_type)
|
|
106
|
+
or embeds_credential(value)
|
|
96
107
|
)
|
|
97
108
|
|
|
98
109
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Base class for DB-backed settings that must not read the environment.
|
|
2
2
|
|
|
3
3
|
Module and host settings are hydrated from the settings store at boot and
|
|
4
|
-
hot-swapped through ``settings.reload.apply_changes_and_reload``. The DB is
|
|
4
|
+
hot-swapped through ``settings.module_settings.reload.apply_changes_and_reload``. The DB is
|
|
5
5
|
meant to be the only source of truth for them.
|
|
6
6
|
|
|
7
7
|
Subclassing ``BaseSettings`` and simply omitting ``env_prefix`` does **not**
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/settings_hydrate.py
RENAMED
|
@@ -18,6 +18,7 @@ from __future__ import annotations
|
|
|
18
18
|
|
|
19
19
|
import logging
|
|
20
20
|
import types
|
|
21
|
+
from functools import cache
|
|
21
22
|
from typing import Any, Literal, Protocol, Union, get_args, get_origin
|
|
22
23
|
|
|
23
24
|
from pydantic import BaseModel
|
|
@@ -105,6 +106,7 @@ def input_type_for_field(cls: type[BaseSettings], field_name: str) -> tuple[str,
|
|
|
105
106
|
return "json", nullable
|
|
106
107
|
|
|
107
108
|
|
|
109
|
+
@cache
|
|
108
110
|
def env_supplied_fields(cls: type[BaseSettings]) -> frozenset[str]:
|
|
109
111
|
"""Fields the class's own non-init sources (env, ``.env``, secrets) answer.
|
|
110
112
|
|
|
@@ -114,6 +116,9 @@ def env_supplied_fields(cls: type[BaseSettings]) -> frozenset[str]:
|
|
|
114
116
|
model validator can reject the env-only view (a production broker check)
|
|
115
117
|
that the DB-merged one would pass.
|
|
116
118
|
|
|
119
|
+
Cached per class for the process lifetime: environment, dotenv and secret
|
|
120
|
+
files must be configured before first use; changes require a restart.
|
|
121
|
+
|
|
117
122
|
A class with no ``env_prefix`` reports nothing from its sources: a plain
|
|
118
123
|
``BaseSettings`` reads bare, case-insensitive names, so a field called
|
|
119
124
|
``user``, ``home`` or ``path`` would be pinned by the process environment
|
|
@@ -128,7 +133,7 @@ def env_supplied_fields(cls: type[BaseSettings]) -> frozenset[str]:
|
|
|
128
133
|
seeded = getattr(cls, "env_seeded_fields", None)
|
|
129
134
|
if callable(seeded):
|
|
130
135
|
found.update(seeded())
|
|
131
|
-
return frozenset(found
|
|
136
|
+
return frozenset(found & cls.model_fields.keys())
|
|
132
137
|
|
|
133
138
|
|
|
134
139
|
def _source_supplied_fields(cls: type[BaseSettings]) -> set[str]:
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"""Serialize cache fills per key, and fill caches without storing stale reads.
|
|
2
|
+
|
|
3
|
+
``SingleFlight`` serializes concurrent misses for one key; callers recheck their
|
|
4
|
+
cache inside the lock. Own one instance per application/cache. No background
|
|
5
|
+
task outlives its caller: failed or cancelled fills release the lock and the
|
|
6
|
+
next waiter retries normally.
|
|
7
|
+
|
|
8
|
+
``fill`` is the epoch-checked read loop shared by caches that an invalidation
|
|
9
|
+
can drop mid-read: a read only gets stored if no invalidation landed while it
|
|
10
|
+
ran.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import asyncio
|
|
16
|
+
from collections.abc import AsyncGenerator, Awaitable, Callable, Hashable
|
|
17
|
+
from contextlib import asynccontextmanager
|
|
18
|
+
from dataclasses import dataclass, field
|
|
19
|
+
from enum import Enum
|
|
20
|
+
from typing import Final, Literal
|
|
21
|
+
|
|
22
|
+
# Epoch-checked fills retry at most this many reads; continuous invalidation
|
|
23
|
+
# must not keep a request looping.
|
|
24
|
+
MAX_FILL_ATTEMPTS = 3
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Miss(Enum):
|
|
28
|
+
"""Type of :data:`MISS`; a cache lookup's "nothing cached" answer."""
|
|
29
|
+
|
|
30
|
+
MISS = "miss"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
MISS: Final = Miss.MISS
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _nothing_cached() -> Literal[Miss.MISS]:
|
|
37
|
+
return MISS
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
async def fill[T](
|
|
41
|
+
read: Callable[[], Awaitable[T]],
|
|
42
|
+
*,
|
|
43
|
+
epoch: Callable[[], int],
|
|
44
|
+
store: Callable[[T], None],
|
|
45
|
+
cached: Callable[[], T | Literal[Miss.MISS]] = _nothing_cached,
|
|
46
|
+
) -> T:
|
|
47
|
+
"""Read through *read* and *store* the result unless invalidated meanwhile.
|
|
48
|
+
|
|
49
|
+
*epoch* returns the cache's invalidation counter (bumped by every forget);
|
|
50
|
+
a read whose epoch changed while it ran is not stored and is retried, after
|
|
51
|
+
rechecking *cached* (return :data:`MISS` when nothing is cached; ``None``
|
|
52
|
+
is a valid cached value). At most :data:`MAX_FILL_ATTEMPTS` reads.
|
|
53
|
+
|
|
54
|
+
After the last attempt the last read is returned uncached. It is **not**
|
|
55
|
+
guaranteed to be newer than an invalidation that landed during it: it is
|
|
56
|
+
equivalent to an uncached read racing a concurrent change, so the caller
|
|
57
|
+
answers this one request with it, and it is never cached.
|
|
58
|
+
"""
|
|
59
|
+
attempts = 0
|
|
60
|
+
while True:
|
|
61
|
+
hit = cached()
|
|
62
|
+
if hit is not MISS:
|
|
63
|
+
return hit
|
|
64
|
+
started = epoch()
|
|
65
|
+
value = await read()
|
|
66
|
+
attempts += 1
|
|
67
|
+
if epoch() == started:
|
|
68
|
+
store(value)
|
|
69
|
+
return value
|
|
70
|
+
if attempts >= MAX_FILL_ATTEMPTS:
|
|
71
|
+
return value
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass
|
|
75
|
+
class _Flight:
|
|
76
|
+
lock: asyncio.Lock = field(default_factory=asyncio.Lock)
|
|
77
|
+
users: int = 0
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class SingleFlight:
|
|
81
|
+
def __init__(self) -> None:
|
|
82
|
+
self._locks: dict[Hashable, _Flight] = {}
|
|
83
|
+
|
|
84
|
+
@asynccontextmanager
|
|
85
|
+
async def hold(self, key: Hashable) -> AsyncGenerator[None]:
|
|
86
|
+
flight = self._locks.get(key)
|
|
87
|
+
if flight is None:
|
|
88
|
+
flight = self._locks[key] = _Flight()
|
|
89
|
+
flight.users += 1
|
|
90
|
+
try:
|
|
91
|
+
async with flight.lock:
|
|
92
|
+
yield
|
|
93
|
+
finally:
|
|
94
|
+
flight.users -= 1
|
|
95
|
+
if not flight.users:
|
|
96
|
+
del self._locks[key]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Settings source metadata is a process snapshot, isolated by settings class."""
|
|
2
|
+
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
5
|
+
from simple_module_core.settings_hydrate import env_supplied_fields
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def test_source_fields_are_computed_once_per_class(tmp_path, monkeypatch):
|
|
9
|
+
dotenv = tmp_path / "settings.env"
|
|
10
|
+
dotenv.write_text("CACHE_FILE=file\n")
|
|
11
|
+
monkeypatch.setenv("CACHE_PROCESS", "process")
|
|
12
|
+
calls = []
|
|
13
|
+
|
|
14
|
+
class Config(BaseSettings):
|
|
15
|
+
model_config = SettingsConfigDict(env_prefix="CACHE_", env_file=dotenv)
|
|
16
|
+
process: str = ""
|
|
17
|
+
file: str = ""
|
|
18
|
+
seeded: str = ""
|
|
19
|
+
alias: str = Field("", alias="CACHE_ALIAS")
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def settings_customise_sources(cls, *args, **kwargs):
|
|
23
|
+
calls.append("sources")
|
|
24
|
+
return super().settings_customise_sources(*args, **kwargs)
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def env_seeded_fields(cls):
|
|
28
|
+
calls.append("seeded")
|
|
29
|
+
return {"seeded", "unknown"}
|
|
30
|
+
|
|
31
|
+
monkeypatch.setenv("CACHE_ALIAS", "alias")
|
|
32
|
+
assert env_supplied_fields(Config) == {"process", "file", "seeded", "alias"}
|
|
33
|
+
assert isinstance(env_supplied_fields(Config), frozenset)
|
|
34
|
+
dotenv.unlink()
|
|
35
|
+
monkeypatch.delenv("CACHE_PROCESS")
|
|
36
|
+
monkeypatch.delenv("CACHE_ALIAS")
|
|
37
|
+
assert env_supplied_fields(Config) == {"process", "file", "seeded", "alias"}
|
|
38
|
+
assert calls == ["sources", "seeded"]
|
|
39
|
+
|
|
40
|
+
class Other(Config):
|
|
41
|
+
@classmethod
|
|
42
|
+
def env_seeded_fields(cls):
|
|
43
|
+
return set()
|
|
44
|
+
|
|
45
|
+
assert env_supplied_fields(Other) == set()
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Single-flight locks survive failures/cancellation and release idle keys."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
from simple_module_core.singleflight import MAX_FILL_ATTEMPTS, MISS, SingleFlight, fill
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@pytest.mark.parametrize("cancel_leader", [False, True])
|
|
10
|
+
async def test_failure_or_cancellation_allows_next_reader(cancel_leader):
|
|
11
|
+
flight = SingleFlight()
|
|
12
|
+
started, release = asyncio.Event(), asyncio.Event()
|
|
13
|
+
|
|
14
|
+
async def leader():
|
|
15
|
+
async with flight.hold("key"):
|
|
16
|
+
started.set()
|
|
17
|
+
await release.wait()
|
|
18
|
+
raise ValueError("failed read")
|
|
19
|
+
|
|
20
|
+
async def follower():
|
|
21
|
+
async with flight.hold("key"):
|
|
22
|
+
return "fresh"
|
|
23
|
+
|
|
24
|
+
first = asyncio.create_task(leader())
|
|
25
|
+
await started.wait()
|
|
26
|
+
second = asyncio.create_task(follower())
|
|
27
|
+
await asyncio.sleep(0)
|
|
28
|
+
if cancel_leader:
|
|
29
|
+
first.cancel()
|
|
30
|
+
else:
|
|
31
|
+
release.set()
|
|
32
|
+
with pytest.raises(asyncio.CancelledError if cancel_leader else ValueError):
|
|
33
|
+
await first
|
|
34
|
+
assert await second == "fresh"
|
|
35
|
+
assert not flight._locks
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
async def test_cancelled_waiter_does_not_unlock_leader_or_leak_key():
|
|
39
|
+
flight = SingleFlight()
|
|
40
|
+
entered = asyncio.Event()
|
|
41
|
+
|
|
42
|
+
async def waiter():
|
|
43
|
+
async with flight.hold("key"):
|
|
44
|
+
entered.set()
|
|
45
|
+
|
|
46
|
+
async with flight.hold("key"):
|
|
47
|
+
task = asyncio.create_task(waiter())
|
|
48
|
+
await asyncio.sleep(0)
|
|
49
|
+
task.cancel()
|
|
50
|
+
with pytest.raises(asyncio.CancelledError):
|
|
51
|
+
await task
|
|
52
|
+
assert not entered.is_set()
|
|
53
|
+
async with flight.hold("different"):
|
|
54
|
+
pass
|
|
55
|
+
assert not flight._locks
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
async def test_fill_stores_a_read_no_invalidation_raced():
|
|
59
|
+
stored = []
|
|
60
|
+
|
|
61
|
+
async def read():
|
|
62
|
+
return "value"
|
|
63
|
+
|
|
64
|
+
assert await fill(read, epoch=lambda: 0, store=stored.append) == "value"
|
|
65
|
+
assert stored == ["value"]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def test_fill_returns_a_cached_none_without_reading():
|
|
69
|
+
async def read():
|
|
70
|
+
raise AssertionError("must not read")
|
|
71
|
+
|
|
72
|
+
assert await fill(read, epoch=lambda: 0, store=lambda _value: None, cached=lambda: None) is None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
async def test_fill_retries_then_answers_uncached_under_continuous_invalidation():
|
|
76
|
+
epoch, stored, reads = [0], [], []
|
|
77
|
+
|
|
78
|
+
async def read():
|
|
79
|
+
reads.append(len(reads))
|
|
80
|
+
epoch[0] += 1 # every read races an invalidation
|
|
81
|
+
return len(reads)
|
|
82
|
+
|
|
83
|
+
result = await fill(read, epoch=lambda: epoch[0], store=stored.append, cached=lambda: MISS)
|
|
84
|
+
assert result == MAX_FILL_ATTEMPTS
|
|
85
|
+
assert len(reads) == MAX_FILL_ATTEMPTS
|
|
86
|
+
assert stored == []
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
async def test_fill_rechecks_the_cache_before_retrying():
|
|
90
|
+
epoch, cache = [0], {}
|
|
91
|
+
|
|
92
|
+
async def read():
|
|
93
|
+
epoch[0] += 1
|
|
94
|
+
cache["k"] = "filled-by-another-reader"
|
|
95
|
+
return "raced"
|
|
96
|
+
|
|
97
|
+
result = await fill(
|
|
98
|
+
read, epoch=lambda: epoch[0], store=lambda _value: None, cached=lambda: cache.get("k", MISS)
|
|
99
|
+
)
|
|
100
|
+
assert result == "filled-by-another-reader"
|
|
@@ -39,7 +39,7 @@ class TestSm003PageRenderResolution:
|
|
|
39
39
|
endpoints = src_dir / "endpoints"
|
|
40
40
|
endpoints.mkdir()
|
|
41
41
|
(endpoints / "views.py").write_text(
|
|
42
|
-
"from feature_flags.constants import PAGE_BROWSE\n"
|
|
42
|
+
"from feature_flags.core.constants import PAGE_BROWSE\n"
|
|
43
43
|
"async def view(inertia):\n"
|
|
44
44
|
" return await inertia.render(PAGE_BROWSE, {})\n"
|
|
45
45
|
)
|
|
@@ -74,7 +74,7 @@ class TestSm003PageRenderResolution:
|
|
|
74
74
|
endpoints = src_dir / "endpoints"
|
|
75
75
|
endpoints.mkdir()
|
|
76
76
|
(endpoints / "views.py").write_text(
|
|
77
|
-
"from audit_log.constants import PAGE_BROWSE\n"
|
|
77
|
+
"from audit_log.core.constants import PAGE_BROWSE\n"
|
|
78
78
|
"async def view(inertia):\n"
|
|
79
79
|
" return await inertia.render(PAGE_BROWSE, {})\n"
|
|
80
80
|
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""SM034: ``subscribe_durable`` without an explicit ``name=``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from simple_module_core.diagnostics._durable_names import check_durable_names
|
|
9
|
+
from simple_module_core.diagnostics._types import DiagnosticLevel
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class _Meta:
|
|
14
|
+
name: str = "Orders"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class _Mod:
|
|
19
|
+
meta: _Meta
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _run(tmp_path: Path, source: str, filename: str = "module.py"):
|
|
23
|
+
(tmp_path / filename).write_text(source)
|
|
24
|
+
return check_durable_names(_Mod(_Meta()), tmp_path) # pyright: ignore[reportArgumentType]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_unnamed_subscription_warns_with_file_and_line(tmp_path: Path) -> None:
|
|
28
|
+
diags = _run(tmp_path, "def reg(bus):\n bus.subscribe_durable(E, handler)\n")
|
|
29
|
+
assert len(diags) == 1
|
|
30
|
+
d = diags[0]
|
|
31
|
+
assert d.code == "SM034"
|
|
32
|
+
assert d.level == DiagnosticLevel.WARNING
|
|
33
|
+
assert d.file == f"{tmp_path / 'module.py'}:2"
|
|
34
|
+
assert "constants.py" in (d.suggestion or "")
|
|
35
|
+
assert "import path" in d.message
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_named_subscription_is_clean(tmp_path: Path) -> None:
|
|
39
|
+
assert _run(tmp_path, "bus.subscribe_durable(E, handler, name=c.HANDLER)\n") == []
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_non_call_reference_is_ignored(tmp_path: Path) -> None:
|
|
43
|
+
src = (
|
|
44
|
+
"fn = bus.subscribe_durable\n# bus.subscribe_durable(E, h)\ns = 'subscribe_durable(E, h)'\n"
|
|
45
|
+
)
|
|
46
|
+
assert _run(tmp_path, src) == []
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_nested_file_found_and_tests_dir_skipped(tmp_path: Path) -> None:
|
|
50
|
+
(tmp_path / "tests").mkdir()
|
|
51
|
+
(tmp_path / "tests" / "t.py").write_text("bus.subscribe_durable(E, h)\n")
|
|
52
|
+
diags = _run(tmp_path, "bus.subscribe_durable(E, h)\n", "service.py")
|
|
53
|
+
assert len(diags) == 1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_i18n_translator.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_permission_grants.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/_request_hooks.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/data_compatibility.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/__init__.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_coupling.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_css.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_i18n.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_migration.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_pages.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_runner.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_spa_mount.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_tenancy.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/diagnostics/_types.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/durable_events.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/i18n_overrides.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/invalidation_refresh.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/module_settings.py
RENAMED
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/permission_denied.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/redirect_safety.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/stored_settings.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/simple_module_core/user_directory.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_auth_provider_selection.py
RENAMED
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_data_compatibility_doctor.py
RENAMED
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_inline_delivery_context.py
RENAMED
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_core_invalidation_refresh.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_db_extensions_diagnostics.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_discovery_missing_deps.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_expression_index_diagnostics.py
RENAMED
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_feature_flags_decorator.py
RENAMED
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_heavy_task_imports_diagnostics.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_permissions_admin_principal.py
RENAMED
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_public_routes_rate_precedence.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simple_module_core-0.0.42 → simple_module_core-0.0.44}/tests/test_sm009_dynamic_coupling.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|