v0.3.0 d226234

tasks.md RawHistoryFolder

Tasks: WebKit Memory Optimization

Input: Design documents from /specs/005-webkit-memory-optimization/ Prerequisites: plan.md (required), research.md, data-model.md, contracts/

Execution Flow (main)

1. Load plan.md from feature directory
   → Extract: Go 1.25.1 + CGO, WebKit2GTK 6.0, memory optimization approach
2. Load optional design documents:
   → data-model.md: MemoryConfig, MemoryStats, ProcessMemoryInfo, WebViewMemoryManager → model tasks
   → contracts/webkit_memory_api.go: 4 interfaces → contract test tasks
   → quickstart.md: 5 validation scenarios → integration test tasks
3. Generate tasks by category:
   → Setup: CGO configuration, WebKit dependencies, linting
   → Tests: contract tests, integration tests for memory reduction
   → Core: memory configuration, stats tracking, WebKit integration
   → Integration: process monitoring, GC management, recycling logic
   → Polish: unit tests, performance validation, documentation
4. Apply task rules:
   → Different files = mark [P] for parallel
   → WebKit integration = sequential (shared CGO context)
   → Tests before implementation (TDD)
5. Number tasks sequentially (T001, T002...)
6. Generate dependency graph
7. Create parallel execution examples
8. Validate: All contracts tested, all entities modeled, all scenarios covered
9. Return: SUCCESS (tasks ready for execution)

Format: [ID] [P?] Description

  • [P]: Can run in parallel (different files, no dependencies)
  • Include exact file paths in descriptions

Path Conventions

  • Single project: pkg/webkit/ for WebKit bindings enhancement
  • Tests in tests/contract/, tests/integration/, tests/unit/
  • Memory optimization files in pkg/webkit/ package

Phase 3.1: Setup

  • T001 Verify WebKit2GTK 6.0+ dependencies and CGO build environment
  • T002 Configure webkit_cgo build tags in existing project structure
  • T003 [P] Update linting rules for CGO memory safety patterns

Phase 3.2: Tests First (TDD) ⚠️ MUST COMPLETE BEFORE 3.3

CRITICAL: These tests MUST be written and MUST FAIL before ANY implementation

  • T004 [P] Contract test WebKitMemoryAPI in tests/contract/test_webkit_memory_api_test.go
  • T005 [P] Contract test MemoryConfigAPI in tests/contract/test_memory_config_api_test.go
  • T006 [P] Contract test MemoryStatsAPI in tests/contract/test_memory_stats_api_test.go
  • T007 [P] Contract test WebViewLifecycleAPI in tests/contract/test_webview_lifecycle_api_test.go
  • T008 [P] Integration test memory reduction scenario in tests/integration/test_memory_reduction_test.go
  • T009 [P] Integration test memory stability scenario in tests/integration/test_memory_stability_test.go
  • T010 [P] Integration test process recycling scenario in tests/integration/test_process_recycling_test.go
  • T011 [P] Integration test memory monitoring scenario in tests/integration/test_memory_monitoring_test.go
  • T012 [P] Integration test optimization presets scenario in tests/integration/test_optimization_presets_test.go

Phase 3.3: Core Implementation (ONLY after tests are failing)

  • T013 [P] MemoryConfig struct with validation in pkg/webkit/memory_config.go
  • T014 [P] ProcessMemoryInfo struct and parsing logic in pkg/webkit/process_memory.go
  • T015 [P] Optimization preset configurations in pkg/webkit/memory_presets.go
  • T016 WebViewMemoryManager singleton in pkg/webkit/memory_manager.go
  • T017 WebKit memory pressure settings integration in pkg/webkit/webview_cgo.go
  • T018 Cache model configuration in pkg/webkit/webview_cgo.go
  • T019 JavaScript garbage collection triggers in pkg/webkit/webview_cgo.go
  • T020 Page cache and offline cache controls in pkg/webkit/webview_cgo.go
  • T021 Memory statistics tracking in pkg/webkit/webview_cgo.go

Phase 3.4: Integration

  • T022 Process memory monitoring via /proc filesystem in pkg/webkit/memory_manager.go
  • T023 Memory pressure callback handling in pkg/webkit/webview_cgo.go
  • T024 Periodic garbage collection scheduler in pkg/webkit/webview_cgo.go
  • T025 Process recycling recommendation logic in pkg/webkit/memory_manager.go
  • T026 Memory event logging and monitoring in pkg/webkit/memory_manager.go

