Homework/04 avalonia - #141
Open
invincible-summer wants to merge 4 commits into
Open
Conversation
…tures in GUI client
There was a problem hiding this comment.
🟡 Changes recommended
有几处会影响功能/验收的点尚未处理(例如流式 GetAnalysisResult 未正确处理 Status 失败消息、LocalCli 的结果输出不符合 T2.3 要求、报告截图链接不以 GitHub 可渲染格式呈现)。
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
本 PR 以“作业提交”为目标,补全了日志解析、并行分析、gRPC Agent/Client 交互,以及 Avalonia GUI 客户端的关键 TODO(对应 04-avalonia 作业通道 #35),并补充了若干章节的作业报告与忽略规则。
Changes:
- 完成
LogParser对 request/internal 日志的解析与 visitor 支持,并补齐模型 visitor dispatch。 - 完成
LogAnalyzer的并行工作队列与多线程解析流程,并补齐本地/远程 CLI 与 gRPC AgentSession 的核心逻辑。 - 完成 Avalonia 客户端的刷新/分析/获取结果等交互,并更新报告与
.gitignore。
File summaries
| File | Description |
|---|---|
| src/RemoteCli/Program.cs | 补全远程 CLI(列文件/分析/流式取结果)交互逻辑 |
| src/LogParser/Visitors/KeyValueVisitor.cs | 为 Request/Internal 日志补齐 Key-Value 导出 |
| src/LogParser/Parser/LineParser.cs | 实现 request/internal 日志行解析与反序列化 |
| src/LogParser/Models/LogEntries.cs | 补齐 Request/Internal 的 visitor Accept 实现 |
| src/LogAnalyzerRpc/GrpcTypeConverter.cs | 补全枚举与 LogEntry 的 gRPC 双向转换 |
| src/LogAnalyzerRpc/GrpcLogEntryVisitor.cs | 补全 Request/Internal 的 gRPC visitor 序列化 |
| src/LogAnalyzerClient/LogAnalyzerClient/Views/MainView.axaml | GUI 增加 Analyze All 按钮并绑定命令 |
| src/LogAnalyzerClient/LogAnalyzerClient/ViewModels/MainViewModel.cs | 补全 Refresh/Analyze/GetResult 等 GUI 端 RPC 调用逻辑 |
| src/LogAnalyzerClient/LogAnalyzerClient/Models/RemoteModels.cs | 完成结果条目 Summary 的展示逻辑 |
| src/LogAnalyzerAgent/Services/AgentService.cs | 将 gRPC 服务方法委托到 session 实现 |
| src/LogAnalyzerAgent/Applications/AgentSession.cs | 实现目录切换/分析/获取结果等 session 逻辑与错误处理 |
| src/LogAnalyzer/WorkQueue.cs | 实现线程安全工作队列(Monitor/lock) |
| src/LogAnalyzer/LogFileAnalyzer.cs | 补全多线程 worker 执行、结果写回与 analyzing 标志位处理 |
| src/LocalCli/Program.cs | 补全本地 CLI 的列文件/分析/获取结果交互实现 |
| docs/appendix/appendix-a-glossary.md | 调整术语表表格排版 |
| docs/04-avalonia/report.md | 添加 Avalonia 作业报告内容与截图占位 |
| docs/03-async-grpc/report.md | 添加 async/grpc 作业报告内容与截图占位 |
| docs/02-multithreading/report.md | 添加 multithreading 问答题作答 |
| docs/01-basic/report.md | 添加 basic 问答题作答 |
| .gitignore | 忽略 Obsidian/.zcode 等本地工作目录 |
Review details
- Files reviewed: 19/25 changed files
- Comments generated: 12
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+215
to
+228
| Console.WriteLine($"Analysis result for {fileName}:"); | ||
| Console.WriteLine($"- State: {result.State}"); | ||
| if (result.State == AnalysisState.Failed) | ||
| { | ||
| Console.WriteLine($"- Error message: {result.ErrorMessage}"); | ||
| } | ||
| else | ||
| { | ||
| Console.WriteLine($"- Number of entries: {result.Entries.Count}"); | ||
| foreach (var entry in result.Entries) | ||
| { | ||
| Console.WriteLine($" - {entry.Timestamp}"); | ||
| } | ||
| } |
Comment on lines
+158
to
+169
| responses.Add(new GetAnalysisResultResponse() | ||
| { | ||
| Header = new AnalysisResultHeaderMessage() | ||
| { | ||
| FileName = result.FileName, | ||
| FullName = result.FullName, | ||
| State = GrpcTypeConverter.ConvertToGrpc(result.State), | ||
| WorkerId = result.WorkerId, | ||
| ErrorMessage = result.ErrorMessage ?? "", | ||
| }, | ||
| Status = CreateNoErrorOperationStatus(), | ||
| }); |
Comment on lines
+233
to
+234
| var entry = call.ResponseStream.Current; | ||
| switch (entry.PayloadCase) |
Comment on lines
+239
to
+241
| case AnalysisStateEnum.NotAnalyzed: | ||
| ResultEntries.Add(new LogFields(0, new List<LogFieldItem>(), null)); | ||
| break; |
Comment on lines
+213
to
+214
| var result = call.ResponseStream.Current; | ||
| switch (result.PayloadCase) { |
Comment on lines
+18
to
+21
| ![[report-01-xxx.png]] | ||
|
|
||
| ![[report-02-xxx.png]] | ||
| ![[report-03-xxx.png]] |
Comment on lines
+163
to
+170
| if (!_analysisResults.TryGetValue(file.Name, out var isExist)) | ||
| { | ||
| throw new InvalidOperationException($"Unknown file '{file.FullName}'."); | ||
| } | ||
| if (isExist.State != AnalysisState.Succeeded) | ||
| { | ||
| logFilesToParse.Add(file); | ||
| } |
Comment on lines
+14
to
+18
| public string Summary => ErrorMessage is not null | ||
| ? $"Analyze Failed, Error: {ErrorMessage}" | ||
| : Fields.Count == 0 | ||
| ? "No fields Found" | ||
| : $"#{Index} " + string.Join(", ", Fields.Select(f => $"{f.Key}: {f.Value}")); |
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Collections.ObjectModel; | ||
| using System.Diagnostics; |
Comment on lines
+69
to
+83
| var internalMessage = JsonSerializer.Deserialize<InternalMessage>(logRecord.Message, options) | ||
| ?? throw new FormatException($"Failed to deserialize internal message: {logRecord.Message}"); | ||
| var exceptionspilt = internalMessage.Exception.IndexOf(": "); | ||
| if (exceptionspilt == -1) | ||
| { | ||
| throw new FormatException($"Invalid exception format: {internalMessage.Exception}"); | ||
| } | ||
| return new InternalLogEntry( | ||
| LineNo: logRecord.LineNo, | ||
| Timestamp: DateTimeOffset.Parse(logRecord.Timestamp), | ||
| PodName: logRecord.PodName, | ||
| Severity: ParseSeverity(internalMessage.Severity), | ||
| ExceptionName: internalMessage.Exception.Substring(0, exceptionspilt), | ||
| ExceptionMessage: internalMessage.Exception.Substring(exceptionspilt + 2) | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
暑培:队式作业提交
基本信息
提交说明
04-avalonia作业提交通道 #35