Skip to content

Commit f0d0bcf

Browse files
committed
fix(test-runner): Improve async test result handling in TestRunnerService
feat(git-commits): New windsurf workflow to commit changes to git Closes #55
1 parent a5f7d9f commit f0d0bcf

File tree

3 files changed

+105
-14
lines changed

3 files changed

+105
-14
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ GvhProjectSettings.xml
114114
**/package-lock.json
115115
**/package-lock.json.meta
116116
.codeiumignore
117-
.windsurf
118117
Server~/log.txt
119118
Server~/log.txt.meta
120119
log.txt

.windsurf/workflows/git-commits.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
description: Git Commit Workflow
3+
---
4+
5+
## Git Conventional Commit Workflow
6+
7+
Cascade **MUST** follow this workflow to ensure all git changes are reviewed, structured, and committed correctly using the Conventional Commits specification.
8+
9+
### Step 1: Assess the State of the Repository
10+
11+
1. **Check for Uncommitted Changes**: Run `git status` to get an overview of modified, staged, and untracked files.
12+
13+
### Step 2: Stage and Review Changes
14+
15+
1. **Stage All Changes**: Run `git add .` to stage all modifications.
16+
2. **Collect Staged Changes**: Run `git diff --staged --word-diff` to get a complete overview of all the changes that will be included in the commit. This is crucial for accurately summarizing the changes.
17+
18+
### Step 3: Propose the Commit Message
19+
20+
- Based on the collected diff, formulate a commit message. The message **MUST** be presented to the USER in a markdown block for review before committing.
21+
- When referencing file changes in a commit body, **MUST** use the filename only (e.g., `McpUtils.cs`), not the full path (e.g. `cci:7://file:///c:/mcp-unity/Editor/Utils/conventional-commits.md:0:0-0:0`).
22+
23+
#### Structuring the Commit
24+
25+
**For commits containing a single, focused change:**
26+
- Use a standard, single-line header.
27+
- The body is optional and should only be used for significant explanations.
28+
29+
**For commits containing multiple, logically distinct changes:**
30+
- The header **MUST** list each distinct change on a separate line. Each line must follow the `<type>(scope): <description>` format.
31+
- The body should provide a high-level summary of the overall changes.
32+
33+
**Format:**
34+
# For a single change:
35+
```
36+
<type>(scope): <description>
37+
38+
[optional footer(s)]
39+
```
40+
41+
# For multiple changes:
42+
```
43+
<type>(scope1): <description1>
44+
<type>(scope2): <description2>
45+
46+
<body summarizing the overall changes>
47+
48+
[optional footer(s)]
49+
```
50+
51+
- **Types**: `feat`, `fix`, `build`, `chore`, `ci`, `docs`, `perf`, `refactor`, `revert`, `style`, `test`.
52+
- **Scope**: For providing context (e.g., `feat(api): ...`).
53+
- **Description**: A concise, imperative summary of a single, distinct change.
54+
- **Body**: Explain the 'what' and 'impact' of the changes. For commits with multiple headers, the body should summarize the combined effort.
55+
- **Footer** (Optional): Use for `BREAKING CHANGE:` notifications or for referencing issue numbers (e.g., `Closes #55`).
56+
57+
### Example Commit Message Proposals
58+
59+
Here is how you should present commit messages for review.
60+
61+
#### Example 1: Single Change (No Body Needed)
62+
For simple, self-explanatory changes where the header is sufficient.
63+
64+
```markdown
65+
fix(login): Correct typo in user login prompt
66+
67+
Closes #100
68+
```
69+
70+
#### Example 2: Single Change (Body Included)
71+
For a significant change that requires more context to explain the 'what' and 'why'.
72+
73+
```markdown
74+
refactor(auth): Overhaul authentication flow to use JWTs
75+
76+
This commit replaces session-based authentication with JWTs to improve statelessness and scalability.
77+
78+
Impacts:
79+
- API endpoints now expect a JWT in the Authorization header.
80+
- User login returns a JWT.
81+
- Session management code has been removed.
82+
83+
Closes #111
84+
```
85+
86+
#### Example 3: Multiple Changes
87+
For commits that bundle several distinct changes, use a multi-line header and a summary body.
88+
89+
```markdown
90+
feat(auth): Add password reset functionality
91+
refactor(login): Revamp login page style
92+
93+
This commit introduces a new login flow and modernizes the UI. It adds a password reset endpoint and decouples the email service for better maintainability.
94+
95+
Impacts:
96+
- A new API endpoint `/api/auth/reset-password` is now available.
97+
- The email template system is now in a separate service module.
98+
- The login page CSS in `login.css` has been updated.
99+
100+
Closes #123
101+
```

Editor/Services/TestRunnerService.cs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,10 @@ public class TestRunnerService : ITestRunnerService, ICallbacks
3030
public TestRunnerService()
3131
{
3232
_testRunnerApi = ScriptableObject.CreateInstance<TestRunnerApi>();
33-
33+
_results = new List<ITestResultAdaptor>();
3434
_testRunnerApi.RegisterCallbacks(this);
3535
}
3636

37-
[MenuItem("Tools/MCP Unity/Debug call path")]
38-
public static async void DebugCallGetAllTests()
39-
{
40-
var service = new TestRunnerService();
41-
var tests = await service.GetAllTestsAsync();
42-
Debug.Log($"Retrieved {tests.Count} tests:");
43-
foreach (var t in tests)
44-
Debug.Log($"Test: {t.FullName} ({t.TestMode}) - State: {t.RunState}");
45-
}
46-
4737
/// <summary>
4838
/// Async retrieval of all tests using TestRunnerApi callbacks
4939
/// </summary>
@@ -83,11 +73,11 @@ public async Task<List<ITestAdaptor>> GetAllTestsAsync(string testModeFilter = "
8373
/// <returns>Task that resolves with test results when tests are complete</returns>
8474
public async Task<JObject> ExecuteTestsAsync(TestMode testMode, bool returnOnlyFailures, bool returnWithLogs, string testFilter = "")
8575
{
76+
var filter = new Filter { testMode = testMode };
77+
8678
_tcs = new TaskCompletionSource<JObject>();
87-
_results = new List<ITestResultAdaptor>();
8879
_returnOnlyFailures = returnOnlyFailures;
8980
_returnWithLogs = returnWithLogs;
90-
var filter = new Filter { testMode = testMode };
9181

9282
if (!string.IsNullOrEmpty(testFilter))
9383
{
@@ -148,6 +138,7 @@ public void RunStarted(ITestAdaptor testsToRun)
148138
if (_tcs == null)
149139
return;
150140

141+
_results.Clear();
151142
McpLogger.LogInfo($"Test run started: {testsToRun?.Name}");
152143
}
153144

0 commit comments

Comments
 (0)