Phase 3.5: Polish

  • T027 [P] Unit tests for MemoryConfig validation in tests/unit/test_memory_config_test.go
  • T028 [P] Unit tests for ProcessMemoryInfo parsing in tests/unit/test_process_memory_test.go
  • T029 [P] Unit tests for optimization presets in tests/unit/test_memory_presets_test.go
  • T030 Performance validation: 40-60% memory reduction benchmark
  • T031 [P] Update CLAUDE.md with memory optimization context
  • T032 Memory safety review for CGO pointer management
  • T033 Execute quickstart.md validation scenarios

Dependencies

  • Setup (T001-T003) before all other tasks
  • Contract tests (T004-T007) before any implementation
  • Integration tests (T008-T012) before implementation
  • T013-T015 (data models) before T016-T021 (WebKit integration)
  • T017-T021 (WebKit changes) are sequential (shared webview_cgo.go file)
  • T022-T026 (integration features) depend on T016-T021
  • Polish (T027-T033) after all core implementation

Parallel Example

# Launch contract tests together (T004-T007):
Task: "Contract test WebKitMemoryAPI in tests/contract/test_webkit_memory_api_test.go"
Task: "Contract test MemoryConfigAPI in tests/contract/test_memory_config_api_test.go" 
Task: "Contract test MemoryStatsAPI in tests/contract/test_memory_stats_api_test.go"
Task: "Contract test WebViewLifecycleAPI in tests/contract/test_webview_lifecycle_api_test.go"

# Launch integration tests together (T008-T012):
Task: "Integration test memory reduction in tests/integration/test_memory_reduction_test.go"
Task: "Integration test memory stability in tests/integration/test_memory_stability_test.go"
Task: "Integration test process recycling in tests/integration/test_process_recycling_test.go"

# Launch data model implementations together (T013-T015):
Task: "MemoryConfig struct with validation in pkg/webkit/memory_config.go"
Task: "ProcessMemoryInfo struct and parsing in pkg/webkit/process_memory.go"
Task: "Optimization preset configurations in pkg/webkit/memory_presets.go"

Notes

  • WebKit2GTK 6.0 memory pressure APIs are the core technical dependency
  • CGO memory safety requires careful pointer management and finalizers
  • Tests must use real WebKit processes for accurate memory measurements
  • Memory reduction target: 400MB → 150-250MB (40-60% reduction)
  • All WebKit integration changes modify shared webview_cgo.go file (sequential)

Task Generation Rules

Applied during main() execution

  1. From Contracts:

    • WebKitMemoryAPI → T004 contract test, T017-T021 implementation
    • MemoryConfigAPI → T005 contract test, T013 implementation
    • MemoryStatsAPI → T006 contract test, T021 implementation
    • WebViewLifecycleAPI → T007 contract test, T025 implementation
  2. From Data Model:

    • MemoryConfig entity → T013 model creation task [P]
    • ProcessMemoryInfo entity → T014 model creation task [P]
    • WebViewMemoryManager entity → T016 manager implementation
    • MemoryStats → integrated into WebView (T021)
  3. From Quickstart Scenarios:

    • Memory reduction validation → T008 integration test [P]
    • Memory stability testing → T009 integration test [P]
    • Process recycling testing → T010 integration test [P]
    • Memory monitoring testing → T011 integration test [P]
    • Optimization presets testing → T012 integration test [P]
  4. Ordering:

    • Setup → Contract tests → Integration tests → Models → WebKit integration → Polish
    • Data models before WebKit integration
    • WebKit integration tasks sequential due to shared file

Validation Checklist

GATE: Checked by main() before returning

  • All contracts have corresponding tests (T004-T007)
  • All entities have model tasks (T013-T016)
  • All tests come before implementation (T004-T012 before T013+)
  • Parallel tasks truly independent (different files, no shared dependencies)
  • Each task specifies exact file path
  • No task modifies same file as another [P] task (webview_cgo.go tasks are sequential)
  • Memory reduction goal (40-60%) addressed in T008, T030
  • All quickstart scenarios covered (T008-T012, T033)
  • CGO memory safety addressed (T032)
