Skip to content

Commit c4678e8

Browse files
committed
# This is a combination of 9 commits.
# This is the 1st commit message: feat(render): expand DataTree render scenarios and persist benchmark timings standardize DataTree test data with predictable field naming across scenarios add per-scenario timing capture and write results to datatree-timings.json add Newtonsoft.Json to DetailControlsTests for timing serialization add render-testing skill documentation for baseline and benchmark workflow remove obsolete generated Build/FieldWorks.targets.bad file update checked-in test result artifact for current render test run fix: resolve build blocker + timing test layout gaps - Remove duplicate Kernel project entry in FieldWorks.sln that blocked NuGet restore (first entry was missing EndProject) - Add CitationForm and Senses parts to test Normal layout so timing tests produce real slices instead of 0 - Add LexSense-Detail-Senses part and subsense recursion to GlossSn layout so WorkloadGrowsWithComplexity test correctly validates that deeper scenarios produce more slices - Include user edits to implementation-paths.md OS-3: All 4 DataTreeTiming tests now pass perf: add render-testing workflow + timing enhancement log - Update render-testing skill with explicit devil's advocate stage, retest/review, and mandatory TIMING_ENHANCEMENTS.md before commit. - Refine DataTree tab-index optimization safety by moving final ResetTabIndices(0) to CreateSlices finally. - Keep DeepSuspendLayout/DeepResumeLayout batching in DummyObjectSlice.BecomeReal. - Mark OS-3 and OS-5 complete in OpenSpec tasks and add TIMING_ENHANCEMENTS.md with measured outcomes. Validation: build.ps1 -BuildTests; test.ps1 -TestFilter DataTreeTiming -NoBuild perf: paint pipeline optimization — clip-rect culling + double-buffering - HandlePaintLinesBetweenSlices: skip separator lines outside paint clip rect, reducing per-paint iteration from O(N) to O(visible) during scroll/partial repaints. Avoids O(N) XML attribute parsing on off-screen slices. - DataTree constructor: enable OptimizedDoubleBuffer + AllPaintingInWmPaint to eliminate flicker during paint. - Add DataTreeTiming_PaintPerformance test for paint-time regression detection. - Update render-testing skill with test coverage assessment step. - Update TIMING_ENHANCEMENTS.md with enhancements 3 and 4. perf: layout path optimization — early-exit guard, construction skip, paint-path skip Enhancement 5: Slice.SetWidthForDataTreeLayout returns early when m_widthHasBeenSetByDataTree && Width == width, avoiding redundant splitter resizing and event handler churn on every layout pass. Enhancement 6: DataTree.OnSizeChanged skips the O(N) splitter adjustment loop during ConstructingSlices. HandleLayout1(fFull=true) handles width synchronization after construction completes. Enhancement 7: HandleLayout1 paint path (fFull=false) skips SetWidthForDataTreeLayout for non-visible slices, reducing width-sync work from O(N) to O(K) per paint where K is visible slice count. Also fixes RemoveDuplicateCustomFields test to match Test.fwlayout Normal layout changes from prior commit. perf: XML attribute caching + MakeSliceVisible high-water mark Enhancement 8: Cache header/skipSpacerLine/sameObject XML attributes on Slice as lazy bool? fields. Eliminates per-paint XML parsing in HandlePaintLinesBetweenSlices (~2,700 XML lookups/sec at 60Hz with 15 visible slices reduced to 0 after first access). Enhancement 9: Change MakeSliceVisible from static to instance method. Pass known index from HandleLayout1 caller (avoids O(N) IndexOf). Track m_lastVisibleHighWaterMark so the inner 'make preceding visible' loop amortizes to O(N) total instead of O(N*V). Preserves the .NET Framework bug workaround (LT-7307). Reset mark in CreateSlices. perf: construction-path guards + optimization regression tests Enhancement 10: Skip ResetTabIndices in RemoveSlice during ConstructingSlices. Mirror of Enhancement 1 — the finally block in CreateSlices already does a single ResetTabIndices(0) after all removals/insertions complete. Enhancement 11: Skip AdjustSliceSplitPosition in InstallSlice during ConstructingSlices. HandleLayout1(fFull=true) sets correct widths + splitter positions after construction, making per-insert adjustment redundant. Added 7 optimization regression tests (DataTreeOpt_ prefix): - WidthStabilityAfterLayout (Enhancement 5) - AllViewportSlicesVisible (Enhancement 9) - XmlCacheConsistency (Enhancement 8) - XmlCacheInvalidationOnConfigChange (Enhancement 8) - SequentialPaintsProduceIdenticalOutput (Enhancements 3,4,7,8) - SlicePositionsMonotonicallyIncreasing (Enhancement 3) - IsHeaderNodeDelegatesToCachedProperty (Enhancement 8) All 12 DataTree tests pass (5 timing + 7 optimization). # This is the commit message #2: feat: Enhancement 12 — binary search in HandleLayout1 paint path Add FindFirstPotentiallyVisibleSlice binary search to skip above-viewport slices during paint-path layout. Addresses JohnT's original TODO in OnPaint. - HandleLayout1 now starts iteration at the first potentially visible slice (with -1 safety margin) instead of index 0 on paint-path calls - Timing improvements: shallow -71%, deep -20%, extreme -7%, paint -11% - 5 binary-search risk-reduction tests added (DataTreeOpt_ prefix) - Regenerate snapshot baselines after layout/parts changes from 64ab221 - Add mandatory snapshot regression check (Step 6) to render-testing skill - Update TIMING_ENHANCEMENTS.md with E12 measurements and devil's advocate # This is the commit message #3: The real optimization - HWND virtualization # This is the commit message #4: fix: correct VwDrawRootBuffered coordinate mapping + trailing separator bars Three rendering quality fixes for the snapshot capture pipeline: 1. VwDrawRootBuffered coordinate fix (CompositeViewCapture.cs): GetCoordRects returns rcDst in rootSite-local coordinates (origin at HorizMargin, 0). The overlay code was passing clientRect with the rootSite's position relative to the DataTree (e.g. X=175), causing VwDrawRootBuffered to offset rcDst by (-175, -y) and render content at negative X — clipping or hiding it entirely. Fix: render each rootSite into a temp bitmap at local coords (0,0,w,h), then composite into the main bitmap at the correct DataTree-relative position. 2. EnsureAllSlicesInitialized uses BecomeRealInPlace (CompositeViewCapture.cs): Replaced manual handle-forcing with the production ViewSlice initialization path, which sets AllowLayout=true and triggers rootBox.Layout with the correct width. 3. Trailing separator bar removal (VectorReferenceView.cs, PossibilityVectorReferenceView.cs): DisplayVec called AddSeparatorBar after every item including the last, causing VwSeparatorBox to draw unwanted grey bars after single/final items like 'Main Dictionary'. Added guard to only add separators between items. Baselines regenerated — all 6 scenarios show 40-70% more rendered content. All 23 DataTree tests pass (timing + optimization + snapshots). # This is the commit message #5: Added tests before virtualization # This is the commit message #6: update renders # This is the commit message #7: Hwnd implementation started # This is the commit message #8: upgrade openspec # This is the commit message #9: hwnd implementation
1 parent bcfbea0 commit c4678e8

