mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
Mechanically re-derived: bin/debrand runs over a fresh import of posthog/posthog@fa1a9a60d4 (2026-08-06). The pipeline (.hanzo/workflows), the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md and the squashed initial migration are restored from the shipped tree, same as the previous import. The prune's import-closure guard kept 21 products the new core now imports; dropping them is a refactor now, recorded rather than forced.
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
import structlog
|
|
import hanzo_insights
|
|
|
|
from insights.models.team.team import Team
|
|
|
|
logger = structlog.get_logger(__name__)
|
|
|
|
DESTINATIONS_REVISIONS_FLAG = "destinations-revisions"
|
|
|
|
|
|
def use_destinations_revisions(team: Team) -> bool:
|
|
"""Gates the draft → review → publish cycle on enabled functions; off means today's behavior
|
|
(every edit lands straight on the live config that workers execute).
|
|
|
|
A raised exception (Redis/HyperCache blip, network glitch, SDK bug) is treated as "flag off" so
|
|
the flag is a kill switch: edits keep applying live, exactly as they did before this shipped.
|
|
"""
|
|
try:
|
|
return bool(
|
|
hanzo_insights.feature_enabled(
|
|
DESTINATIONS_REVISIONS_FLAG,
|
|
str(team.uuid),
|
|
groups={"organization": str(team.organization_id), "project": str(team.id)},
|
|
group_properties={
|
|
"organization": {"id": str(team.organization_id)},
|
|
"project": {"id": str(team.id)},
|
|
},
|
|
)
|
|
)
|
|
except Exception:
|
|
logger.warning(
|
|
"cdp.revisions.feature_flag_check_failed_defaulting_off",
|
|
team_id=team.id,
|
|
flag=DESTINATIONS_REVISIONS_FLAG,
|
|
exc_info=True,
|
|
)
|
|
return False
|