mirror of
https://github.com/hanzoai/insights.git
synced 2026-11-03 00:52:32 +00:00
716 files rewritten, 30 renamed, same family mapping as the frontend pass.
Held back, and each for a reason rather than by oversight:
db_table values insights_hogfunction, insights_hogflow,
insights_hogfunctiontemplate, hogflow_templates.
Renaming a table is ALTER TABLE, so it ships as a
migration with the raw SQL in nodejs that names it.
hog_invocation_results a Datastore table with Kafka engine tables on it
products/review_hog the module path is the Django app path; moving it
moves app_label and every migration is recorded under
(app_label, name). That is the same history break as
renaming a migration file, one level up.
*/migrations/* five files, untouched
whogho an integration vendor
Checked: 395 of 397 changed Python files compile. The two that do not —
insightsql/database/database.py and temporal/schedule.py — fail identically at
origin/main under the same interpreter, because they use `type X = ...` and
`except*`, which need the 3.13 this repo pins and not the 3.9 doing the check.
Running the check against the original is what told those apart from a real
break.
Co-authored-by: Hanzo Dev <[email protected]>
Workflow Templates
This directory contains global workflow templates that are stored in code and version controlled.
Creating a New Template
-
Export the template JSON from the UI:
- Create or edit a workflow in the Insights UI
- Click "Save as template" from the workflow menu
- Select "Official (visible to everyone)" as the scope
- Click "See JSON" to open the JSON modal
- Copy the JSON using the copy button
-
Create a new template file:
- Create a new JSON file in this directory with the naming pattern:
<template_name>_template.json - Use lowercase and underscores for the filename (e.g.,
welcome_email_sequence_template.json)
- Create a new JSON file in this directory with the naming pattern:
-
Add the template JSON:
- Paste the JSON you copied from the "See JSON" modal directly into the file
- Ensure the JSON is valid and properly formatted
- The file should contain a single JSON object with the template data
-
Register the template in
__init__.py:-
Open
__init__.pyin this directory -
Add your template filename to the
TEMPLATE_FILESlist:TEMPLATE_FILES = [ "announce_a_new_feature_template.json", "onboarding_started_but_not_completed_template.json", "trial_started_upgrade_nudge_template.json", "welcome_email_sequence_template.json", "your_new_template.json", # Add this line ]
-
Editing an Existing Template
You can export the current version from the UI, make changes, and paste the updated JSON back into the file. The JSON file format makes it easy to edit templates directly.
Template Loading and Validation
Templates are:
- Loaded on startup: All templates are loaded & cached when the application starts
- Validated automatically: Each template is validated to ensure correctness
- Invalid templates are skipped: If a template fails validation, it will be logged but won't prevent other templates from loading
Important Notes
- Keep IDs stable: Once a template is deployed, don't change its ID
- Test thoroughly: Always test templates before committing
- Watch for secrets: Make sure the template doesn't contain any secret keys or other data we want to keep private
- Valid JSON required: The JSON file must be valid JSON - use a JSON linter/formatter if needed
- File registration required: New templates must be added to
TEMPLATE_FILESin__init__.pyto be loaded