feat(research): read verified frozen datasets (RP28)

This commit is contained in:
Boki 2026-10-28 00:03:15 -04:00
parent 04892a59fe
commit 4b9c642817
9 changed files with 263 additions and 18 deletions

View file

@ -8,13 +8,13 @@ Selected scope: allow only the existing exact GET/HEAD canonical export path wit
Add `ResearchClient.canonicalDataset(hash, signal?)`, using the existing `validateDatasetV2` content/hash validator and matching the requested hash. Return detached, frozen retained bars/metadata without interpolation or provider queries. Callers select the exact hash from the saved run request or predeclared experiment input, including phase-specific hashes. No new storage, financial calculations, caches, input truncation or automatic research execution.
Affected files: research credential service/allowlist; research client and tests; authenticated AI workflow fixture/tests; existing security integration tests; README usage. The dataset export/validator implementation remains authoritative and is reused unchanged.
Affected files: research credential service/allowlist; research client and tests; authenticated AI workflow fixture/tests; existing security/export integration tests; README usage and the operator page's permission description. The dataset export/validator implementation remains authoritative and is reused unchanged. The web change is descriptive copy only.
Acceptance/tests:
- Exact known-hash GET/HEAD export authenticates a real research credential; source/data-write/catalog/admin/trading routes remain denied as before. Malformed/extra dataset paths fail closed. Revoked credentials cannot export.
- Typed reads preserve original bars, calendar/session/availability metadata, lineage/hash and limitations. Invalid hash inputs fail before transport; tampered content, derived-policy mismatches and a different valid dataset fail as read errors without retries.
- Actual API tests compare exports to retained PostgreSQL payloads, demonstrate existing saved-template edits do not change a prior hash, and verify no runs/experiments/datasets are created by reads. Unknown/corrupt snapshots produce the existing 404/409 read errors. Abort/deadline behavior uses the existing client transport.
- Run client/cycle and focused credential/security suites, complete tooling/integration, actual PostgreSQL AI/agent tests, application/authored types, contracts, strict lint/formatting and secrets. No engine/web rebuild or browser change is necessary.
- Run client/cycle and focused credential/security suites, complete tooling/integration, actual PostgreSQL AI/agent tests, application/authored types, contracts, strict lint/formatting and secrets. Build the web app to verify the permission description; no engine rebuild or browser-flow change is necessary.
Definition of done: reproduce the missing typed/read permission capability, add the narrow existing endpoint access and typed read, review shared research-read versus privileged data-write scope, pass gates, document usage/holdout discipline, update task state and commit. This fits ADR-007 research/data isolation; no new architecture approval is required.