Skip to content

Support secure RemoteArray, RemoteStore, and RemoteCTable references - #292

Open
FrancescAlted wants to merge 20 commits into
mainfrom
remote-proxy
Open

FrancescAlted wants to merge 20 commits into
mainfrom
remote-proxy

Conversation

@FrancescAlted

Copy link
Copy Markdown
Member

This branch lets Caterva2 serve persisted python-blosc2 remote references while
keeping source access, cache growth, and storage accounting under server policy.
It updates the RemoteArray integration, adds RemoteStore and RemoteCTable
containers, and exposes them through the existing metadata, fetch, download,
browser, and Python client APIs.

Changes

  • Validate credential-free HTTPS destinations against an explicit host allowlist,
    public DNS addresses, and resource limits before outbound reads. Resolution is
    disabled by default. Source authorization also covers linked stores, table
    columns and batches, and cached-only operations.
  • Keep remote payload caches in private sparse generations. Share RemoteStore
    discovery and an aggregate cache allowance across leaves, batches, indexes,
    and linked references. Coordinate multi-process access, quota admission,
    pruning, recovery, and portable warm or cold downloads with a SQLite ledger.
  • Serve standalone, nested, linked, B2Z, and HDF5 RemoteCTables. Tables support
    metadata, browser paging and sorting, row slices, filters, and one-column
    projections. Local and remote table projections both return CTable cframes;
    the Python client decodes nested table paths from metadata and preserves row
    selections when a field is requested.
  • Add authenticated POST /api/refresh/{path} for hosted RemoteStore and
    RemoteCTable carriers, plus Client.refresh(path). Refresh rediscovers the
    source, publishes a cold reference atomically, and returns a fresh client
    object. Missing targets, unsupported RemoteArray targets, denied calls,
    source failures, and competing replacements receive explicit responses.
  • Expose user attributes through metadata and the client, document the server
    policy and API, and add benchmark scripts and regression coverage.

Compatibility and deployment

  • Requires python-blosc2 >= 4.14.0, including the upstream RemoteCTable work
    and integration commits 5f92a80d and d6554ad5. Version 4.14.0 has not been
    released yet.
  • The configured customer quota now accounts for apparent dataset bytes in
    public, shared, and personal roots; a separate work budget covers staging.
    Remote reference resolution remains opt-in through [server.remote_proxy].
  • Existing Table or Group objects retain their old metadata after refresh;
    Client.refresh() returns a newly loaded object for callers to use.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved critical and moderate findings remain.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds secure RemoteArray, RemoteStore, and RemoteCTable support with remote policy enforcement, sparse caching, quota accounting, refresh APIs, metadata, client integration, documentation, tests, and benchmarks.

Changes:

  • Adds secure remote-source validation and cache/quota lifecycle management.
  • Adds RemoteStore and RemoteCTable serving, browsing, filtering, projections, and refresh.
  • Extends REST, Python client, metadata, documentation, tests, and benchmarks.

Review findings:

  • Critical (1 vote): StorageBusy generation conflicts can escape as 500 responses instead of documented 409 responses.
  • Moderate (1 vote): cache_limit=0 may still retain a disk generation.
  • Moderate (1 vote): The advertised POST fetch path currently receives 405.
  • Moderate (2 votes): The storage-quota benchmark overstates bytes written.
  • Moderate (1 vote): The remote proxy benchmark uses obsolete carrier markers.
  • Moderate (1 vote): The contiguous benchmark does not select the contiguous backend.
  • Nit (2 votes): Server documentation reports schema v2 while runtime uses v3.
  • Nit (1 vote): The RemoteStore plan contains the same schema-version mismatch.
File Summary
pyproject.toml Updates Blosc2 and server dependencies.
plans/​remote-store.md Documents RemoteStore design and acceptance criteria.
plans/​remote-ctable.md Documents RemoteCTable implementation and follow-up work.
examples/​benchmarks/​remote_proxy_v7.py Provides remote-array route benchmarks.
examples/​benchmarks/​remote_proxy_v7.md Documents benchmark methodology and results.
examples/​benchmarks/​remote_proxy_v7_results/​small-sparse.json Stores small sparse benchmark measurements.
examples/​benchmarks/​remote_proxy_v7_results/​small-contiguous.json Stores small contiguous benchmark measurements.
examples/​benchmarks/​remote_proxy_v7_results/​large-sparse.json Stores large sparse benchmark measurements.
examples/​benchmarks/​remote_proxy_v7_results/​large-contiguous.json Stores large contiguous benchmark measurements.
examples/​benchmark_storage_quota.py Benchmarks quota staging overhead.
examples/​benchmark_remote_store.py Benchmarks shared RemoteStore access.
doc/​utilities/​cat2-server.md Documents server policy, quota, cache, and lifecycle behavior.
doc/​utilities/​cat2-client.md Documents client attribute output.
doc/​reference/​rest_api.rst Documents metadata attributes.
caterva2/​tests/​test_treestore.py Tests TreeStore attributes.
caterva2/​tests/​test_storage_quota.py Tests quota persistence and recovery.
caterva2/​tests/​test_storage_quota_api.py Tests quota-controlled API behavior.
caterva2/​tests/​test_sparse_cache.py Tests sparse-cache lifecycle and recovery.
caterva2/​tests/​test_remote_proxy.py Tests remote-array policy and caching.
caterva2/​tests/​test_providers.py Tests provider coupling and isolation.
caterva2/​tests/​test_peers.py Tests peer metadata and table ranges.
caterva2/​tests/​test_hdf5_tree.py Tests HDF5 attributes and metadata.
caterva2/​tests/​test_ctable.py Tests table projections and refresh behavior.
caterva2/​tests/​test_cli.py Tests CLI attribute rendering.
caterva2/​tests/​test_chunk_writes.py Tests asynchronous publication verification.
caterva2/​tests/​test_attrs.py Tests public attribute handling.
caterva2/​tests/​test_api.py Tests remote API behavior and metadata.
caterva2/​services/​templates/​includes/​info_metadata.html Renders public attributes.
caterva2/​services/​storage_quota.py Implements coordinated storage admission and recovery.
caterva2/​services/​srv_utils.py Provides metadata, dispatch, and table helpers.
caterva2/​services/​remote_store.py Adds RemoteStore and RemoteCTable adapters.
caterva2/​services/​remote_proxy.py Implements secure RemoteArray resolution and caching.
caterva2/​models.py Adds public attribute metadata fields.
caterva2/​hdf5.py Preserves HDF5 attributes and quota-aware writes.
caterva2/​clients/​cli.py Displays dataset attributes.
caterva2/​client.py Adds attributes, projections, downloads, and refresh.
caterva2/​api_utils.py Supports cache-aware and cold download URLs.
caterva2-server.sample.toml Documents remote policy and quota configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread caterva2/services/remote_store.py Outdated
Comment on lines +195 to +198
except ValueError as exc:
raise fastapi.HTTPException(status_code=400, detail=str(exc)) from exc
except (OSError, zipfile.BadZipFile) as exc:
raise fastapi.HTTPException(status_code=502, detail=str(exc)) from exc
samples.append(time.perf_counter() - tick)
np.testing.assert_array_equal(result, data[selection])
if staged:
staged_bytes += path.stat().st_size
Comment on lines +228 to +230
Schema v2 is the initial Caterva2 runtime schema. The previous contiguous-carrier
implementation is retained only in the benchmark report and is not a supported
runtime backend.

This branch has not been deployed

No deployments
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.

2 participants