Skip to content

Fixes proxy startup - #5

Merged
nezhar merged 1 commit into
mainfrom
fixes-proxy-start
Aug 26, 2026
Merged

nezhar merged 1 commit into
mainfrom
fixes-proxy-start

Conversation

@nezhar

@nezhar nezhar commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

Refactors how container metadata is resolved by moving the relevant classes out of addon.py into a new module, container.py. This change addresses an issue with how @dataclass and string annotations interact with mitmproxy's script loading mechanism. The PR also updates tests to use the new module and adds a regression test to ensure the import behavior matches mitmproxy's expectations.

Summary by CodeRabbit

  • New Features

    • Added container metadata resolution from the configured container mapping.
    • Automatically refreshes container information when the mapping changes.
    • Gracefully handles missing files, unknown addresses, and invalid mapping data.
  • Tests

    • Added coverage for addon loading and container-based policy mapping.
    • Verified addon loading works without persistent module registration.

@nezhar
nezhar merged commit 7d7fdf7 into main Aug 26, 2026
3 checks passed
@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bce4ed91-bc28-4939-bf10-8669e408272b

📥 Commits

Reviewing files that changed from the base of the PR and between 73cd131 and 306514d.

📒 Files selected for processing (4)
  • proxy/addon.py
  • proxy/container.py
  • tests/test_addon.py
  • tests/test_addon_load.py

📝 Walkthrough

Walkthrough

The change moves container metadata and IP resolution into proxy/container.py. The addon imports the extracted types. Tests update the mapping-path patch and verify mitmproxy-compatible loading without registering the addon in sys.modules.

Changes

Container resolution

Layer / File(s) Summary
Extract container resolution
proxy/container.py, proxy/addon.py
ContainerMetadata and ContainerResolver now reside in container.py. The resolver reloads changed JSON mappings and preserves valid state after read or parse errors. The addon imports the extracted types.
Validate addon integration
tests/test_addon.py, tests/test_addon_load.py
Source-mapping tests patch the path in container. New tests verify addon loading with SourceFileLoader without retaining the module in sys.modules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fixes-proxy-start

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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