Fix the web instrument's arming flag, and let the wrapper redirect its paths

Two things found while verifying the >=100fps done-condition at 4K.

`bool.fromEnvironment` only accepts the literal `true`, so
`--dart-define=TODO_FRAME_STATS=1` silently evaluated to false and the web
instrument emitted nothing at all -- a whole measurement run produced no data
and looked like the callback was broken. It now reads the value as a string and
accepts either form.

The wrapper gains --backlog-path/--log-path. Verification needs to point the
server somewhere harmless: it starts an app whose store may be empty, and an
empty store exports over the real ~/todo/BACKLOG.md through the very endpoint
being tested.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-07-20 13:47:38 +02:00
parent c37a9ef118
commit 3704d34f74
2 changed files with 15 additions and 3 deletions

View File

@ -28,10 +28,14 @@ Future<void> main(List<String> args) async {
exit(1);
}
// Overridable so a verification run cannot point at the real backlog: an
// app that starts with an empty store would export over it.
final server = WrapperServer(
webRoot: webRoot,
backlogPath: p.join(home, 'todo', 'BACKLOG.md'),
logPath: p.join(home, '.local', 'share', 'todo-desktop', 'todo_notes.json'),
backlogPath:
_argValue(args, '--backlog-path') ?? p.join(home, 'todo', 'BACKLOG.md'),
logPath: _argValue(args, '--log-path') ??
p.join(home, '.local', 'share', 'todo-desktop', 'todo_notes.json'),
);
await server.start(_port);
stdout.writeln('todo desktop serving on http://localhost:$_port');

View File

@ -12,7 +12,15 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/scheduler.dart';
/// Whether the frame-stats instrument is armed for this build.
const frameStatsEnabled = bool.fromEnvironment('TODO_FRAME_STATS');
///
/// Read as a string rather than `bool.fromEnvironment`, which only accepts the
/// exact literal `true` — `--dart-define=TODO_FRAME_STATS=1` silently yields
/// false and the instrument produces nothing at all.
const String _frameStatsFlag = String.fromEnvironment('TODO_FRAME_STATS');
/// Whether the instrument is armed (`--dart-define=TODO_FRAME_STATS=1`).
const bool frameStatsEnabled =
_frameStatsFlag == '1' || _frameStatsFlag == 'true';
const _slowFrameMs = 8;
const _probePeriod = Duration(milliseconds: 16);