File tree

167 files changed

+30813
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+30813
-297
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# OS files
2+
.DS_Store
3+
Thumbs.db
4+
5+
# Editor files
6+
*.swp
7+
*.swo
8+
*~
9+
.idea/
10+
.vscode/
11+
12+
# Python
13+
__pycache__/
14+
*.py[cod]
15+
*.egg-info/
16+
.eggs/
17+
dist/
18+
build/
19+
20+
# Logs
21+
*.log
22+
23+
# Local config
24+
.env
25+
.env.local
Lines changed: 321 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,321 @@
1+
# Contributing to AI Code Review Guide
2+
3+
Thank you for your interest in contributing! This document provides guidelines for contributing to this Claude Code Skill project.
4+
5+
## Claude Code Skill 开发规范
6+
7+
本项目是一个 Claude Code Skill,贡献者需要遵循以下规范。
8+
9+
### 目录结构
10+
11+
```
12+
ai-code-review-guide/
13+
├── SKILL.md # 必需:主文件(始终加载)
14+
├── README.md # 项目说明文档
15+
├── CONTRIBUTING.md # 贡献指南(本文件)
16+
├── LICENSE # 许可证
17+
├── reference/ # 按需加载的详细指南
18+
│ ├── react.md
19+
│ ├── vue.md
20+
│ ├── rust.md
21+
│ ├── typescript.md
22+
│ ├── python.md
23+
│ ├── c.md
24+
│ ├── cpp.md
25+
│ ├── common-bugs-checklist.md
26+
│ ├── security-review-guide.md
27+
│ └── code-review-best-practices.md
28+
├── assets/ # 模板和快速参考
29+
│ ├── review-checklist.md
30+
│ └── pr-review-template.md
31+
└── scripts/ # 工具脚本
32+
└── pr-analyzer.py
33+
```
34+
35+
### Frontmatter 规范
36+
37+
SKILL.md 必须包含 YAML frontmatter:
38+
39+
```yaml
40+
---
41+
name: skill-name
42+
description: |
43+
功能描述。触发条件说明。
44+
Use when [具体使用场景]。
45+
allowed-tools: ["Read", "Grep", "Glob"] # 可选:限制工具访问
46+
---
47+
```
48+
49+
#### 必需字段
50+
51+
| 字段 | 说明 | 约束 |
52+
|------|------|------|
53+
| `name` | Skill 标识符 | 小写字母、数字、连字符;最多 64 字符 |
54+
| `description` | 功能和激活条件 | 最多 1024 字符;必须包含 "Use when" |
55+
56+
#### 可选字段
57+
58+
| 字段 | 说明 | 示例 |
59+
|------|------|------|
60+
| `allowed-tools` | 限制工具访问 | `["Read", "Grep", "Glob"]` |
61+
62+
### 命名约定
63+
64+
**Skill 名称规则**
65+
- 仅使用小写字母、数字和连字符(kebab-case)
66+
- 最多 64 个字符
67+
- 避免下划线或大写字母
68+
69+
```
70+
✅ 正确:code-review-excellence, typescript-advanced-types
71+
❌ 错误:CodeReview, code_review, TYPESCRIPT
72+
```
73+
74+
**文件命名规则**
75+
- reference 文件使用小写:`react.md`, `vue.md`
76+
- 多词文件使用连字符:`common-bugs-checklist.md`
77+
78+
### Description 写法规范
79+
80+
Description 必须包含两部分:
81+
82+
1. **功能陈述**:具体说明 Skill 能做什么
83+
2. **触发条件**:以 "Use when" 开头,说明何时激活
84+
85+
```yaml
86+
# ✅ 正确示例
87+
description: |
88+
Provides comprehensive code review guidance for React 19, Vue 3, Rust,
89+
TypeScript, Java, Python, and C/C++.
90+
Helps catch bugs, improve code quality, and give constructive feedback.
91+
Use when reviewing pull requests, conducting PR reviews, establishing
92+
review standards, or mentoring developers through code reviews.
93+
94+
# ❌ 错误示例(太模糊,缺少触发条件)
95+
description: |
96+
Helps with code review.
97+
```
98+
99+
### Progressive Disclosure(渐进式披露)
100+
101+
Claude 只在需要时加载支持文件,不会一次性加载所有内容。
102+
103+
#### 文件职责划分
104+
105+
| 文件 | 加载时机 | 内容 |
106+
|------|----------|------|
107+
| `SKILL.md` | 始终加载 | 核心原则、快速索引、何时使用 |
108+
| `reference/*.md` | 按需加载 | 语言/框架的详细指南 |
109+
| `assets/*.md` | 明确需要时 | 模板、清单 |
110+
| `scripts/*.py` | 明确指引时 | 工具脚本 |
111+
112+
#### 内容组织原则
113+
114+
**SKILL.md**(~200 行以内):
115+
- 简述:2-3 句话说明用途
116+
- 核心原则和方法论
117+
- 语言/框架索引表(链接到 reference/)
118+
- 何时使用此 Skill
119+
120+
**reference/*.md**(详细内容):
121+
- 完整的代码示例
122+
- 所有最佳实践
123+
- Review Checklist
124+
- 边界情况和陷阱
125+
126+
### 文件引用规范
127+
128+
在 SKILL.md 中引用其他文件时:
129+
130+
```markdown
131+
# ✅ 正确:使用 Markdown 链接格式
132+
| **React** | [React Guide](reference/react.md) | Hooks, React 19, RSC |
133+
| **Vue 3** | [Vue Guide](reference/vue.md) | Composition API |
134+
135+
详见 [React Guide](reference/react.md) 获取完整指南。
136+
137+
# ❌ 错误:使用代码块格式
138+
参考 `reference/react.md` 文件。
139+
```
140+
141+
**路径规则**
142+
- 使用相对路径(相对于 Skill 目录)
143+
- 使用正斜杠 `/`,不使用反斜杠
144+
- 不需要 `./` 前缀
145+
146+
---
147+
148+
## 贡献类型
149+
150+
### 添加新语言支持
151+
152+
1.`reference/` 目录创建新文件(如 `go.md`
153+
2. 遵循以下结构:
154+
155+
```markdown
156+
# [Language] Code Review Guide
157+
158+
> 简短描述,一句话说明覆盖内容。
159+
160+
## 目录
161+
- [主题1](#主题1)
162+
- [主题2](#主题2)
163+
- [Review Checklist](#review-checklist)
164+
165+
---
166+
167+
## 主题1
168+
169+
### 子主题
170+
171+
```[language]
172+
// ❌ Bad pattern - 说明为什么不好
173+
bad_code_example()
174+
175+
// ✅ Good pattern - 说明为什么好
176+
good_code_example()
177+
```
178+
179+
---
180+
181+
## Review Checklist
182+
183+
### 类别1
184+
- [ ] 检查项 1
185+
- [ ] 检查项 2
186+
```
187+
188+
3.`SKILL.md` 的索引表中添加链接
189+
4. 更新 `README.md` 的统计信息
190+
191+
### 添加框架模式
192+
193+
1. 确保引用官方文档
194+
2. 包含版本号(如 "React 19", "Vue 3.5+")
195+
3. 提供可运行的代码示例
196+
4. 添加对应的 checklist 项
197+
198+
### 改进现有内容
199+
200+
- 修复拼写或语法错误
201+
- 更新过时的模式(注明版本变化)
202+
- 添加边界情况示例
203+
- 改进代码示例的清晰度
204+
205+
---
206+
207+
## 代码示例规范
208+
209+
### 格式要求
210+
211+
```markdown
212+
// ❌ 问题描述 - 解释为什么这样做不好
213+
problematic_code()
214+
215+
// ✅ 推荐做法 - 解释为什么这样做更好
216+
recommended_code()
217+
```
218+
219+
### 质量标准
220+
221+
- 示例应基于真实场景,避免人为构造
222+
- 同时展示问题和解决方案
223+
- 保持示例简洁聚焦
224+
- 包含必要的上下文(import 语句等)
225+
226+
---
227+
228+
## 提交流程
229+
230+
### Issue 报告
231+
232+
- 使用 GitHub Issues 报告问题或建议
233+
- 提供清晰的描述和示例
234+
- 标注相关的语言/框架
235+
236+
### Pull Request 流程
237+
238+
1. Fork 仓库
239+
2. 创建功能分支:`git checkout -b feature/add-go-support`
240+
3. 进行修改
241+
4. 提交(见下文 commit 格式)
242+
5. 推送到 fork:`git push origin feature/add-go-support`
243+
6. 创建 Pull Request
244+
245+
### Commit 消息格式
246+
247+
```
248+
类型: 简短描述
249+
250+
详细说明(如需要)
251+
252+
- 具体变更 1
253+
- 具体变更 2
254+
```
255+
256+
**类型**
257+
- `feat`: 新功能或新内容
258+
- `fix`: 修复错误
259+
- `docs`: 仅文档变更
260+
- `refactor`: 重构(不改变功能)
261+
- `chore`: 维护性工作
262+
263+
**示例**
264+
```
265+
feat: 添加 Go 语言代码审查指南
266+
267+
- 新增 reference/go.md
268+
- 覆盖错误处理、并发、接口设计
269+
- 更新 SKILL.md 索引表
270+
```
271+
272+
---
273+
274+
## Skill 设计原则
275+
276+
### 单一职责
277+
278+
每个 Skill 专注一个核心能力。本 Skill 专注于**代码审查**,不应扩展到:
279+
- 代码生成
280+
- 项目初始化
281+
- 部署配置
282+
283+
### 版本管理
284+
285+
- 在 reference 文件中标注框架/语言版本
286+
- 更新时在 commit 中说明版本变化
287+
- 过时内容应更新而非删除(除非完全废弃)
288+
289+
### 内容质量
290+
291+
- 所有建议应有依据(官方文档、最佳实践)
292+
- 避免主观偏好(如代码风格),专注于客观问题
293+
- 优先覆盖常见陷阱和安全问题
294+
295+
---
296+
297+
## 常见问题
298+
299+
### Q: 如何测试我的更改?
300+
301+
将修改后的 Skill 复制到 `~/.claude/skills/` 目录,然后在 Claude Code 中测试:
302+
```bash
303+
cp -r ai-code-review-guide ~/.claude/skills/code-review-excellence
304+
```
305+
306+
### Q: 我应该更新 SKILL.md 还是 reference 文件?
307+
308+
- **SKILL.md**:只修改索引表或核心原则
309+
- **reference/*.md**:添加/更新具体的语言或框架内容
310+
311+
### Q: 如何处理过时的内容?
312+
313+
1. 标注版本变化(如 "React 18 → React 19")
314+
2. 保留旧版本内容(如果仍有用户使用)
315+
3. 在 checklist 中更新相关项
316+
317+
---
318+
319+
## 问题咨询
320+
321+
如有任何问题,欢迎在 GitHub Issues 中提问。
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 tt-a1i
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)