18 lines
3.2 KiB
Markdown
18 lines
3.2 KiB
Markdown
# RP29 — Reopen original research hypotheses through the typed client
|
|
|
|
Parent E12. Priority P2 / Medium reproducibility gap. Complexity S. Dependencies A03, R03, RP25. Owner continuation authorizes implementation and commits. All seven conditional tasks remain deferred.
|
|
|
|
Verified baseline: `ResearchClient.createHypothesis` records the accepted hypothesis/revision in the cycle journal, and findings refer to immutable hypothesis revision IDs. The existing authenticated `GET /api/v2/hypotheses/:id` and `/revisions` routes and PostgreSQL history already exist, but the typed client cannot read them. RP25 added the corresponding artifact reads. A later human edit therefore requires a separate transport to recover the original proposition and validation criteria.
|
|
|
|
Scope: add `ResearchClient.hypothesis(id, signal?)` and `hypothesisRevisions(id, signal?)` through the existing read transport. Decode complete retained ownership/archive/timestamp fields and revision IDs, ordinals, parent identity, title, proposition, validation criteria and actual authorship. Permit human/AI/unknown origins and operator/service/agent authors on reads while retaining the narrow AI creation acknowledgement. Require unvalidated state; history must be nonempty with matching parents and unique revision IDs/ordinals. Preserve returned ordering; callers select the journal's exact revision ID, never latest as a substitute.
|
|
|
|
Affected files: `scripts/research-client.ts`, `scripts/test/research-client.test.ts`, `test/postgres/ai-research-workflow.test.ts` and README usage. Reuse existing routes, persistence and authentication unchanged. No new permission, schema, endpoint, financial arithmetic, candidate execution, generic SDK framework, automatic cycle resume or real study execution.
|
|
|
|
Acceptance/tests:
|
|
|
|
- Exact authenticated GETs preserve original text/criteria, actual authorship, ownership, archival state and revision identities. Reading a human-edited latest hypothesis and its history recovers the original journal revision. Service-authored unknown-origin hypotheses remain readable. Reads do not manufacture validation evidence.
|
|
- Wrong record/parent IDs, missing or malformed fields, invalid authorship/state, empty/mixed-parent/duplicate histories are read errors. Invalid IDs fail before transport. Missing/revoked/HTTP-failed/aborted/deadline reads preserve existing read-error behavior without retries or writes.
|
|
- Actual issued research credentials read an AI-created hypothesis after a fixture-only human revision and archival, recover both immutable revisions with exact original content and retain an existing finding's original hypothesis revision linkage. A service-authored hypothesis is readable, unknown IDs return 404, and revocation returns 401. Read-only request and database counts remain unchanged.
|
|
- Run client/cycle and complete tooling suites; actual PostgreSQL AI workflow; application/authored types, contracts, strict scoped lint/formatting, secrets and diff checks. Existing backend/financial/UI behavior is unchanged, so no native rebuild or browser rerun is required.
|
|
|
|
Definition of done: reproduce the missing read capability, implement the two narrow methods, review read-versus-create validation and immutable revision selection, pass gates, document use, update task state and commit.
|