Skip to content

feat(evolve-kernel): kernel source/diff viewer in detail page - #33

Open
6eanut wants to merge 1 commit into
HuangPuStar:next-appfrom
6eanut:feat/evolve-kernel-kernel-diff
Open

feat(evolve-kernel): kernel source/diff viewer in detail page#33
6eanut wants to merge 1 commit into
HuangPuStar:next-appfrom
6eanut:feat/evolve-kernel-kernel-diff

Conversation

@6eanut

@6eanut 6eanut commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

The detail page could open a library kernel's code, but the code was rendered as a plain

 with no line numbers and no way to see what a kernel actually changed relative to a baseline — the key question when reviewing an evolved kernel is "what did it change, vs the original or vs the kernel it was derived from?".

Add a diff endpoint and an inspector panel:

  • _state_readers.py: read_kernel_source() resolves one library kernel by id; read_kernel_diff() produces a unified diff against the original reference kernel or against the kernel's parent_id. Missing kernels, a root kernel with no parent, and an evicted parent (library caps at MAX_LIBRARY_SIZE) return exists=false with a reason instead of raising.
  • routes.py: GET /kernels/{kernel_id}/diff?base=reference|parent.
  • ok-runtime-api.js: getKernelDiff() client.
  • ok-detail.js: KernelInspector panel with Source / Diff vs reference / Diff vs parent modes, a line-numbered source renderer, and a colored unified-diff renderer with +/- stats. The parent mode is disabled when the kernel has no parent.
  • ok.css: .ok-source* / .ok-diff* styles.
  • test_kernel_diff.py: 11 tests covering both readers and their non-raising failure paths.

The detail page could open a library kernel's code, but the code was
rendered as a plain <pre> with no line numbers and no way to see what a
kernel actually changed relative to a baseline — the key question when
reviewing an evolved kernel is "what did it change, vs the original or
vs the kernel it was derived from?".

Add a diff endpoint and an inspector panel:

- _state_readers.py: read_kernel_source() resolves one library kernel by
  id; read_kernel_diff() produces a unified diff against the original
  reference kernel or against the kernel's parent_id. Missing kernels, a
  root kernel with no parent, and an evicted parent (library caps at
  MAX_LIBRARY_SIZE) return exists=false with a reason instead of raising.
- routes.py: GET /kernels/{kernel_id}/diff?base=reference|parent.
- ok-runtime-api.js: getKernelDiff() client.
- ok-detail.js: KernelInspector panel with Source / Diff vs reference /
  Diff vs parent modes, a line-numbered source renderer, and a colored
  unified-diff renderer with +/- stats. The parent mode is disabled when
  the kernel has no parent.
- ok.css: .ok-source* / .ok-diff* styles.
- test_kernel_diff.py: 11 tests covering both readers and their
  non-raising failure paths.

Co-Authored-By: deepseek/deepseek-v4-flash-0731 <deepseek-ai@claude-code-best.win>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant