Add Mnemosyne architecture design diagrams (S1 and S2)#376
Add Mnemosyne architecture design diagrams (S1 and S2)#376palashkondekar-meesho wants to merge 3 commits into
Conversation
…orm LLD Excalidraw component diagrams for the two sharding strategies under review: - S1: deployable-per-shard (read-replicas, Envoy intra-shard LB) - S2: scattered regions (TiDB-like, Placement-Driver-managed) https://claude.ai/code/session_01FM9sB54w7ry9GH7iU2qbqv
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
…-tenant, internal scaling) Companion to the Mnemosyne LLD. Shows the onboarding lane (admin -> API -> sizer -> tenant outputs), shared Control Plane + Producer/GCS, and three tenant lanes with per-tenant Client SDK and internal shard deployables (one with a scaled-up replica to illustrate horizontal scaling within a shard). https://claude.ai/code/session_01FM9sB54w7ry9GH7iU2qbqv
New py-sdk package mirroring spark_feature_push_client. Reads parquet, shards by
crc32(key) % S using Spark SQL's crc32() (IEEE; same as Python binascii.crc32
and Go crc32.ChecksumIEEE), encodes per-entity payloads as persist.Data proto
(reusing bharatml_commons), and writes per-shard sorted SST files via
rocksdict.SstFileWriter inside mapPartitions, plus a _manifest.json with the
schema + per-shard file/row/sha256 stats for the Control Plane to gate version
promotion.
Pipeline: project -> key + shard (Spark SQL) -> repartition by shard
-> sortWithinPartitions(shard,key) -> mapPartitions writes SSTs.
Output: <out>/<version_id>/<shard:05d>/data-<partition_uuid>.sst
<out>/<version_id>/_manifest.json
Includes a no-Spark smoke test that validates config parsing, key/shard
computation, and persist.Data round-trip on the geo example config.
https://claude.ai/code/session_01FM9sB54w7ry9GH7iU2qbqv
| dependencies = [ | ||
| "pyspark>=3.4", | ||
| "protobuf>=4.21", | ||
| "rocksdict>=0.3", |
There was a problem hiding this comment.
Semgrep identified a blocking 🔴 issue in your code:
Dependency "$MATCH" uses a range operator. Pin to exact version with == or use a lockfile (e.g. uv.lock, pdm.lock, poetry.lock). Range pins allow auto-upgrades to compromised versions in CI.
To resolve this comment:
✨ Commit fix suggestion
| "rocksdict>=0.3", | |
| "rocksdict==0.3.0", |
View step-by-step instructions
-
Replace the ranged dependency specifier for
rocksdictwith an exact version pin inpyproject.toml.
Change"rocksdict>=0.3"to"rocksdict==<tested-version>". -
Pick the exact version that this project already uses and has been validated with, instead of allowing any newer release.
For example, if the current environment is using0.3.x, pin that exact value asrocksdict==0.3.x. -
Leave
requires-python = ">=3.9"unchanged.
This rule applies to package dependencies, not the Python version constraint.
Alternatively, if your build process already uses a committed lockfile such as uv.lock, pdm.lock, or poetry.lock, keep the dependency resolution fixed there and make sure rocksdict is locked to one exact version.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by pyproject-dependency-range-pin.
You can view more details about this finding in the Semgrep AppSec Platform.
| requires-python = ">=3.9" | ||
| dependencies = [ | ||
| "pyspark>=3.4", | ||
| "protobuf>=4.21", |
There was a problem hiding this comment.
Semgrep identified a blocking 🔴 issue in your code:
Dependency "$MATCH" uses a range operator. Pin to exact version with == or use a lockfile (e.g. uv.lock, pdm.lock, poetry.lock). Range pins allow auto-upgrades to compromised versions in CI.
To resolve this comment:
✨ Commit fix suggestion
| "protobuf>=4.21", | |
| "protobuf==4.21.0", |
View step-by-step instructions
- Replace the ranged dependency with an exact version pin in
pyproject.tomlby changingprotobuf>=4.21toprotobuf==<tested-version>. - Use the version already installed in this environment if it is the version you expect to ship, for example
protobuf==<installed-version>, so the project does not auto-upgrade in CI. - Apply the same fix to the other ranged dependencies in this file if they are governed by the same rule, for example change
pyspark>=3.4topyspark==<tested-version>androcksdict>=0.3torocksdict==<tested-version>. - Leave
requires-python = ">=3.9"unchanged, since this rule excludes Python version constraints. - Add a short comment above the dependency if helpful, such as
# Pinned exactly to avoid CI pulling a newer unreviewed release.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by pyproject-dependency-range-pin.
You can view more details about this finding in the Semgrep AppSec Platform.
| description = "Mnemosyne WORM platform — Producer: Spark batch job that shards a parquet dataset by crc32(key) and emits per-shard RocksDB SST files." | ||
| requires-python = ">=3.9" | ||
| dependencies = [ | ||
| "pyspark>=3.4", |
There was a problem hiding this comment.
Semgrep identified a blocking 🔴 issue in your code:
Dependency "$MATCH" uses a range operator. Pin to exact version with == or use a lockfile (e.g. uv.lock, pdm.lock, poetry.lock). Range pins allow auto-upgrades to compromised versions in CI.
To resolve this comment:
✨ Commit fix suggestion
| "pyspark>=3.4", | |
| "pyspark==3.4.0", |
View step-by-step instructions
- Change the dependency entry in
pyproject.tomlfrom a range pin to an exact pin by replacing"pyspark>=3.4"with"pyspark==<exact-version>". - Set
<exact-version>to the specific PySpark release you have already approved for this project, for example the version currently installed in the dev environment from$ python -c "import pyspark; print(pyspark.__version__)". - Keep the
requires-python = ">=3.9"line unchanged, because this rule only applies to package dependencies and not the Python version constraint. - Repeat the same change for the other ranged dependencies in this file, such as
protobuf>=4.21androcksdict>=0.3, so each dependency uses==instead of>=. This prevents CI from silently pulling a newer package release than the one you intended to ship.
Alternatively, if your build tooling supports lockfiles and you want to keep version ranges in pyproject.toml, add a lockfile such as uv.lock, pdm.lock, or poetry.lock and make sure CI installs from that lockfile instead of resolving dependencies dynamically.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by pyproject-dependency-range-pin.
You can view more details about this finding in the Semgrep AppSec Platform.
| @@ -0,0 +1,22 @@ | |||
| [build-system] | |||
| requires = ["setuptools>=61", "wheel"] | |||
There was a problem hiding this comment.
Semgrep identified a blocking 🔴 issue in your code:
Dependency "$MATCH" uses a range operator. Pin to exact version with == or use a lockfile (e.g. uv.lock, pdm.lock, poetry.lock). Range pins allow auto-upgrades to compromised versions in CI.
To resolve this comment:
✨ Commit fix suggestion
| requires = ["setuptools>=61", "wheel"] | |
| # Replace 61.0.0 with the exact setuptools version installed in your build environment if it differs. | |
| requires = ["setuptools==61.0.0", "wheel"] |
View step-by-step instructions
- Change the build dependency in
[build-system].requiresfrom a range to an exact pin by replacingsetuptools>=61withsetuptools==<tested-version>. - Keep
wheelas-is only if your policy does not require every build dependency to be pinned; otherwise pin it too aswheel==<tested-version>. - Update the line so it looks like
requires = ["setuptools==<tested-version>", "wheel"]orrequires = ["setuptools==<tested-version>", "wheel==<tested-version>"]. - Choose the exact
setuptoolsversion that is already installed and working in this environment, sincesetuptoolsis already available here. This avoids CI pulling a newer release automatically.
Alternatively, if your project manages build dependencies through a lockfile, add a lockfile supported by your packaging workflow and make sure the resolved setuptools version is fixed there.
💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasons
Alternatively, triage in Semgrep AppSec Platform to ignore the finding created by pyproject-dependency-range-pin.
You can view more details about this finding in the Semgrep AppSec Platform.
Context:
This PR adds architectural design diagrams for Mnemosyne, documenting two distinct deployment strategies for the feature store system. These diagrams serve as visual references for understanding the system topology and component interactions.
Describe your changes:
Added two Excalidraw design documents:
mnemosyne-s1-deployable-per-shard.excalidraw: Illustrates the S1 architecture with shard-based deployment strategy
mnemosyne-s2-scattered-regions.excalidraw: Illustrates the S2 architecture with TiDB-like region-based strategy
Both diagrams document the complete data flow from generation through serving, including control plane interactions and client-side logic.
Testing:
N/A - These are design documentation artifacts (Excalidraw JSON files) with no executable code or tests.
Monitoring:
N/A - Design documentation only.
Rollback plan:
N/A - Design documentation only. Can be removed or updated without affecting system operation.
Checklist before requesting a review:
📂 Modules Affected:
docs(Documentation updates)✅ Type of Change:
https://claude.ai/code/session_01FM9sB54w7ry9GH7iU2qbqv