You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes stale/contradictory AI agent instructions; adds agent docs lint and tuirec verification guidance (#5478)
* Fix inconsistencies in AI agent instruction files
- Local function naming: camelCase -> PascalCase in REFRESH.md and
copilot-instructions.md (matches .editorconfig local_functions_rule,
AGENTS.md, and event-patterns.md)
- Replace stale Tests/UnitTests references with current project names
(UnitTestsParallelizable / UnitTests.NonParallelizable) across
AGENTS.md, CONTRIBUTING.md, .aider.md, .cursorrules, .windsurfrules,
copilot-instructions.md, and .claude workflows/tasks
- Replace deprecated --filter "FullyQualifiedName~" syntax with xUnit v3
MTP --filter-method/--filter-class in copilot-instructions.md
- Remove machine-local path (D:\s\...) from AGENTS.md planning section
- build-app.md: use Accepted (post-event) for fire-and-forget handlers
per event-patterns.md; show Accepting only for cancellation; fix
v1-style new Button ("OK") to v2 object initializer
- build-test-workflow.md: .NET SDK 8.0 -> 10.0.100 per global.json
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Add agent docs lint, tuirec verification guidance, promote local memories
- Add Scripts/lint-agent-docs.ps1 + lint-agent-docs.yml CI workflow: fails
when known rot patterns reappear in agent instruction files (stale test
project names, machine-local paths, camelCase local-function guidance,
deprecated FullyQualifiedName~ filter syntax, SDK version drift vs
global.json). The lint immediately caught a stale .NET SDK 8.0 claim in
CONTRIBUTING.md, now fixed.
- Wire tuirec into agent entry points (CLAUDE.md, AGENTS.md, build-app.md):
agents can verify TUI behavior by recording with tuirec and reading the
asciinema .cast output back as text, per Scripts/tuirec/README.md.
- Promote durable guidance from machine-specific .claude/projects/ memory
files into shared rules (.claude/rules/logging-tracing.md and
fragile-areas.md); untrack .claude/projects/ and gitignore it (the
directory name encoded a local user path).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Document Windows ConPTY sixel limitation in tuirec README
Discovered while verifying the About Box fire animation: ConPTY strips
sixel DCS and the DA1 sixel handshake, so sixel content cannot be
captured in tuirec recordings on Windows (apps detect Sixel support:
False). Added to the troubleshooting table and validation checklist so
the next agent does not burn recordings rediscovering it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* tuirec README: require measuring grid-anchored sixels, not eyeballing
Agents (including me) recurrently verify the wrong invariant when checking
sixel recordings: confirming the sixel appears, or that agg rendered it
faithfully at the requested cursor cell, and calling it done. That misses
size/position errors — notably the ~4% undersize from tuirec advertising a
cell resolution that does not match agg's rendered font cell (tuirec #84).
Adds a "Verifying Placement and Size (measure - don't eyeball)" section with
the cell-calibration recipe (measure agg's real cell from a known grid
reference; reconcile against the resolution the app used; confirm the
rendered bbox covers the target region), a checklist item, a troubleshooting
row for #84, and rewrites the workflow's "visual confirm" step to require
measurement for grid-anchored content. Also states the general principle:
verify the invariant the change was meant to satisfy, not a proxy.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Sync CONTRIBUTING.md TFM to net10.0; lint stale TFMs
Codex review on #5478 flagged that build-test-workflow.md cites
CONTRIBUTING.md as its source of truth, but CONTRIBUTING.md still
described the project as net8.0 (line 28) even though the Required Tools
section was updated to .NET 10 — so the declared source could revert the
fix and mislead readers onto the wrong toolchain.
Test-first: added Rule 6 to lint-agent-docs.ps1 that derives the expected
target-framework moniker from global.json's SDK major and fails on any
mismatched `net<major>.0` reference. It flagged CONTRIBUTING.md:28
(net8.0); fixed that to `C# 14 (net10.0)`. Lint now passes (32 files).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Areas of the codebase where seemingly-safe refactors cause cascading failures. Do not "fix" these in passing — file a separate issue instead.
4
+
5
+
## TextView Initialization Ordering
6
+
7
+
Do not change `TextView`'s `EndInit` ordering or initialization flow. Moving `base.EndInit ()` before `UpdateContentSize ()`/`UpdateScrollBars ()` fixes some tests but breaks others in the non-parallel test project.
8
+
9
+
**Why:**`TextView` has complex initialization dependencies, and the non-parallel tests rely on specific ordering.
10
+
11
+
**How to apply:** If `TextView` ContentSize tests fail, note the root cause (`UpdateContentSize` runs before `IsInitialized` is set) but do NOT fix it by reordering `EndInit`. File a separate issue or let a maintainer decide when to address it.
**Never use `Console.WriteLine` or `Console.Error.WriteLine` for debug output.** Console output interferes with the terminal UI framework. Use the project's logging infrastructure instead:
4
+
5
+
| Need | Use |
6
+
|------|-----|
7
+
| Library logging |`Terminal.Gui.App.Logging`|
8
+
| Test output |`Terminal.Gui.Tests.TestLogging`|
9
+
| Debug tracing |`Terminal.Gui.Tracing.Trace`|
10
+
11
+
## Test Pattern
12
+
13
+
```csharp
14
+
usingTerminal.Gui.Tests;
15
+
usingTerminal.Gui.Tracing;
16
+
17
+
[Fact]
18
+
publicvoidMyTest ()
19
+
{
20
+
// Enable logging and tracing in one call
21
+
using (TestLogging.Verbose (_output, TraceCategory.Command))
22
+
{
23
+
// Logs and traces appear in xUnit test output
24
+
CheckBoxcheckbox=new () { Id="test" };
25
+
checkbox.InvokeCommand (Command.Activate);
26
+
}
27
+
}
28
+
```
29
+
30
+
## Rules
31
+
32
+
-`Tracing.Trace` is only available in DEBUG builds; do not use it to validate test results — all tests must pass in RELEASE builds.
33
+
- Remove temporary debug tracing before committing.
## Verify Your App Actually Works (Give Yourself Eyes)
246
+
247
+
You cannot see a TUI from a build log. Before declaring an app done, **run it and observe it** with [`tuirec`](https://github.com/gui-cs/tuirec) — it spawns the app in a PTY, injects keystrokes, and records the terminal output:
248
+
249
+
```powershell
250
+
dotnet build -c Release
251
+
$ks = 'wait:1000,Tab,Enter,wait:800,Escape'
252
+
253
+
tuirec record `
254
+
--binary dotnet `
255
+
--args "./bin/Release/net10.0/MyApp.dll" `
256
+
--name MyApp `
257
+
--keystrokes $ks `
258
+
--startup-delay 2000 --drain 1500 `
259
+
--cols 120 --rows 30
260
+
```
261
+
262
+
Then **verify the output yourself**:
263
+
264
+
1.**Read `artifacts/MyApp.cast`** — it is asciinema v2 JSON (plain text). Inspect the frames to confirm the UI rendered what you expect (controls visible, focus moved, dialog appeared).
265
+
2. Grep the cast for failures: `Select-String -Path artifacts/MyApp.cast -Pattern "error|exception|usage:"`.
266
+
3. Check `artifacts/MyApp.gif` exists and is > 100KB (a blank recording is typically < 50KB).
267
+
268
+
See [Scripts/tuirec/README.md](../../Scripts/tuirec/README.md) for the full keystroke syntax, validation checklist, and troubleshooting table. For in-process assertions (no PTY), use `InputInjector` and `VirtualTimeProvider` — see `docfx/docs/input-injection.md`.
269
+
238
270
## Checklist for Building Apps
239
271
240
272
-[ ] Project setup with correct packages
241
273
-[ ] Main window class inheriting from `Runnable` or `Runnable<T>`
dotnet test --project Tests/UnitTests --no-build --verbosity normal
50
+
dotnet test --project Tests/UnitTests.NonParallelizable --no-build --verbosity normal
51
51
```
52
52
53
53
- Uses `Application.Init` and static state
@@ -75,7 +75,7 @@ dotnet test --project Tests/IntegrationTests --no-build --verbosity normal
75
75
### Run All Tests
76
76
77
77
```bash
78
-
dotnet test --project Tests/UnitTests --no-build --verbosity normal && dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal
78
+
dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal && dotnet test --project Tests/UnitTests.NonParallelizable --no-build --verbosity normal
dotnet test --project Tests/UnitTests --no-build --verbosity normal && dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal
73
+
dotnet test --project Tests/UnitTestsParallelizable --no-build --verbosity normal && dotnet test --project Tests/UnitTests.NonParallelizable --no-build --verbosity normal
74
74
```
75
75
76
76
**Expected:** All tests pass
@@ -106,7 +106,7 @@ git diff
106
106
- ❌ Don't modify unrelated code
107
107
- ❌ Don't remove/edit unrelated tests
108
108
- ❌ Don't break existing functionality
109
-
- ❌ Don't add tests to `UnitTests` if they can be parallelizable
109
+
- ❌ Don't add tests to `UnitTests.NonParallelizable` if they can be parallelizable; never add tests to `UnitTests.Legacy`
110
110
- ❌ Don't decrease code coverage
111
111
- ❌ Don't introduce new warnings
112
112
- ❌ Don't include commented-out code without explanation
0 commit comments