[PR #4507] [MERGED] fix(cutter): read the active document from core configuration #6276

Closed
opened 2026-10-31 01:13:14 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4507
Author: @N0zoM1z0
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/cutter-document-identity-4497


📝 Commits (1)

  • 93382aa fix(cutter): read the active document from core configuration

📊 Changes

2 files changed (+62 additions, -3 deletions)

View changed files

📝 bridge/cutter/rea_bridge.py (+2 -2)
📝 tests/fixtures/cutter_bridge_protocol_test.py (+60 -1)

📄 Description

Summary

Fixes #4497. Cutter discovery and command Evidence now report the active core's file path instead of null when an ELF is loaded. Document generation can consequently observe path changes and reject commands against an earlier generation.

Problem and expected behavior

The bridge calls currentlyOpenFile() and swallows the failure. That member is a string, and native probing plus Cutter source show it is a debugging backup rather than the ordinary current-file getter. The file loaded in the real GUI appears in getConfig("file.path") and ij.core.file while the backup member remains empty.

Change and scope

Read the existing scalar CutterCore.getConfig("file.path") at the producer boundary. Preserve the exact nonempty string; absent, malformed or unreadable values remain unknown. CLI/MCP consume the existing bridge facts without another interpretation. No cache: this is live document state, refreshed by the existing GUI-thread dispatcher.

Ordinary metadata correction within existing authority; no new provider, execution, injection, mutation or protection recovery. Separate scope approval is not applicable.

Contract and boundary impact

  • Semantic owner/earliest stage: Python dispatcher reads the current core configuration before status/command admission and after commands.
  • CLI/MCP/tool catalog: existing fields and schemas; current_file becomes populated when observed. Same instance UUID and generation protocol.
  • Provider/format/platform compatibility: official Linux Cutter 2.5.0 Qt5 verified; other hosts unverified. Missing API/value remains unknown.
  • Evidence/provenance: current path and observed generation propagate through the existing command Evidence; identity remains partial, including the documented same-path reload/tab limitation.
  • Authority/cleanup: scalar configuration read only; no document changes, GUI closure or new process ownership. Existing command authority is unchanged.
  • Generated/package/install impact: none; no artifacts or binaries committed.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

The existing bridge exchanges remain authenticated loopback requests. Verification launches a fixture-owned GUI; the change does not launch one.

Evidence and regression coverage

  • The production-boundary Python regression fails against an immutable snapshot of clean main a6c6a76d37c729e17cccf2dd20fe8e8177d98b14: a known configured path is returned as None. It passes with the corrected owner API. Tests cover exact Unicode/#? paths, initialization/status, unchanged/changed generations, stale-command rejection before dispatch, valid dispatch, and unknown/malformed/unreadable configuration.

  • Actual official Cutter Qt5 on clean main and final head: two CLI/three stdio MCP calls on a controlled ELF with a Unicode/#? filename. Base discovery returns null although ij identifies the loaded ELF; final CLI/MCP discovery and both Evidence observations preserve the exact path. The ELF bytes stay unchanged, MCP disconnect preserves Cutter, and fixture-owned cleanup leaves verified empty process lineage.

  • Real GUI document switching and same-path reload identity were not tested; the generation-transition test runs the actual Python producer against a controlled host configuration. Host-version provenance remains separately tracked in #4498. Qt6 plugin loading remains upstream rizinorg/cutter#3659.

  • Observed, derived, and inferred claims remain distinguishable.

  • Artifact identity, source provenance, and failed attempts remain preserved.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Final source 93382aa6869e092d8e6c14e75ac10f4c29e1b98e, based on latest main a6c6a76d37c729e17cccf2dd20fe8e8177d98b14:

  • python3 tests/fixtures/cutter_bridge_protocol_test.py — 11 passed; final regression on the immutable base fails as expected.
  • npm run test:focused -- 10 relevant Cutter CLI/MCP/provider and mutation-config/workflow files — 66 passed, including the Python producer boundary.
  • npm run check:ci and npm run docs:check — passed.
  • Actual official Cutter 2.5.0 Qt5 public CLI/stdio MCP workflow — passed on final committed source, without the separate diagnostic plugin.

One completed healthy native task/revision, two CPU cores: base → fix wall 9.00 → 9.60 s, CPU 10.88 → 12.02 s, sampled family peak 1.059 → 1.011 GiB. Shared host and uncontrolled caches/load: these single observations establish neither speedup nor a stable performance regression. Fresh GUI/profile, CLI and MCP processes were used; cold OS cache was not established. Per-call first/subsequent timings are retained locally.

Whole wire+CLI o200k_base serialization proxy 835,254 → 835,472, including identical 829,341-token full catalogs. Named two-tool definitions+calls+CLI proxy 8,561 → 8,779. Existing provenance fields now carry paths; no extra calls or fields are added. These are serialization estimates, not model input/billing; run-specific paths/identities contribute. The production getter reads one scalar without parsing a full command response or retaining a stale cache.

Local evidence: /tmp/rea-4497-cutter-document-20261016/. Essential claims are inline; local paths are not portable CI artifacts. The failed property-only experiment and private read-only probe are retained separately from the final unmodified-plugin workflow.

Compatibility, safety, and release

  • No public schema, dependency, migration or packaging change.
  • Linux actual Cutter Qt5 covered; other OS and real GUI document switching remain unverified. identity_status stays partial.
  • No target execution or mutation added. Selected paths remain exact; unavailable values are not formatted into invented identities.

Author readiness

Human owner: @N0zoM1z0

Recorded at the human owner's explicit session instruction to complete readiness declarations and request review. The assistant performed the diff review and checks above; no independent manual human review is claimed.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/4507 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/cutter-document-identity-4497` --- ### 📝 Commits (1) - [`93382aa`](https://github.com/morluto/rea/commit/93382aa6869e092d8e6c14e75ac10f4c29e1b98e) fix(cutter): read the active document from core configuration ### 📊 Changes **2 files changed** (+62 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `bridge/cutter/rea_bridge.py` (+2 -2) 📝 `tests/fixtures/cutter_bridge_protocol_test.py` (+60 -1) </details> ### 📄 Description ## Summary Fixes #4497. Cutter discovery and command Evidence now report the active core's file path instead of `null` when an ELF is loaded. Document generation can consequently observe path changes and reject commands against an earlier generation. ## Problem and expected behavior The bridge calls `currentlyOpenFile()` and swallows the failure. That member is a string, and native probing plus Cutter source show it is a debugging backup rather than the ordinary current-file getter. The file loaded in the real GUI appears in `getConfig("file.path")` and `ij.core.file` while the backup member remains empty. ## Change and scope Read the existing scalar `CutterCore.getConfig("file.path")` at the producer boundary. Preserve the exact nonempty string; absent, malformed or unreadable values remain unknown. CLI/MCP consume the existing bridge facts without another interpretation. No cache: this is live document state, refreshed by the existing GUI-thread dispatcher. Ordinary metadata correction within existing authority; no new provider, execution, injection, mutation or protection recovery. Separate scope approval is not applicable. ## Contract and boundary impact - Semantic owner/earliest stage: Python dispatcher reads the current core configuration before status/command admission and after commands. - CLI/MCP/tool catalog: existing fields and schemas; `current_file` becomes populated when observed. Same instance UUID and generation protocol. - Provider/format/platform compatibility: official Linux Cutter 2.5.0 Qt5 verified; other hosts unverified. Missing API/value remains unknown. - Evidence/provenance: current path and observed generation propagate through the existing command Evidence; identity remains `partial`, including the documented same-path reload/tab limitation. - Authority/cleanup: scalar configuration read only; no document changes, GUI closure or new process ownership. Existing command authority is unchanged. - Generated/package/install impact: none; no artifacts or binaries committed. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [x] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. The existing bridge exchanges remain authenticated loopback requests. Verification launches a fixture-owned GUI; the change does not launch one. ## Evidence and regression coverage - The production-boundary Python regression fails against an immutable snapshot of clean main `a6c6a76d37c729e17cccf2dd20fe8e8177d98b14`: a known configured path is returned as `None`. It passes with the corrected owner API. Tests cover exact Unicode/`#?` paths, initialization/status, unchanged/changed generations, stale-command rejection before dispatch, valid dispatch, and unknown/malformed/unreadable configuration. - Actual official Cutter Qt5 on clean main and final head: two CLI/three stdio MCP calls on a controlled ELF with a Unicode/`#?` filename. Base discovery returns `null` although `ij` identifies the loaded ELF; final CLI/MCP discovery and both Evidence observations preserve the exact path. The ELF bytes stay unchanged, MCP disconnect preserves Cutter, and fixture-owned cleanup leaves verified empty process lineage. - Real GUI document switching and same-path reload identity were not tested; the generation-transition test runs the actual Python producer against a controlled host configuration. Host-version provenance remains separately tracked in #4498. Qt6 plugin loading remains upstream rizinorg/cutter#3659. - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed Final source `93382aa6869e092d8e6c14e75ac10f4c29e1b98e`, based on latest main `a6c6a76d37c729e17cccf2dd20fe8e8177d98b14`: - `python3 tests/fixtures/cutter_bridge_protocol_test.py` — **11 passed**; final regression on the immutable base fails as expected. - `npm run test:focused --` 10 relevant Cutter CLI/MCP/provider and mutation-config/workflow files — **66 passed**, including the Python producer boundary. - `npm run check:ci` and `npm run docs:check` — passed. - Actual official Cutter 2.5.0 Qt5 public CLI/stdio MCP workflow — passed on final committed source, without the separate diagnostic plugin. One completed healthy native task/revision, two CPU cores: base → fix wall **9.00 → 9.60 s**, CPU **10.88 → 12.02 s**, sampled family peak **1.059 → 1.011 GiB**. Shared host and uncontrolled caches/load: these single observations establish neither speedup nor a stable performance regression. Fresh GUI/profile, CLI and MCP processes were used; cold OS cache was not established. Per-call first/subsequent timings are retained locally. Whole wire+CLI `o200k_base` serialization proxy **835,254 → 835,472**, including identical **829,341**-token full catalogs. Named two-tool definitions+calls+CLI proxy **8,561 → 8,779**. Existing provenance fields now carry paths; no extra calls or fields are added. These are serialization estimates, not model input/billing; run-specific paths/identities contribute. The production getter reads one scalar without parsing a full command response or retaining a stale cache. Local evidence: `/tmp/rea-4497-cutter-document-20261016/`. Essential claims are inline; local paths are not portable CI artifacts. The failed property-only experiment and private read-only probe are retained separately from the final unmodified-plugin workflow. ## Compatibility, safety, and release - No public schema, dependency, migration or packaging change. - Linux actual Cutter Qt5 covered; other OS and real GUI document switching remain unverified. `identity_status` stays partial. - No target execution or mutation added. Selected paths remain exact; unavailable values are not formatted into invented identities. ## Author readiness Human owner: @N0zoM1z0 Recorded at the human owner's explicit session instruction to complete readiness declarations and request review. The assistant performed the diff review and checks above; no independent manual human review is claimed. - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:13:14 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#6276
No description provided.