Skip to content

fix(hooks): keep a path's lone surrogates when a run log text is cut - #115

Closed
0x7c13 wants to merge 1 commit into
openJiuwen-ai:mainfrom
0x7c13:0x7c13/hook-run-clip-surrogates
Closed

0x7c13 wants to merge 1 commit into
openJiuwen-ai:mainfrom
0x7c13:0x7c13/hook-run-clip-surrogates

Conversation

@0x7c13

@0x7c13 0x7c13 commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

#111 was merged at e740b102, one push before its final head 3c2c0d33. This PR brings in that last push, which is three files:

  • service/hooks/run_log.py: _clip_text no longer decodes the cut with "ignore". That dropped every lone surrogate in a changed-arguments or block-reason text over 64 KB. A path that is not UTF-8 holds such surrogates. Now the cut only drops the character the limit splits: it backs up to that character's first byte and decodes with "surrogatepass".
  • tests/service/hooks/test_run_log_retention.py: the cap test now checks every unit, including a lone surrogate. The kept text must start the full text and end within 4 bytes of the limit.
  • tests/orchestration/engine/test_hook_run_reporting.py: removes a trailing wait_until that could not fail.

The tree is identical to 3c2c0d33, whose CI passed in full.

Test plan

  • test_changed_arguments_past_the_cap_are_cut_with_their_size_kept[lone-surrogate] fails against main and passes with this change.
  • Smart Test --paths on the three files: 12589 passed, 10 skipped; architecture 390 passed.
  • ruff check, ruff format --check, and ty check (linux, darwin, win32).

The Hooks panel merged from the branch one push before its last, so a
cut of changed arguments or a block reason past 64 KB still decoded
with "ignore": it dropped every lone surrogate of the text (what a path
that is not UTF-8 holds), not only the character the cut splits. The
cut now backs up to the first byte of the character the limit splits
and decodes the rest with "surrogatepass".

The retention test checks, for every unit a lone surrogate included,
that the kept text starts the full text and ends within 4 bytes of the
limit. A trailing wait in the reporting test that could not fail is
removed.
@0x7c13 0x7c13 closed this Oct 24, 2026
openjiuwen-release-bot Bot pushed a commit that referenced this pull request Oct 24, 2026
fix(hooks): keep a path's lone surrogates when a run log text is cut

Created-by: Ox7c13
Commit-by: Jiaqi (0x7c13) Liu
Merged-by: Ox7c13
Description: Paired: [GitHub #116](#116) ↔ [GitCode !83](https://gitcode.com/openJiuwen/iCode/merge_requests/83)

## Summary

!81 (GitHub #111) merged the Hooks panel at `e740b102`, one push before its final head `3c2c0d33`. This MR brings in that last push, which is three files:

- **`service/hooks/run_log.py`:** `_clip_text` no longer decodes the cut with `"ignore"`. That dropped every lone surrogate in a changed-arguments or block-reason text over 64 KB. A path that is not UTF-8 holds such surrogates. Now the cut only drops the character the limit splits: it backs up to that character's first byte and decodes with `"surrogatepass"`.
- **`tests/service/hooks/test_run_log_retention.py`:** the cap test now checks every unit, including a lone surrogate. The kept text must start the full text and end within 4 bytes of the limit.
- **`tests/orchestration/engine/test_hook_run_reporting.py`:** removes a trailing `wait_until` that could not fail.

The tree is identical to `3c2c0d33`, whose CI passed in full.

## Test plan

- [x] `test_changed_arguments_past_the_cap_are_cut_with_their_size_kept[lone-surrogate]` fails against `main` and passes with this change.
- [x] Smart Test `--paths` on the three files: 12589 passed, 10 skipped; architecture 390 passed.
- [x] `ruff check`, `ruff format --check`, and `ty check` (linux, darwin, win32).
- [x] GitHub CI on this exact commit (`de64d5eb`, the closed GitHub #115): all 17 checks passed.

<!-- bot4-pr-sync-meta
schema_version: 1
source: gitcode
gitcode_repo: openJiuwen/iCode
gitcode_mr: 83
github_repo: openJiuwen-ai/iCode
github_pr: 116
github_branch: sync/pr-83
-->

See merge request: openJiuwen/iCode!83
@0x7c13
0x7c13 deleted the 0x7c13/hook-run-clip-surrogates branch October 24, 2026 03:07
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