Skip to content

Restore standalone RatEye engine and add scan benchmarks - #1

Merged
DysektAI merged 20 commits into
masterfrom
codex/standalone-engine-diagnostics
Jul 28, 2026
Merged

DysektAI merged 20 commits into
masterfrom
codex/standalone-engine-diagnostics

Conversation

@DysektAI

@DysektAI DysektAI commented Jul 27, 2026 •

Copy link
Copy Markdown
Member

User description

What changed

  • restores RatEye as an independently buildable and packageable image-processing library
  • keeps RatScanner-specific capture, UI, configuration persistence, and data retrieval outside the engine
  • adds neutral scan replay manifests, per-stage processing timings, and a benchmark runner
  • recognizes current one-pixel inventory grid borders with a contour fallback
  • excludes fully transparent catalog icons and atomically refreshes cached templates when source icons change
  • verifies low-confidence template matches with an exact, unique short-name OCR result
  • adds focused grid, cache, transparent-icon, OCR-resolution, resource-lifetime, and benchmark-security regression coverage
  • hardens CI action pinning and resource ownership/concurrency paths identified during review

Why

RatEye is intended to remain reusable by RatScanner and other consumers without knowing about any host application. Re-establishing the repository boundary avoids the architectural coupling created by the temporary monorepo layout while still allowing RatScanner to reference RatEye from source through a Git submodule.

The controlled current-game Sorting Table corpus exposed three independent defects: the legacy parser lost current one-pixel grid cells, transparent placeholder PNGs became background-only templates, and wishlist/FIR decoration dominated whole-cell template scores. The fix addresses each stage without adding RatScanner knowledge or wishlist-specific constants to the engine.

User and developer impact

Current inventory cells can be localized again. Normal, FIR, Task-Wishlist, and Task-Wishlist+FIR variants of the same F-1 item resolve consistently. OCR verification only replaces a low-confidence template result when the visible short name maps to one unique exact catalog short name; missing traineddata leaves template matching operational.

Dynamic icon processing is not restored by this PR. It was intentionally removed upstream in 8667cac; this change removes remaining unreachable dynamic-only internals rather than reintroducing behavior outside the scope of the standalone engine restoration.

Validation

  • Debug and Release builds — 0 warnings, 0 errors
  • Debug and Release tests — 69 passed
  • NuGet package creation succeeded
  • NuGet vulnerability audit — clean
  • controlled four-case current-game Sorting Table replay — 4/4 expected IDs
  • repeated controlled replay — identical 4/4 expected IDs
  • Markdown checks passed
  • GitHub Actions build, CodeQL, CodeAnt quality/SAST/SCA/SCR, Socket Security — passed
  • integrated RatScanner Debug, Release, test, integrity, audit, and publish validation through Restore RatEye submodule integration and add scan diagnostics RatScanner#22

The real-game fixture corpus remains local and is not added as mandatory copyrighted CI data. The committed legacy Russian replay remains an honest known mismatch; its expected result was not changed to manufacture a pass. It is retained as optional future accuracy work and does not affect the validated current-game four-case corpus.


CodeAnt-AI Description

Restore standalone RatEye scanning with reliable inventory recognition and diagnostics

What Changed

  • RatEye can be built, packaged, and consumed independently from RatScanner, with standalone documentation and Windows x64 support.
  • Inventory scans recognize current one-pixel grid borders and highlighted cells, while rejecting transparent, unreadable, or incorrectly sized icon templates.
  • Low-confidence icon matches can be verified using an exact, unique short-name OCR result, without disabling template matching when trained data is unavailable.
  • Inspection scans reject inventory search-bar text, enforce a minimum item-name confidence, and avoid failures when detected regions fall outside the image.
  • Scan results now expose per-stage processing timings, and replay manifests plus a benchmark runner produce JSON reports with detections, confidence, expected-result status, and timing data.
  • Cache files are validated, written safely, invalidated when source icons change, and pruned when stale or oversized; processing resources are released deterministically.
  • Added regression coverage for current inventory layouts, OCR resolution, cache recovery, image processing, resource ownership, and replay diagnostics.

Impact

✅ Current inventory cells are recognized
✅ Fewer false item matches from UI text and icon decorations
✅ Safer recovery from damaged or stale icon caches
✅ Reproducible scan timing and accuracy reports

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 29ad011c-a8de-4914-ab30-1bdcc96737a3

📥 Commits

Reviewing files that changed from the base of the PR and between 20ad8ea and 18c9141.

📒 Files selected for processing (7)
  • RatEye/Config/Processing/Icon.cs
  • RatEye/Config/Processing/Inspection.cs
  • RatEye/IconManager.cs
  • RatEye/Processing/Icon.cs
  • RatEye/Processing/Inspection.cs
  • RatEye/RatEyeEngine.cs
  • RatEyeTest/ProcessingRegressionTests.cs
📝 Walkthrough

Walkthrough

RatEye is restructured as a standalone Windows x64 library with updated CI, packaging, configuration, image-processing pipelines, deterministic disposal, replay diagnostics, benchmark execution, and expanded native OpenCV and regression test coverage.

