Skip to content

fix: PyEval byte array register tracking, CAST_TYPE instruction names, type annotations (#889 #885 #872)#891

Closed
haeter525 wants to merge 6 commits intoev-flow:masterfrom
haeter525:swe-agent-fix-#889-53135393
Closed

fix: PyEval byte array register tracking, CAST_TYPE instruction names, type annotations (#889 #885 #872)#891
haeter525 wants to merge 6 commits intoev-flow:masterfrom
haeter525:swe-agent-fix-#889-53135393

Conversation

@haeter525
Copy link
Copy Markdown
Member

Summary

  • Fix PyEval Fails to Track Byte Array Registers #889 — PyEval byte array register tracking: bears_object() now correctly returns True for array types (Dalvik types starting with [, e.g. [B for byte arrays). Previously only L-prefixed object types were tracked, causing byte array registers to be treated as primitives and breaking Stage 5 data-flow analysis for rules involving byte arrays. Rule 00015 on the Ahmyth sample now correctly reaches 100% confidence (was 80%).
  • Fix Fix #871: Fix instruction names for PyEval.CAST_TYPE #872 — CAST_TYPE instruction name format: Cast dispatch table keys changed from int-long to int-to-long format to match actual Dalvik mnemonic names. Parser updated to use .split("-to-") instead of index-based splitting.
  • Fix Fix annotation of quark.utils.tools.contains #885contains() type annotation: Updated type hints from list[str] to List[MethodObject] with corrected docstring examples.
  • Restore smoke test count to 39: Reverts the PyEval Fails to Track Byte Array Registers #889 workaround (expected count 38) now that the root cause is fixed.
  • Broaden CAST_TYPE exception handler: Catches KeyError in addition to IndexError to handle unexpected type_mapping lookups gracefully.

Test Coverage

CODE PATH COVERAGE
===========================
[+] quark/core/struct/registerobject.py
    └── bears_object()
        ├── [★★★ TESTED] None → True
        ├── [★★★ TESTED] "L..." (object) → True
        ├── [★★  TESTED] "[B" (byte array) → True  ← NEW
        └── [★★★ TESTED] "I" (primitive) → False

[+] quark/evaluator/pyeval.py
    └── CAST_TYPE (int-to-long format)
        ├── [★★★ TESTED] All non-wide casts
        ├── [★★★ TESTED] Wide-to-simple casts
        └── [★★★ TESTED] Simple-to-wide casts
─────────────────────────────────
Tests: 251 passed (0 failures)
─────────────────────────────────

Pre-Landing Review

2 issues found — 2 auto-fixed:

  • tools.py:24 Docstring examples used string literals instead of MethodObject → updated to match type annotation
  • pyeval.py:671 CAST_TYPE only caught IndexError, not KeyError from type_mapping lookup → broadened to except (IndexError, KeyError)

Design Review

No frontend files changed — design review skipped.

Eval Results

No prompt-related files changed — evals skipped.

Test plan

  • 251 pytest tests pass (0 failures)
  • Ahmyth smoke test expects 39 behaviors (100% confidence restored)
  • bears_object() returns True for [B byte array type
  • All int-to-long/float-to-double etc. cast instructions dispatch correctly

🤖 Generated with Claude Code

SWE-agent and others added 6 commits March 23, 2026 01:46
- Update contains() docstring examples to use MethodObject instead of strings
- Broaden CAST_TYPE exception handler to catch KeyError in addition to IndexError
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@haeter525 haeter525 closed this Mar 23, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.31%. Comparing base (94c0d0e) to head (2e941d5).

Files with missing lines Patch % Lines
quark/evaluator/pyeval.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #891   +/-   ##
=======================================
  Coverage   81.31%   81.31%           
=======================================
  Files          80       80           
  Lines        6946     6946           
=======================================
  Hits         5648     5648           
  Misses       1298     1298           
Flag Coverage Δ
unittests 81.31% <66.66%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

PyEval Fails to Track Byte Array Registers

1 participant