Files
pipelines/app/tool/changes_probe_entry.dart
alan b60ad6d98f Remove alternate hosts from tooling probes
Keep the probe suite on the Material composition so browser fixtures and capture drivers no longer render or select Cupertino hosts. Record the final residual legacy arguments and implementation checks for the delivery gate.
2026-11-11 21:38:30 +00:00

238 lines
6.4 KiB
Dart

// Standalone fixture entry for real-browser Changes evidence.
//
// Build and probe (from app/):
// flutter build web --target tool/changes_probe_entry.dart --output build/probe-web
// node tool/changes_probe.mjs --root build/probe-web --out DIR
//
// These are server-shaped fixtures for rendering only. They are not a live run
// and never mutate a server.
import 'package:flutter/material.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/changes/changes.dart';
const _multiHunkPatch =
'--- "a/lib/features/changes/domain/unified_patch.dart"\n'
'+++ "b/lib/features/changes/domain/unified_patch.dart"\n'
'@@ -12,6 +12,7 @@\n'
' class ParsedPatch {\n'
' const ParsedPatch({\n'
' required this.raw,\n'
'+ required this.headerLines,\n'
' required this.hunks,\n'
' });\n'
' \n'
'@@ -48,5 +49,5 @@\n'
'-PatchHunk? _parseHunkHeader(String line) {\n'
'+_HunkStart? _parseHunkHeader(String line) {\n'
" if (!line.startsWith('@@')) return null;\n"
" final end = line.indexOf('@@', 2);\n"
' if (end < 0) return null;\n'
' final ranges = _tokenizeRanges(line.substring(2, end));\n';
const _addedPatch =
'--- "/dev/null"\n'
'+++ "b/lib/features/changes/widgets/file_diff_viewer.dart"\n'
'@@ -0,0 +1,5 @@\n'
'+class FileDiffViewer extends StatefulWidget {\n'
'+ const FileDiffViewer({super.key, required this.file});\n'
'+\n'
'+ final FileChange file;\n'
'+}\n';
const _deletedPatch =
'--- "a/docs/legacy-notes.md"\n'
'+++ "/dev/null"\n'
'@@ -1,2 +0,0 @@\n'
'-# Legacy notes\n'
'-Removed with the viewer.\n';
const _truncatedPatch =
'--- "a/logs/capture.log"\n'
'+++ "b/logs/capture.log"\n'
'@@ -1,2 +1,3 @@\n'
'-capture started\n'
'+capture started\n'
'+and truncated mid-line';
List<JsonMap> probeSteps() => [
{
'sequence': 1,
'stage': 'implementer',
'status': 'completed',
'file_changes': {
'status': 'partial',
'scope': 'Git tracked and nonignored files in the run directory',
'skipped': 2,
'omitted': 0,
'diagnostic':
'Excluded protected, symlinked, oversized or unreadable files; this '
'is not a complete workspace diff.',
'files': [
{
'path': 'lib/features/changes/domain/unified_patch.dart',
'kind': 'modified',
'patch': _multiHunkPatch,
'before_mode': '0644',
'after_mode': '0644',
},
{
'path': 'assets/pipelines-mark.png',
'kind': 'modified',
'binary': true,
},
{
'path': 'scripts/capture.sh',
'kind': 'modified',
'before_mode': '0644',
'after_mode': '0755',
},
{
'path': 'docs/legacy-notes.md',
'kind': 'deleted',
'patch': _deletedPatch,
'before_mode': '0644',
},
{
'path': 'logs/capture.log',
'kind': 'modified',
'patch': _truncatedPatch,
'truncated': true,
},
],
},
},
{
'sequence': 2,
'stage': 'reviewer',
'status': 'completed',
'file_changes': {
'status': 'complete',
'scope': 'Git tracked and nonignored files in the run directory',
'skipped': 0,
'omitted': 0,
'diagnostic': '',
'files': [
{
'path': 'lib/features/changes/widgets/file_diff_viewer.dart',
'kind': 'added',
'patch': _addedPatch,
'after_mode': '0644',
},
{
'path': 'lib/features/changes/domain/unified_patch.dart',
'kind': 'modified',
'patch': _multiHunkPatch,
},
],
},
},
{
'sequence': 3,
'stage': 'ui_reviewer',
'status': 'completed',
'file_changes': null,
},
{
'sequence': 4,
'stage': 'committer',
'status': 'completed',
'file_changes': {
'status': 'unavailable',
'skipped': 0,
'omitted': 0,
'diagnostic':
'Workspace snapshot unavailable; changes could not be compared.',
'files': <JsonMap>[],
},
},
{
'sequence': 5,
'stage': 'verifier',
'status': 'completed',
'file_changes': {
'status': 'complete',
'scope': 'Git tracked and nonignored files in the run directory',
'skipped': 0,
'omitted': 0,
'diagnostic': '',
'files': <JsonMap>[],
},
},
];
/// A compact fixture whose only purpose is visit numbering: the same stages
/// appear more than once, one visit records an explicit `control.visit`, and
/// every capture is empty so the sections stay on one phone screen.
List<JsonMap> probeVisitSteps() => [
{
'sequence': 1,
'stage': 'implementer',
'status': 'completed',
'file_changes': {
'status': 'complete',
'scope': 'Git tracked and nonignored files in the run directory',
'files': <JsonMap>[],
},
},
{
'sequence': 2,
'stage': 'reviewer',
'status': 'completed',
'file_changes': {
'status': 'complete',
'scope': 'Git tracked and nonignored files in the run directory',
'files': <JsonMap>[],
},
},
{
'sequence': 3,
'stage': 'implementer',
'status': 'completed',
'file_changes': {
'status': 'complete',
'scope': 'Git tracked and nonignored files in the run directory',
'files': <JsonMap>[],
},
},
{
'sequence': 4,
'stage': 'reviewer',
'status': 'completed',
'control': {'visit': 6},
'file_changes': {
'status': 'complete',
'scope': 'Git tracked and nonignored files in the run directory',
'files': <JsonMap>[],
},
},
];
void main() {
final params = Uri.base.queryParameters;
final brightness = params['theme'] == 'light'
? Brightness.light
: Brightness.dark;
final steps = params['visits'] == '1' ? probeVisitSteps() : probeSteps();
runApp(
MaterialApp(
title: 'Changes probe',
theme: ThemeData(brightness: brightness, platform: TargetPlatform.android),
home: _ProbeHome(steps: steps),
),
);
}
class _ProbeHome extends StatelessWidget {
const _ProbeHome({required this.steps});
final List<JsonMap> steps;
@override
Widget build(BuildContext context) {
final viewer = ChangesViewer(steps: steps);
return Scaffold(
appBar: AppBar(title: const Text('Changes probe')),
body: viewer,
);
}
}