Skip to content

Homework/04 avalonia - #141

Open
invincible-summer wants to merge 4 commits into
eesast:homework/04-avaloniafrom
invincible-summer:homework/04-avalonia
Open

Homework/04 avalonia#141
invincible-summer wants to merge 4 commits into
eesast:homework/04-avaloniafrom
invincible-summer:homework/04-avalonia

Conversation

@invincible-summer

Copy link
Copy Markdown

暑培:队式作业提交

基本信息

  • 姓名:杨钧富
  • 班级:无51
  • 学号:2025010180

提交说明

Copilot AI lite review requested due to automatic review settings September 3, 2026 04:45
@mergify mergify Bot added the homework Homework PR, will not be merged label Sep 3, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 thread src/LocalCli/Program.cs
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 thread src/RemoteCli/Program.cs
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)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

homework Homework PR, will not be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants