Contributing
git clone https://github.com/MemorySlice/MemDiver.git
cd MemDiver
pip install -e ".[dev,docs]"
pytest tests/ -v
# Backend (serves built React bundle)
memdiver web
# Frontend dev server (hot-reload, proxies /api to :8080)
# NOTE: one hoisted npm install at the REPO ROOT -- frontend/ and tests/e2e/
# are npm workspaces. Do NOT `cd frontend` first; see "JS install" below.
npm ci && npm run dev
# Open http://127.0.0.1:5173 for live updates. Port 8080 serves the built UI.
# Marimo sandbox
memdiver ui
Extension points
MemDiver has eight pluggable surfaces. They differ in how (and whether) an out-of-tree package can register into them:
Extension point |
How to add (in-tree) |
Out-of-tree (entry point)? |
Guide |
|---|---|---|---|
Detection algorithm |
subclass |
YES ( |
|
KDF |
|
YES ( |
|
Oracle |
user |
n/a (user file) |
|
Dump source |
|
YES ( |
|
Binary format |
|
YES ( |
|
Pipeline stage |
|
YES ( |
|
Verification resource |
|
YES ( |
|
Heap allocator |
|
YES ( |
Seven of the eight extension points support out-of-tree registration by an installed
package via an entry_points group (all except Oracle, which is loaded from
a user-supplied .py file at runtime rather than an installed package — see
adding_oracles). For the two subclass-based points the entry
point resolves to a subclass (or a module exposing one); for the five
register-call-based points it resolves to a module (imported for its
register_* side effects) or a callable (invoked to self-register). Discovery is
additive and failure-isolated — a silent no-op when nothing is installed.
Verification resources carry no trust. The first-party pcap resource is
loaded with the untrusted-code sandbox disabled (our own module, and a pcap is
data rather than executable; sandboxing a large capture’s parse would misread a
slow parse as a hang). That exemption is granted per resource type and only to
in-tree factories: register_resource_type records the provenance of every
registration, and a type that arrived through memdiver.oracles is always
loaded under the sandbox. Otherwise installing a package would be enough to run
its code unsandboxed.
Entry-point discovery runs once per process (at first use of the relevant registry), so a package installed into an already-running process is not picked up until the process restarts.
Code style
Python: Google-style docstrings, strict type hints; stdlib-only in
core/.React: TypeScript + Zustand slices; no shadcn/radix dependency.
Comments explain why, not what. Self-documenting names preferred.
Never delete existing code without explicit approval — preserve all functionality unless asked otherwise.
JS install (npm workspaces)
frontend/ and tests/e2e/ are npm workspaces of the root package.json.
There is exactly one node_modules (at the repo root) and exactly one
package-lock.json (at the repo root):
npm ci # from the repo root, never from inside a workspace
Root command |
Underlying |
|---|---|
|
|
|
|
|
|
|
|
npm install inside a workspace directory creates a nested node_modules with
a duplicated React — see the warning in
CONTRIBUTING.md.
CI asserts that exactly one copy of react exists.
Test taxonomy
Unit (~90 files) — one per subsystem module.
Integration —
test_integration.py,test_aes_e2e.py,test_pipeline.py.Real-dump E2E — gated by the
requires_datasetmarker; skipped when no dataset is configured.Python browser E2E (pytest-playwright) —
tests/e2e_*_test.py(manually invoked, not collected by pytest default discovery).Frontend unit (vitest) — 32 files / 305 tests under
tests/frontend/, mirroring thefrontend/src/tree. Tests are never co-located with the module under test, and the directory anchor is load-bearing: it is what keeps vitest and the Playwright suite apart (Playwright’s files are all*.spec.tsundertests/e2e/specs/, and vitest’s include pattern acceptsspectoo). jsdom +@testing-library/react;@/→frontend/src,@tests/→tests/frontend. Run withmake fe-test. Typechecked byfrontend/tsconfig.test.jsonviamake fe-typecheck— deliberately a separate TS project fromtsconfig.app.json, which is whatvite buildcompiles and must stay test-free.Browser and accessibility tests (Playwright). Run
scripts/test-e2e.shornpm run e2e. The specifications are intests/e2e/specs/. CI runs thea11y-*subset for frontend changes.
Docs build
Use short sentences and the same term for the same concept. Start each procedure step with a direct instruction. Keep exact command names, flags, API fields, and UI labels. For a measured result, record the capture set and options. Describe a limitation where it affects the reader’s next step.
pip install -e ".[docs]"
sphinx-build -W --keep-going -b html docs docs/_build/html
open docs/_build/html/index.html
Warnings-as-errors (-W) is mandatory; fix them, don’t suppress.