← Back to Pull requests

feat(api): add the steward dataset listing route (P39) #246

Closed
unknown closed this pull request without merging on Nov 19, 2026 11:44 UTC
View on GitHub
unknown unknown commented on Nov 14, 2026 10:59 UTC
Author

What and why

Plan item P39 (docs/V1_PLAN.md). Closes #218. Definition-of-done item 1 ends with the steward able to "see it stored as ciphertext", and the publish form (#221) and dataset deletion (#219) need the steward's datasets by id. No route listed a tenant's research datasets: GET /api/v1/drive/objects lists drive objects only, and GET /api/v1/catalog only published listings. This is the "Upload" step of the dataset lifecycle in docs/PROJECT_SCOPE.md.

  • Route. GET /api/v1/datasets, beside the upload route in datasets.rs, behind the same access-token middleware. The tenant comes from the token only. Like uploads, it needs only the vault and the configuration, so it answers where the query and research services are not configured.

  • Holds. It lists every dataset the tenant holds under tenants/{tid}/connectors/: uploads, connector syncs and the dataset devstack seeds. One function, snapshot::newest_committed, now picks the newest committed snapshot for holds (which publish_listing calls) and for the new snapshot::held_datasets and snapshot::held_dataset, so the list is exactly what publishing accepts.

  • Entries. Each entry describes the current snapshot only, without opening anything:
  •   {"dataset":"health","version":"01794652907833260000-824aba…","written_at":"2026-11-14T10:41:47.833Z","suite":"HPK1","object_count":1,"ciphertext_bytes":7277,"objects":["f67d8418-…"]}
      

    version is the newest manifest's, read from its path. written_at comes from the version (RFC 3339, to the millisecond). objects, object_count and ciphertext_bytes cover the objects stored at that version, so superseded snapshots awaiting pruning and uploads that have not committed are not counted. suite is what the snapshot's plaintext record names (new snapshot::recorded_suite). Nothing beyond what ADR 0012 makes operator-visible appears; the declared schema and row cap stay out.

  • Cost. One listing of the tenant's datasets, then one record read per dataset, 16 at a time, and one more listing for each dataset whose record turns out to be missing (below). That first listing reads every path under the tenant's datasets, superseded snapshots awaiting pruning included, before the cap is checked: like the drive listing's, the cap bounds the response and the record reads, not that listing. The code says so.

  • A snapshot replaced during the listing. A missing record can mean that an upload or sync committed after the listing found the snapshot and pruned it. So the dataset is read again, once (snapshot::held_dataset, one listing of its own paths), and described as it is then: a newer snapshot with its own record's suite, or, at the same version, with "suite": null. A dataset no longer held is left out.

  • Bounds and errors. MAX_LISTED_OBJECTS (1000, the drive listing's cap from P41, #172) bounds both the datasets and the objects across them. More than that is refused with 422 rather than listed in part. A storage failure is 503 (transient, with Retry-After) or 502, never an empty list.

  • Audit. Each listing is a data.access "ok" event (list_datasets count=N), or "denied" over the cap.

  • Storage paths. New TenantPaths::connectors_root, and TenantPaths::connector_of, which finds the dataset a path belongs to.

  • Docs. docs/ARCHITECTURE.md (Steward upload, Catalog, and the capture-test list), docs/THREAT_MODEL.md (forged or rolled-back snapshots: the listing reports storage as it finds it), docs/PROJECT_SCOPE.md, README.md (the route, and a curl in the local-stack steps), CHANGELOG.md.
  • For reviewers:

  • Stacked on P52. This branch is built on p52 (#243), with p52 merged in, so the base is p52 and the diff is only this work. Retarget to main once #243 merges. The overlap with it is in CHANGELOG.md, docs/ARCHITECTURE.md, docs/PROJECT_SCOPE.md, docs/THREAT_MODEL.md, platform-api/src/lib.rs, audit_coverage.rs and platform-storage/src/lib.rs.

  • "Same function" as the publish check. The listing does not call holds() for each dataset, which would cost one more storage listing per dataset. Both go through newest_committed on the same manifest paths, and tests check that every listed dataset can be published and that an unlisted one cannot.

  • Where. The issue names research.rs and research_api.rs. The route sits with the upload route instead: it is the same resource, and it works without the research service, which holds the vault only for the publish check. Its tests go in that route's test file, dataset_upload_api.rs, as docs/TESTING.md asks.

  • Sizes. They come from the one listing's per-object sizes (list_entries, the same metadata VaultStore::usage sums) rather than separate usage calls, so the ids, count and bytes always agree.

  • Missing or unreadable records. A held dataset whose record is malformed or names a suite this build cannot read, or is still missing when the dataset is read again, is listed with "suite": null. It is not dropped, because the list must match holds and #219's delete needs it, and it does not fail the whole listing either. Dropping every entry whose record is missing, as the drive listing drops a manifest deleted mid-listing, would hide a dataset that is still held after a re-upload; for drive, a missing manifest means the object is gone.

  • Object ids are what is stored, not what the manifest lists. The manifest is sealed. Pruning at commit makes the two the same, except for an object stored at the version after the commit, or one whose deletion failed.

  • Declared schema. Not listed, following the issue's field list. #221's check before sealing will need the recorded schema; this route could add it.

  • Pagination. The cap is all-or-nothing per tenant, so a steward with more than 1,000 current objects can list nothing, and cannot pick a dataset to publish (#221) or delete (#219). Whether that needs pagination before v1.0 is the maintainer's decision; nothing here assumes either answer.

  • P78. No issue holds the P78 checklist yet, so there is nothing to tick.

  • Dependency audit. On 2026-11-18 the required dependency audit started failing on every PR. Three new RustSec advisories mark humantime, chrono and chrono-tz unmaintained (RUSTSEC-2026-0542, -0543 and -0555), with no fixed release, and arrow, DataFusion 55 and object_store 0.13 depend on them. e973173 adds an exception for each to backend/deny.toml, saying why it does not apply and when it is revisited, plus a Security line in CHANGELOG.md, so this PR's audit passes. main needs the same exceptions before #243 and the other PRs pass; if they land there first, this PR takes main's copy.

  • Code owners: backend/deny.toml (AxolDad, abendrothj, angelina0i0); no other changed path has one.
  • How it was tested

    New tests:

  • platform-api/tests/dataset_upload_api.rs:

  • - the_listing_shows_each_upload_as_the_current_snapshot: an empty list first; one entry after an upload, with every field checked; still one entry, at the new snapshot, after a re-upload; no other fields, so no declared column names;
    - a_partial_upload_is_never_listed: a first upload that stops before its manifest lists nothing and cannot be published; one that stops after a committed upload leaves that upload listed;
    - a_superseded_snapshots_objects_are_not_counted: an earlier snapshot's manifest and object back in storage, as after a failed prune;
    - another_tenants_datasets_are_never_listed: the same status and body as a tenant that stored nothing; datasets of the same name in two tenants;
    - synced_and_seeded_datasets_are_listed_as_publishing_sees_them: the devstack seed, and two QuickBooks syncs plus an upload; sizes match storage; every listed dataset can be published and an unlisted one cannot;
    - a_dataset_whose_record_is_unreadable_is_listed_without_a_suite: a malformed record, then a missing one;
    - listing_without_an_access_token_is_401: no token, preauth, refresh;
    - a_listing_over_the_cap_is_422: at the cap it lists; one dataset or one object more is refused;
    - a_storage_failure_fails_the_listing: the listing or the record read fails, transiently (503 with Retry-After) or permanently (502);
    - a_re_upload_during_a_listing_is_listed_as_the_new_snapshot: a real re-upload (commit_upload) commits and prunes between the listing and the record read; the entry is the new snapshot with its suite;
    - a_dataset_removed_during_a_listing_is_not_listed: every object of the dataset is deleted at that point; the listing is empty and publishing agrees;
    - a_storage_failure_while_reading_a_dataset_again_is_503: the record is pruned and the second read meets an outage.
  • platform-api/tests/audit_coverage.rs: dataset_listing_is_audited (ok for 0 and 1 datasets, denied over the cap, with exact details and tenant).

  • platform-connectors (snapshot.rs): held_datasets_lists_exactly_the_datasets_held (agreement between holds, the listing and held_dataset, and another tenant), held_datasets_describe_only_the_current_snapshot, recorded_suite_reads_only_a_valid_record (a missing record told apart from an unreadable one).

  • platform-storage: every_dataset_path_names_its_dataset_and_tenant; listing_is_isolated_per_tenant_prefix now covers connectors_root.

  • platform-api (datasets.rs): write_times_cover_every_version, up to the largest version.
  • Also run by hand on devstack: the steward gets the seeded health dataset, the researcher gets {"datasets":[]}, and a request without a token gets 401.

    Checklist

  • scripts/check.sh passes locally (its secret-scan step was skipped: gitleaks is not installed locally)

  • Every new refusal has a negative test

  • Every new security decision emits a SECURITY_AUDIT_EVENT covered by audit_coverage.rs

  • Fails closed on missing configuration, key material, or attestation (no key material or attestation involved; a storage failure is an error, never an empty list)

  • No new cryptographic primitives; suites stay behind their type aliases

  • Synthetic or public data only (docs/DATA_POLICY.md): test data is generated in the tests

  • Docs and CHANGELOG.md updated for user-visible changes

  • Architectural decision recorded in docs/adr/ if one was made (none: covered by ADR 0012 and ADR 0003, as the issue says)
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: abendrothj Review duration: 7245m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #246"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%