Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dfe_engine/api/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ async def get_current_user(request: Request) -> AuthContext:
3. JWT Bearer token -- standalone/Docker users
4. Auth disabled -- dev/test root context

When ``auth.enabled=False`` (dev/test default), returns a root AuthContext
that bypasses authorization if no credentials are provided.
When ``auth.enabled=False`` (default on, and off only in a dev posture), returns
a root AuthContext that bypasses authorization if no credentials are provided.
"""
# No auth.login.success here: this runs on every request and creates no
# session, so the login audit belongs to the credential exchange
Expand Down
7 changes: 3 additions & 4 deletions src/dfe_engine/backing/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
# Copyright: (c) 2026 HYPERI PTY LIMITED
"""The provider catalogue, and what a deployment's provider key makes of a service.

The catalogue is DATA whose source of truth is dfe-infra's ``providers.yaml``, so a
new provider, or a change to what one leaves the deploy repo to set, is an edit
there rather than an engine release. It resolves the way the app manifest does:
an explicit path, then ``DFE_ENGINE_PROVIDER_CATALOGUE_FILE``, then the snapshot bundled
The catalogue is DATA, the ``providers.yaml`` beside this module, so a deployer can
change it without an engine release. It resolves the way the app manifest does:
an explicit path, then ``DFE_ENGINE_PROVIDER_CATALOGUE_FILE``, then the copy bundled
in the image.

A service is ``dfe``-run unless the deployer states a provider. A key the catalogue
Expand Down
5 changes: 2 additions & 3 deletions src/dfe_engine/gitcrud/commit_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,9 @@ def resolve_mode(
environment: str,
rbac_class: str,
protected: bool = False,
require_pr: bool = False,
auto_merge: bool = False,
) -> str:
"""'pr' for production posture / protected / governance / explicit, else 'direct'.
"""'pr' for production posture / protected / governance, else 'direct'.

PRs for production-controlling changes, direct-commit for low-risk - enforced at
the git level (the standard). Production posture is anything DFE_ENGINE_ENV does not
Expand All @@ -398,6 +397,6 @@ def resolve_mode(
"""
if auto_merge:
return "direct"
if require_pr or protected or rbac_class == "governance" or not is_dev_posture(environment):
if protected or rbac_class == "governance" or not is_dev_posture(environment):
return "pr"
return "direct"
16 changes: 8 additions & 8 deletions tests/e2e/test_live_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,22 +192,22 @@ def test_ui_deploys_schema_change_via_git(e2e: E2EConfig) -> None:

# No publish call - see the note in the infra test above.

# VERIFY the generated DDL landed in the deploy repo (ddl/<table>.sql), and
# that it carries our additional column.
def _ddl_committed():
# VERIFY the source, with our additional column, landed in the deploy repo's
# config/sources/ (the sources resource class, source/registry.py).
def _source_committed():
with tempfile.TemporaryDirectory() as d:
repo = _clone_deploy_repo(e2e, Path(d) / "repo")
ddl_dir = repo / "ddl"
if not ddl_dir.exists():
sources_dir = repo / "config" / "sources"
if not sources_dir.exists():
return False
for sql in ddl_dir.glob("*.sql"):
text = sql.read_text()
for path in sources_dir.glob("*.yaml"):
text = path.read_text()
if source_name in text and "e2e_marker" in text:
return True
return False

assert poll_until(
_ddl_committed, timeout=90, interval=5, desc=f"DDL for {source_name} in deploy repo"
_source_committed, timeout=90, interval=5, desc=f"{source_name} in deploy repo"
)

# cleanup: remove the test source.
Expand Down
4 changes: 1 addition & 3 deletions tests/gitcrud/test_commit_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,18 +429,16 @@ def test_resolve_mode():
assert resolve_mode(environment="prod", rbac_class="helmvars") == "pr"
assert resolve_mode(environment="dev", rbac_class="governance") == "pr"
assert resolve_mode(environment="dev", rbac_class="helmvars", protected=True) == "pr"
assert resolve_mode(environment="dev", rbac_class="helmvars", require_pr=True) == "pr"


class TestAutoMergeMode:
def test_auto_merge_forces_direct_everywhere(self):
# prod + protected + governance + require_pr: ALL direct under auto-merge
# prod + protected + governance: ALL direct under auto-merge
assert (
resolve_mode(
environment="prod",
rbac_class="governance",
protected=True,
require_pr=True,
auto_merge=True,
)
== "direct"
Expand Down
Loading