Commit 24d477c
feat: user-facing activity logs with 19 curated events (#66)
* feat: user-facing activity logs — 3 core model events
Introduces a UserLevel event tier and 3 curated, plain-language
events that replace developer-internal log dumps for model execution:
Building model "mmodela" → testing.mmodela as TABLE from "testing.country"
Model "mmodela" built successfully in 0.42s
Model "mmodela" failed: Table Not Found …
Backend
- base_types.py: UserLevel class with audience()="user"; BaseEvent
gets a default audience()="developer" so all existing events are
backward-compatible.
- proto_types.py: ModelRunStarted, ModelRunSucceeded, ModelRunFailed
message types.
- types.py: 3 event classes (U001-U003) inheriting UserLevel.
- log_helper.py: LogHelper.log() accepts audience param, included in
the socket payload dict.
- eventmgr.py: write_line reads audience from the event and passes
through to LogHelper.
- visitran.py: fires the 3 events from execute_graph — started before
run_model, succeeded after, failed in both exception handlers.
Frontend
- Socket handler reads data?.data?.audience alongside level/message.
- logsInfo entries now carry { level, message, audience }.
- New "User activity" option at the top of the log-level dropdown
(default). Filters to audience==="user" only.
- Existing options (All logs, Info+, Warn+, Error) continue to show
developer logs regardless of audience.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: CreateConnection crash — hasDetailsChanged used before declaration
useMemo for hasDetailsChanged was declared at line 411 but referenced
by the handleCreateOrUpdate useCallback at line 148. JavaScript's
temporal dead zone (TDZ) caused a ReferenceError on render. Moved
the useMemo above the useCallback that depends on it.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: style user-activity logs with visual distinction
User-audience log entries now render with:
- A primary-colored left border (3px, token.colorPrimary)
- Subtle background fill (token.colorFillQuaternary)
- Slightly bolder font (500 weight, 13px)
- Error-colored text for failed events
- No HTML parsing (user messages are plain text, no ANSI)
Developer logs continue rendering with the existing ANSI-parsed
style and severity-based coloring. The visual contrast makes it
immediately clear which entries are user-facing activity messages
vs developer-internal noise.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: rename event classes to match proto Msg naming convention
msg_from_base_event builds the Msg class name as {ClassName}Msg.
Our events were named ModelRunStartedEvent → looked for
ModelRunStartedEventMsg which doesn't exist. Dropped the "Event"
suffix so ModelRunStarted → ModelRunStartedMsg matches proto_types.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add P1 user-facing events — transformations, config, seeds
4 new UserLevel events covering the core model-tab operations:
- TransformationApplied (U004): fired after set_model_transformation
succeeds. Message: 'Applied sort transformation on "mdoela"'
- TransformationDeleted (U005): fired after delete_model_transformation.
Message: 'Removed filter transformation from "mdoela"'
- ModelConfigured (U006): fired after set_model_config_and_reference.
Message: 'Configured "mdoela" — source: raw.customers, destination: analytics.dim_customers'
- SeedCompleted (U007): fired after successful/failed seed execution.
Message: 'Seed "raw_customers" loaded into "raw"' or 'Seed "raw_customers" failed in "raw"'
These fire through the existing UserLevel → LogHelper(audience="user")
→ Celery → socket pipeline. Frontend filters them via the "User
activity" dropdown option.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add P2 user-facing events — job scheduler operations
4 new UserLevel events for job lifecycle actions:
- JobCreated (U008): fired after create_periodic_task succeeds.
Message: 'Job "Nightly refresh" created for environment "prod"'
- JobUpdated (U009): fired after update_periodic_task.
Message: 'Job "Nightly refresh" updated'
- JobDeleted (U010): fired after delete_periodic_task.
Message: 'Job "Nightly refresh" deleted'
- JobTriggered (U011): fired from _dispatch_task_run (covers both
trigger_task_once and trigger_task_once_for_model).
Message: 'Job "Nightly refresh" triggered manually — running
all models' or '— running model mdoela'
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add P3-P5 user-facing events — CRUD, connections, environments
8 new UserLevel events covering model/file CRUD, connections, and
environments:
P3 — Model/project CRUD:
- ModelCreated (U012): model created in explorer
- FileDeleted (U013): files/models deleted
- FileRenamed (U014): file/model renamed
P4 — Connections:
- ConnectionCreated (U015): new connection created
- ConnectionTested (U016): connection test result
- ConnectionDeletedEvt (U017): connection deleted
P5 — Environments:
- EnvironmentCreated (U018): new environment created
- EnvironmentDeleted (U019): environment deleted
All fire through the UserLevel → audience="user" pipeline and
appear in the "User activity" log view.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: show names instead of IDs in connection/environment delete events
ConnectionDeletedEvt and EnvironmentDeleted were passing raw UUIDs.
Now fetch the name before deleting so the user-activity log shows
'Connection "my_postgres" deleted' instead of 'Connection "uuid" deleted'.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: environment delete shows proper error when used by a job
Backend returned {"message": "..."} on ProtectedError but the
frontend notification service reads "error_message". Changed key
to "error_message" for consistency with other endpoints.
Also improved the error message copy and added explicit error_message
extraction in the frontend catch block so the user sees:
"Cannot delete this environment because it is used by: Nightly from
'Deploy'. Remove it from the job first, then delete."
instead of the generic "Something went wrong".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: address Greptile review — name lookup safety, seed schema, field names
P1: Connection name-lookup before delete could block deletion on
transient errors. Wrapped in try/except so deletion proceeds
regardless; event falls back to connection_id.
P2: SeedCompleted failure path had schema_name="". Now reads from
self.context.schema_name with fallback to empty string.
P2: Renamed misleading proto fields — connection_id → connection_name
and environment_id → environment_name since they carry display
names, not UUIDs. Updated event classes and all callers.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: restructure delete_connection — fetch + delete in same try block
If fetching the connection fails (doesn't exist, DB down), no point
attempting deletion. Both operations now live in one try block.
fire_event fires from both success and exception paths so the
activity log captures the attempt either way. Exception re-raises
so handle_http_request returns the proper error to the frontend.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: raise ConnectionDeleteFailed exception with proper formatting
Replaces bare re-raise with a dedicated ConnectionDeleteFailed
exception following the same pattern as EnvironmentInUse —
BackendErrorMessages template with markdown formatting, caught by
handle_http_request decorator for uniform error response.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: separate success and failure events for connection delete
Success fires ConnectionDeletedEvt (U017, UserLevel/info):
'Connection "my_postgres" deleted'
Failure fires ConnectionDeleteFailedEvt (U020, UserLevel/error):
'Failed to delete connection "my_postgres": reason...'
The failure event uses level_tag=ERROR so it renders in red in the
activity log, clearly distinguishing it from a successful delete.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: move success fire_event outside try to prevent false failure
fire_event inside try could throw (e.g., logger error) after
delete_connection succeeded, triggering the except block and raising
ConnectionDeleteFailed for a successful deletion. Moved success
event after the try block.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: fire JobTriggered after successful dispatch, not before
JobTriggered was fired optimistically before send_task/sync execution.
If both dispatch paths failed, the activity log showed "triggered"
for a job that never ran. Moved fire_event to after each successful
dispatch, consistent with all other events in this PR.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: improve activity log readability and celery log queue
- Use materialization .name instead of .value so logs show "TABLE"/"VIEW"
instead of integer values like "1"/"2"
- Extract transformation type from step_config (where frontend sends it)
instead of top-level request data, fixing "Applied unknown transformation"
- Add celery_log_task_queue to docker-compose celery worker so activity
log events are actually consumed and delivered via WebSocket
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: structured activity feed for user-facing logs
Replace raw text logs with structured data for user-level events:
- Send title, subtitle, status, timestamp as separate fields
- Render as activity cards with status icons and color-coded borders
- Remove [ThreadPool] prefix from developer logs
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: preserve specific exception status codes in connection delete
Re-raise VisitranBackendBaseException subclasses (ConnectionNotExists
404, ConnectionDependencyError 409) directly instead of wrapping all
errors as ConnectionDeleteFailed 400.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: reset pagination to page 1 on job switch in run history
Explicitly pass page 1 when switching jobs to prevent fetching a stale
page number from the previous job selection.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* fix: rename status() to event_status() to avoid proto field shadowing
SeedCompleted has a proto field named 'status' which shadows the
method. Renamed to event_status() across all UserLevel events and
the base class to prevent runtime errors.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent bfb1f94 commit 24d477c
16 files changed
Lines changed: 878 additions & 53 deletions
File tree
- backend
- backend
- core
- routers
- connection
- environment
- explorer
- transformation
- scheduler
- errors
- visitran
- events
- docker
- frontend/src/ide
- editor/no-code-model
- run-history
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
117 | 126 | | |
118 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
119 | 141 | | |
120 | 142 | | |
121 | | - | |
| 143 | + | |
122 | 144 | | |
123 | 145 | | |
124 | 146 | | |
| |||
158 | 180 | | |
159 | 181 | | |
160 | 182 | | |
| 183 | + | |
161 | 184 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
74 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
75 | 90 | | |
76 | 91 | | |
77 | | - | |
78 | | - | |
79 | 92 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
55 | 58 | | |
56 | 59 | | |
57 | 60 | | |
| |||
76 | 79 | | |
77 | 80 | | |
78 | 81 | | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| 102 | + | |
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
| |||
109 | 114 | | |
110 | 115 | | |
111 | 116 | | |
| 117 | + | |
112 | 118 | | |
113 | 119 | | |
114 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
101 | 111 | | |
102 | 112 | | |
103 | 113 | | |
| |||
116 | 126 | | |
117 | 127 | | |
118 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
119 | 135 | | |
120 | 136 | | |
121 | 137 | | |
| |||
138 | 154 | | |
139 | 155 | | |
140 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
141 | 161 | | |
142 | 162 | | |
143 | 163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
346 | 352 | | |
347 | 353 | | |
348 | 354 | | |
| |||
530 | 536 | | |
531 | 537 | | |
532 | 538 | | |
| 539 | + | |
533 | 540 | | |
534 | 541 | | |
535 | 542 | | |
| |||
554 | 561 | | |
555 | 562 | | |
556 | 563 | | |
| 564 | + | |
557 | 565 | | |
558 | 566 | | |
559 | 567 | | |
560 | 568 | | |
561 | 569 | | |
| 570 | + | |
562 | 571 | | |
563 | 572 | | |
564 | 573 | | |
| |||
630 | 639 | | |
631 | 640 | | |
632 | 641 | | |
| 642 | + | |
633 | 643 | | |
634 | 644 | | |
635 | 645 | | |
| |||
649 | 659 | | |
650 | 660 | | |
651 | 661 | | |
| 662 | + | |
652 | 663 | | |
653 | 664 | | |
654 | 665 | | |
| |||
661 | 672 | | |
662 | 673 | | |
663 | 674 | | |
| 675 | + | |
664 | 676 | | |
665 | 677 | | |
666 | 678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
90 | 103 | | |
91 | 104 | | |
92 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
90 | 116 | | |
91 | 117 | | |
92 | 118 | | |
| |||
0 commit comments