Skip to content

Commit eb0d6e9

Browse files
Tiwasclaude
andcommitted
fix(flow-doctor): keep trace running across internal tab switches
- Switching to Flows or Apps tab no longer stops tracing — users need to compare flow definitions against the live event stream without losing data - Update intro copy in en/no to reflect the new behavior - Log the shape of the first flow object and how many flows have 'lastExecuted' set, so we can diagnose Homeys where the field is missing or named differently Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8be9de4 commit eb0d6e9

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

docs/tools/flow-doctor.html

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ <h2 class="text-xl font-bold text-gray-900" data-i18n="bug.title">Report a bug</
290290
'tab.flows': 'Flows',
291291
'tab.apps': 'Apps',
292292
'tab.trace': 'Trace',
293-
'trace.intro': 'Live trace of events on your Homey. Use this to find cyclic flows or unexpected triggers. Tracing only runs while you stay on this tab.',
293+
'trace.intro': 'Live trace of events on your Homey. Use this to find cyclic flows or unexpected triggers. Tracing keeps running while you switch to other Flow Doctor tabs.',
294294
'trace.start': '▶ Start tracing',
295295
'trace.stop': '■ Stop',
296296
'trace.clear': 'Clear',
@@ -399,7 +399,7 @@ <h2 class="text-xl font-bold text-gray-900" data-i18n="bug.title">Report a bug</
399399
'tab.flows': 'Flows',
400400
'tab.apps': 'Apper',
401401
'tab.trace': 'Sporing',
402-
'trace.intro': 'Live-sporing av hendelser på Homey-en din. Bruk dette til å finne sykliske flows eller uventede triggere. Sporingen kjører bare så lenge du er på denne fanen.',
402+
'trace.intro': 'Live-sporing av hendelser på Homey-en din. Bruk dette til å finne sykliske flows eller uventede triggere. Sporingen fortsetter når du bytter mellom Flow Doctor-faner.',
403403
'trace.start': '▶ Start sporing',
404404
'trace.stop': '■ Stopp',
405405
'trace.clear': 'Tøm',
@@ -999,8 +999,8 @@ <h2 class="text-xl font-bold text-gray-900" data-i18n="bug.title">Report a bug</
999999
document.getElementById('tab-flows').classList.toggle('hidden', name !== 'flows');
10001000
document.getElementById('tab-apps').classList.toggle('hidden', name !== 'apps');
10011001
document.getElementById('tab-trace').classList.toggle('hidden', name !== 'trace');
1002-
// Auto-pause tracing when leaving the tab so we don't burn polling/realtime in the background.
1003-
if (name !== 'trace' && this.tracing) this.stopTrace({ silent: true });
1002+
// Tracing keeps running across internal tab switches — users need to compare with the
1003+
// Flows/Apps tabs while events stream. The hidden log catches up when they switch back.
10041004
}
10051005

10061006
async scan() {
@@ -1741,10 +1741,22 @@ <h2 class="text-xl font-bold text-gray-900" data-i18n="bug.title">Report a bug</
17411741
...Object.values(flows).map(f => ({ ...f, _type: 'standard' })),
17421742
...Object.values(advFlows).map(f => ({ ...f, _type: 'advanced' })),
17431743
];
1744+
// One-time field-shape dump on first successful poll — helps diagnose whether
1745+
// 'lastExecuted' is the right field name or if it's null on this Homey.
1746+
if (!this._poll_logged_shape && all.length) {
1747+
this._poll_logged_shape = true;
1748+
const sample = all[0];
1749+
console.log('[trace] flow object sample:', sample);
1750+
console.log('[trace] flow keys:', Object.keys(sample));
1751+
console.log('[trace] flows with lastExecuted:', all.filter(f => f.lastExecuted).length, '/', all.length);
1752+
}
1753+
let changes = 0;
17441754
for (const flow of all) {
17451755
if (!flow.lastExecuted) continue;
17461756
const prev = this.traceLastExec.get(flow.id);
17471757
if (prev === flow.lastExecuted) continue;
1758+
changes++;
1759+
console.log('[trace] flow lastExecuted changed:', flow.name, 'prev=', prev, 'next=', flow.lastExecuted);
17481760
// startTrace() already seeded every flow that had a prior lastExecuted, so a
17491761
// prev===undefined here means this flow ran for the very first time during
17501762
// this tracing session — that's a real event worth reporting.

0 commit comments

Comments
 (0)