Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

41 lines
1.9 KiB
Python

from typing import Any
from django.db.models.signals import post_save
from django.dispatch import receiver
from products.data_modeling.backend.models.datawarehouse_saved_query import DataWarehouseSavedQuery
@receiver(post_save, sender=DataWarehouseSavedQuery)
def sync_saved_query_name_to_node(sender, instance: DataWarehouseSavedQuery, **kwargs):
"""Propagate SavedQuery name changes to related Node."""
from products.data_modeling.backend.models.node import Node
# this was originally called on every update to the saved query. it should only happen on
# saved query name changes.
update_fields = kwargs.get("update_fields")
if update_fields is not None and "name" not in update_fields:
return
# originally i wanted to use save() for this for the validation. but its unnecessary because
# all it does is sync the name to the query. this also does that without holding the lock for
# as long.
Node.objects.filter(saved_query=instance).exclude(name=instance.name).update(name=instance.name)
@receiver(post_save, sender=DataWarehouseSavedQuery)
def trigger_view_semantic_enrichment(sender: type, instance: DataWarehouseSavedQuery, **kwargs: Any) -> None:
"""Draft/refresh the view's AI semantic descriptions when its definition or columns change.
Only the query text or the column set can change what the descriptions should say, so saves that
touch neither (status flips, last_run_at, the enrichment-hash write itself) never reach Temporal.
maybe_dispatch_enrichment applies the remaining gates + hash pre-check and dispatches after commit.
"""
update_fields = kwargs.get("update_fields")
if update_fields is not None and not ({"query", "columns"} & set(update_fields)):
return
from products.data_modeling.backend.logic.enrich_view_semantics import maybe_dispatch_enrichment
maybe_dispatch_enrichment(instance)