Skip to content

fix(git): keep untracked new files inside the 2000-char diff slice - #23

Merged
linkerlin merged 1 commit into
masterfrom
cursor/diff-snapshot-untracked-tail-c723
Nov 2, 2026
Merged

linkerlin merged 1 commit into
masterfrom
cursor/diff-snapshot-untracked-tail-c723

Conversation

@linkerlin

Copy link
Copy Markdown
Owner

Summary

失败 episode 和成功事件不再把 capture_diff_snapshot 的结果做 [:2000] 前缀切片。截断改在 helper 内完成:已跟踪 diff 会占满 2000 字时,先裁跟踪前缀,固定留 480 字给未跟踪新文件块,因此 notes.md 这类证据在大 diff 里仍然可见。预算仍是 2000,不抬高。

Failure episodes and success events no longer take a naive [:2000] prefix of capture_diff_snapshot. Truncation happens inside the helper: when the tracked diff would fill the 2000-character budget, the tracked prefix is clipped first and a fixed 480-character tail is kept for untracked new-file hunks, so a file such as notes.md stays visible. The budget stays 2000.

What changed

  • capture_diff_snapshot reserves _UNTRACKED_TAIL_CHARS (480, and at most a quarter of max_chars) when the tracked diff would leave less room than that tail. The returned string is at most max_chars. If nothing eligible is untracked, the tail goes back to the tracked diff.
  • _failure_diff and the success event both call capture_diff_snapshot(..., max_chars=_STORED_DIFF_CHARS) (2000). The second [:2000] slice is gone, so both arms share one policy.
  • Noise skip list is unchanged: .venv, node_modules, __pycache__, .git, protected files, runtime dirs (memory/, .evolver/), and NUL binaries stay out of the untracked supplement.
  • No solidify-gate, Parent-baseline, skip_validation, or val-seal changes. DEBUG #61 and DEBUG #68 residuals are untouched.
  • DEBUG #57 and CHANGELOG record the follow-up.

How to test

  1. uv run pytest tests/test_git_ops.py tests/gep/test_solidify.py tests/gep/test_solidify_acceptance_hook.py tests/gep/test_solidify_bench_pack.py tests/gep/test_solidify_diagnostic_funnel.py tests/gep/test_solidify_dogfood_fixes.py tests/gep/test_solidify_fitness.py tests/gep/test_solidify_helpers.py tests/gep/test_solidify_pending_soft.py tests/gep/test_solidify_soft_continue_bugs.py tests/gep/test_solidify_soft_default.py tests/gep/test_no_git_no_commit.py tests/test_auto_trigger_and_evolution_e2e.py::TestAutoEvolutionRealReliableBeneficialE2E::test_two_round_closed_loop_rollback_then_beneficial_repair -q --tb=line
    • Expected: 181 passed.
  2. uv run ruff check src tests && uv run ruff format --check src tests && uv run mypy src
    • Expected: ruff clean, mypy Success: no issues found in 353 source files.
  3. uv run pytest tests/ -q --tb=line -m "not slow"
    • This run: 4454 passed, 25 deselected, plus tests/gep/test_material.py::TestWatermarkIngest::test_identical_rewrite_is_noop (skipped vs rewrite_noop). That failure reproduces on unmodified master (233bb5b) in this environment and is not part of this diff.

Risk

Low. The stored diff text changes only when a tracked diff would otherwise crowd out untracked new files. The 2000-character episode/event budget is not raised. The default 80_000-character capture (policy secret scan) reserves the same 480-character tail only when the tracked diff itself exceeds that budget.

Harness/evaluator governance

Upstream governance surface: solidify stored diff scene (gep/git_ops.capture_diff_snapshot, failure _failure_diff, success diff_snapshot). Gates, Parent baseline, skip_validation, and val seal are unchanged.
Downstream EvoX impact: N/A -- snapshot text only, no bridge or contract change.
Rollout-local scope: episode/event diff string allocation inside the existing 2000-character budget.
Promotion boundary: this PR; no feature flag.
Evaluator mismatch sets: evidence (diff scene). Observation, action, repair, verification, and belief sets are unchanged.
Non-regression evidence: git_ops + solidify family (181 passed, including the two-round closed loop), ruff, and mypy. Full non-slow suite has one pre-existing test_material failure that also fails on master.
Fix-severity review: low
Owner approval: N/A
Security boundary: untracked new-file text was already eligible for the snapshot after #22. This change only keeps that text inside the truncated budget. Noise, protected, runtime, and binary paths stay excluded. No new network or secret-handling path.
Rollback: revert this commit.
Live promotion: no
Autonomous evaluator self-editing: no

Self-check

  • Tests added or updated to cover the new behavior. Relevant pytest modules, ruff, and mypy passed locally. Full pytest -m "not slow" has one pre-existing failure on master (test_identical_rewrite_is_noop), noted above.
  • No new runtime dependencies.
  • New source files import from .py source in CI — N/A, no new modules.
  • Pydantic schema factory — N/A.
  • Mutable copy — N/A.
  • New module-level environment variable — N/A.

Related

Follow-up to #22 / DEBUG #57. Does not close a GitHub issue.

Open in Web Open in Cursor 

Failure episodes and success events took a naive prefix of
capture_diff_snapshot, so a large tracked diff dropped the untracked
new-file supplement from DEBUG #57. Truncate inside the helper and
reserve a fixed tail for that supplement.

Co-authored-by: Steper Lin <linker.lin@live.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 16:40

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@linkerlin
linkerlin merged commit 7669cef into master Nov 2, 2026
5 checks passed
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.

3 participants