Changes

RatEye Standalone Extraction

Layer / File(s) Summary
CI, project metadata, and repository documentation
.github/workflows/build.yml, RatEye.sln, RatEye/RatEye.csproj, RatEyeTest/RatEyeTest.csproj, AGENTS.md, README.md, docs/benchmark-and-diagnostics.md, RatEye/Properties/*, RatEye/Vector2.cs
Adds Windows CI builds and tests, x64 solution mappings, updated package metadata and dependencies, standalone-library documentation, benchmark guidance, test targeting, normalized resource references, and formatting-only utility updates.
Configuration and shared processing utilities
RatEye/Config/*, RatEye/Extensions.cs, RatEye/Logger.cs, RatEye/ProcessingTimings.cs
Updates processing defaults and marker lifecycle, refactors image/string helpers and logging synchronization, and adds cumulative per-stage timing snapshots.
IconManager caching and disposal
RatEye/IconManager.cs
Adds static icon loading by slot size, config-aware atomic caching, cache validation and pruning, revised composition and lookup helpers, and deterministic disposal.
OCR, inspection, inventory, and engine processing
RatEye/Processing/*, RatEye/RatEyeEngine.cs
Reworks OCR/template matching, UI-title suppression, inventory-grid extraction, multi-inspection peak suppression, resource ownership, engine disposal, and the NewIcon factory.
Replay diagnostics and benchmark runner
RatEye/Diagnostics/ScanReplayManifest.cs, RatEye.Benchmarks/*, RatEyeTest/TestData/Benchmarks/*, docs/benchmark-and-diagnostics.md
Adds a versioned replay manifest, deterministic scan execution across supported scan types, JSON reports with detections and timings, expected-result exit codes, and a sample fixture.
Validation and regression coverage
RatEyeTest/DiagnosticsTests.cs, RatEyeTest/OpenCvPipelineTests.cs, RatEyeTest/ProcessingRegressionTests.cs, RatEyeTest/RatEyeCacheTests.cs
Adds coverage for manifest serialization, native OpenCV operations, OCR and UI-title behavior, marker and inventory processing, engine lifecycle, icon caching, cache pruning, and trained-data failures.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 39.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: restoring standalone RatEye and adding benchmarks.
Description check ✅ Passed The description is aligned with the PR changes, covering standalone engine restoration, timings, benchmarks, cache handling, and tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/standalone-engine-diagnostics

Comment @coderabbitai help to get the list of available commands.

@socket-security

socket-security Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

@socket-security

socket-security Bot commented Jul 27, 2026 •

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: nuget system.reflection.metadata is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: RatEyeTest/RatEyeTest.csproj → nuget/microsoft.net.test.sdk@18.7.0 → nuget/system.reflection.metadata@8.0.0

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore nuget/system.reflection.metadata@8.0.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@codeant-ai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@DysektAI

This comment was marked as resolved.

@DysektAI DysektAI closed this Jul 27, 2026
@DysektAI DysektAI reopened this Jul 28, 2026
@DysektAI
DysektAI marked this pull request as ready for review July 28, 2026 03:06
@cubic-dev-ai

cubic-dev-ai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Running ultrareview automatically — This PR restores RatEye as a standalone library with significant refactoring of core image processing (template matching, OCR verification, inventory grid detection), introduces concurrency-sensitive icon caching, adds new benchmark infrastructure, and modifies public API contracts.... I'll post findings when complete.

devin-ai-integration[bot]

This comment was marked as resolved.

@codeant-ai

This comment was marked as resolved.

@codeant-ai codeant-ai Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files label Jul 28, 2026
cubic-dev-ai[bot]

This comment was marked as resolved.

@codeant-ai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

@DysektAI

Copy link
Copy Markdown
Member Author

Addressed the remaining suggestions from the CodeAnt bundle (which was generated against 3dabaae) in current head 0b7e1f3:

  • explicit-null replay configuration/context now normalize safely; invalid input remains a defined exit-code-1 path
  • a static-icon directory installed after engine startup now refreshes correlation data without a restart
  • template cache identity now includes catalog background/type rendering inputs
  • configuration hashing uses invariant numeric formatting
  • highlighted scans clamp morphology kernels to at least one pixel
  • icon hit testing includes top/left and excludes bottom/right boundaries
  • marker NMS now suppresses the full overlap range for top-left template-match coordinates
  • concurrent debug image writes allocate and save under one lock
  • the previously reported engine disposal/processing lifecycle races remain covered by the synchronized engine and detached marker changes from da2d9e9

Regression coverage was added for each new behavior. Debug and Release builds are clean, both suites pass 59/59, the NuGet audit/package checks pass, and the controlled current-game replay remains 4/4.

@DysektAI DysektAI self-assigned this Jul 28, 2026
cubic-dev-ai[bot]

This comment was marked as resolved.

kilo-code-bot[bot]

This comment was marked as resolved.

@kilo-code-bot

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant