mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
[467e263d] fix(ci): restore green Python quality gate on slave (mypy + xenon)
Two independent bugs broke run 29653535468's 'Python quality gate' job, not the pydantic-settings pin (already correctly 2.14.2 on this branch). - git.py: _delete_remote_branch_best_effort's success path fell off the function with no return, failing mypy's missing-return-statement check and silently returning None instead of the documented True. - company_goals.py: CompanyGoalsService.upsert's six repetitive `if key in data` branches pushed the module's average cyclomatic complexity past xenon's --max-modules A gate; refactored into a loop over the mutable-field tuple (behaviourally identical).
This commit is contained in:
@@ -24,6 +24,17 @@ if TYPE_CHECKING:
|
||||
# Canonical single-row marker — the charter is a singleton.
|
||||
SINGLETON_ID = UUID("00000000-0000-0000-0000-000000000000")
|
||||
|
||||
# Charter fields ``upsert`` writes verbatim when present in the partial-update
|
||||
# payload (``updated_by`` is handled separately — it's not a charter field).
|
||||
_MUTABLE_FIELDS = (
|
||||
"north_star",
|
||||
"objectives",
|
||||
"constraints",
|
||||
"operating_policy",
|
||||
"brand_voice",
|
||||
"company_name",
|
||||
)
|
||||
|
||||
_EMPTY: dict[str, Any] = {
|
||||
"north_star": "",
|
||||
"objectives": [],
|
||||
@@ -57,18 +68,9 @@ class CompanyGoalsService(BaseService):
|
||||
if row is None:
|
||||
row = CompanyGoalsTable(id=SINGLETON_ID)
|
||||
self.session.add(row)
|
||||
if "north_star" in data:
|
||||
row.north_star = data["north_star"]
|
||||
if "objectives" in data:
|
||||
row.objectives = data["objectives"]
|
||||
if "constraints" in data:
|
||||
row.constraints = data["constraints"]
|
||||
if "operating_policy" in data:
|
||||
row.operating_policy = data["operating_policy"]
|
||||
if "brand_voice" in data:
|
||||
row.brand_voice = data["brand_voice"]
|
||||
if "company_name" in data:
|
||||
row.company_name = data["company_name"]
|
||||
for field in _MUTABLE_FIELDS:
|
||||
if field in data:
|
||||
setattr(row, field, data[field])
|
||||
if updated_by is not None:
|
||||
row.updated_by = updated_by
|
||||
await self.session.flush()
|
||||
|
||||
@@ -3519,6 +3519,7 @@ class GitService(BaseService):
|
||||
await self._forge.delete_branch_ref(
|
||||
RepoRef(owner, repo), git_token, branch, timeout=10.0
|
||||
)
|
||||
return True
|
||||
except httpx.HTTPError:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user