source
1# Tasks: WebKit Memory Optimization
2
3**Input**: Design documents from `/specs/005-webkit-memory-optimization/`
4**Prerequisites**: plan.md (required), research.md, data-model.md, contracts/
5
6## Execution Flow (main)
7```
81. Load plan.md from feature directory
9   → Extract: Go 1.25.1 + CGO, WebKit2GTK 6.0, memory optimization approach
102. Load optional design documents:
11   → data-model.md: MemoryConfig, MemoryStats, ProcessMemoryInfo, WebViewMemoryManager → model tasks
12   → contracts/webkit_memory_api.go: 4 interfaces → contract test tasks
13   → quickstart.md: 5 validation scenarios → integration test tasks
143. Generate tasks by category:
15   → Setup: CGO configuration, WebKit dependencies, linting
16   → Tests: contract tests, integration tests for memory reduction
17   → Core: memory configuration, stats tracking, WebKit integration
18   → Integration: process monitoring, GC management, recycling logic
19   → Polish: unit tests, performance validation, documentation
204. Apply task rules:
21   → Different files = mark [P] for parallel
22   → WebKit integration = sequential (shared CGO context)
23   → Tests before implementation (TDD)
245. Number tasks sequentially (T001, T002...)
256. Generate dependency graph
267. Create parallel execution examples
278. Validate: All contracts tested, all entities modeled, all scenarios covered
289. Return: SUCCESS (tasks ready for execution)
29```
30
31## Format: `[ID] [P?] Description`
32- **[P]**: Can run in parallel (different files, no dependencies)
33- Include exact file paths in descriptions
34
35## Path Conventions
36- **Single project**: `pkg/webkit/` for WebKit bindings enhancement
37- Tests in `tests/contract/`, `tests/integration/`, `tests/unit/`
38- Memory optimization files in `pkg/webkit/` package
39
40## Phase 3.1: Setup
41- [ ] T001 Verify WebKit2GTK 6.0+ dependencies and CGO build environment
42- [ ] T002 Configure webkit_cgo build tags in existing project structure
43- [ ] T003 [P] Update linting rules for CGO memory safety patterns
44
45## Phase 3.2: Tests First (TDD) ⚠️ MUST COMPLETE BEFORE 3.3
46**CRITICAL: These tests MUST be written and MUST FAIL before ANY implementation**
47- [ ] T004 [P] Contract test WebKitMemoryAPI in tests/contract/test_webkit_memory_api_test.go
48- [ ] T005 [P] Contract test MemoryConfigAPI in tests/contract/test_memory_config_api_test.go
49- [ ] T006 [P] Contract test MemoryStatsAPI in tests/contract/test_memory_stats_api_test.go
50- [ ] T007 [P] Contract test WebViewLifecycleAPI in tests/contract/test_webview_lifecycle_api_test.go
51- [ ] T008 [P] Integration test memory reduction scenario in tests/integration/test_memory_reduction_test.go
52- [ ] T009 [P] Integration test memory stability scenario in tests/integration/test_memory_stability_test.go
53- [ ] T010 [P] Integration test process recycling scenario in tests/integration/test_process_recycling_test.go
54- [ ] T011 [P] Integration test memory monitoring scenario in tests/integration/test_memory_monitoring_test.go
55- [ ] T012 [P] Integration test optimization presets scenario in tests/integration/test_optimization_presets_test.go
56
57## Phase 3.3: Core Implementation (ONLY after tests are failing)
58- [ ] T013 [P] MemoryConfig struct with validation in pkg/webkit/memory_config.go
59- [ ] T014 [P] ProcessMemoryInfo struct and parsing logic in pkg/webkit/process_memory.go
60- [ ] T015 [P] Optimization preset configurations in pkg/webkit/memory_presets.go
61- [ ] T016 WebViewMemoryManager singleton in pkg/webkit/memory_manager.go
62- [ ] T017 WebKit memory pressure settings integration in pkg/webkit/webview_cgo.go
63- [ ] T018 Cache model configuration in pkg/webkit/webview_cgo.go
64- [ ] T019 JavaScript garbage collection triggers in pkg/webkit/webview_cgo.go
65- [ ] T020 Page cache and offline cache controls in pkg/webkit/webview_cgo.go
66- [ ] T021 Memory statistics tracking in pkg/webkit/webview_cgo.go
67
68## Phase 3.4: Integration
69- [ ] T022 Process memory monitoring via /proc filesystem in pkg/webkit/memory_manager.go
70- [ ] T023 Memory pressure callback handling in pkg/webkit/webview_cgo.go
71- [ ] T024 Periodic garbage collection scheduler in pkg/webkit/webview_cgo.go
72- [ ] T025 Process recycling recommendation logic in pkg/webkit/memory_manager.go
73- [ ] T026 Memory event logging and monitoring in pkg/webkit/memory_manager.go
74
75## Phase 3.5: Polish
76- [ ] T027 [P] Unit tests for MemoryConfig validation in tests/unit/test_memory_config_test.go
77- [ ] T028 [P] Unit tests for ProcessMemoryInfo parsing in tests/unit/test_process_memory_test.go
78- [ ] T029 [P] Unit tests for optimization presets in tests/unit/test_memory_presets_test.go
79- [ ] T030 Performance validation: 40-60% memory reduction benchmark
80- [ ] T031 [P] Update CLAUDE.md with memory optimization context
81- [ ] T032 Memory safety review for CGO pointer management
82- [ ] T033 Execute quickstart.md validation scenarios
83
84## Dependencies
85- Setup (T001-T003) before all other tasks
86- Contract tests (T004-T007) before any implementation
87- Integration tests (T008-T012) before implementation
88- T013-T015 (data models) before T016-T021 (WebKit integration)
89- T017-T021 (WebKit changes) are sequential (shared webview_cgo.go file)
90- T022-T026 (integration features) depend on T016-T021
91- Polish (T027-T033) after all core implementation
92
93## Parallel Example
94```
95# Launch contract tests together (T004-T007):
96Task: "Contract test WebKitMemoryAPI in tests/contract/test_webkit_memory_api_test.go"
97Task: "Contract test MemoryConfigAPI in tests/contract/test_memory_config_api_test.go" 
98Task: "Contract test MemoryStatsAPI in tests/contract/test_memory_stats_api_test.go"
99Task: "Contract test WebViewLifecycleAPI in tests/contract/test_webview_lifecycle_api_test.go"
100
101# Launch integration tests together (T008-T012):
102Task: "Integration test memory reduction in tests/integration/test_memory_reduction_test.go"
103Task: "Integration test memory stability in tests/integration/test_memory_stability_test.go"
104Task: "Integration test process recycling in tests/integration/test_process_recycling_test.go"
105
106# Launch data model implementations together (T013-T015):
107Task: "MemoryConfig struct with validation in pkg/webkit/memory_config.go"
108Task: "ProcessMemoryInfo struct and parsing in pkg/webkit/process_memory.go"
109Task: "Optimization preset configurations in pkg/webkit/memory_presets.go"
110```
111
112## Notes
113- WebKit2GTK 6.0 memory pressure APIs are the core technical dependency
114- CGO memory safety requires careful pointer management and finalizers
115- Tests must use real WebKit processes for accurate memory measurements
116- Memory reduction target: 400MB → 150-250MB (40-60% reduction)
117- All WebKit integration changes modify shared webview_cgo.go file (sequential)
118
119## Task Generation Rules
120*Applied during main() execution*
121
1221. **From Contracts**:
123   - WebKitMemoryAPI → T004 contract test, T017-T021 implementation
124   - MemoryConfigAPI → T005 contract test, T013 implementation
125   - MemoryStatsAPI → T006 contract test, T021 implementation
126   - WebViewLifecycleAPI → T007 contract test, T025 implementation
127   
1282. **From Data Model**:
129   - MemoryConfig entity → T013 model creation task [P]
130   - ProcessMemoryInfo entity → T014 model creation task [P]
131   - WebViewMemoryManager entity → T016 manager implementation
132   - MemoryStats → integrated into WebView (T021)
133   
1343. **From Quickstart Scenarios**:
135   - Memory reduction validation → T008 integration test [P]
136   - Memory stability testing → T009 integration test [P]
137   - Process recycling testing → T010 integration test [P]
138   - Memory monitoring testing → T011 integration test [P]
139   - Optimization presets testing → T012 integration test [P]
140
1414. **Ordering**:
142   - Setup → Contract tests → Integration tests → Models → WebKit integration → Polish
143   - Data models before WebKit integration
144   - WebKit integration tasks sequential due to shared file
145
146## Validation Checklist
147*GATE: Checked by main() before returning*
148
149- [x] All contracts have corresponding tests (T004-T007)
150- [x] All entities have model tasks (T013-T016)
151- [x] All tests come before implementation (T004-T012 before T013+)
152- [x] Parallel tasks truly independent (different files, no shared dependencies)
153- [x] Each task specifies exact file path
154- [x] No task modifies same file as another [P] task (webview_cgo.go tasks are sequential)
155- [x] Memory reduction goal (40-60%) addressed in T008, T030
156- [x] All quickstart scenarios covered (T008-T012, T033)
157- [x] CGO memory safety addressed (T032)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close