Skip to content

feat(api): start and reload sessions over persist-backed HTTP - #232

Merged
seonghobae merged 8 commits into
mainfrom
cursor/bc-4d6bccac-fbb0-4845-a6b4-48658cecdea5-45f4
Aug 18, 2026
Merged

feat(api): start and reload sessions over persist-backed HTTP#232
seonghobae merged 8 commits into
mainfrom
cursor/bc-4d6bccac-fbb0-4845-a6b4-48658cecdea5-45f4

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Why

A buyer still cannot start or resume an assessment over HTTP on the sealed persist path. #149 is in-process only. #161 and #204 sit on older persist. #218 locks stored instrument_release and classifies an exact Created row before fail-closed, but has no public route.

What this PR does

  • Keep the fix(session): replay exact persist after first-insert seal miss #218 persist/load/command-history/FOR UPDATE start-lock, first-insert seal, and seal-fail exact persist replay.
  • Add POST /v1/sessions and GET /v1/sessions/{session_ref} that call start_created_assessment_session_from_stored_release / load_assessment_session.
  • Treat Idempotency-Key as the durable session reference.
  • Return RFC 9457 problem details that tell the buyer the next action (publish the release, reuse the key, repair the store).
  • Add openapi/sessions.yaml (OpenAPI 3.2.0) in the same change.

Out of scope

Test plan

  • cargo test --test session_http_contract --lib session_http
  • cargo test --test documentation_architecture_contract --test traceability_active_pr_contract
  • cargo clippy --all-targets -- -D warnings
  • cargo test --test postgres_session_http (needs TEST_DATABASE_URL)

This is the HTTP successor to #218. Prefer this head over #149 and #161 for public session start. Do not merge until exact-head checks and independent last-push approval are satisfied.

Open in Web View Automation 

@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: exact-head rustfmt failed on session_http.rs Content-Length reader and session_http_framing.rs. Pushed adee00a0 rustfmt only; the reader already waits until filled >= Content-Length. Do not merge until exact-head checks and independent last-push approval succeed. Never self-approve. Prefer #138 session-start landing first if this HTTP slice depends on persisted start.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: rust FAIL on exact head adee00a0 was command_persist_locks_session_header_until_caller_commits missing the published instrument_release fixture persist now locks. Pushed b992a903. Keep #146 draft until #138 lands. Independent last-push review is still required; this comment is not approval.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: exact-head rust FAIL was command_persist_locks_session_header_until_caller_commits returning MissingCreatedIdentity because the created row was still uncommitted under READ COMMITTED. Pushed 45e3e8ee — commit the created session first, then assert the waiter Database arm through the PostgreSQL lock-timeout message. Human push retriggers the action_required merge-SHA workflows. Keep #146 draft until #138 lands. Do not merge until exact-head checks and independent last-push APPROVE succeed. This comment is not approval.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: also pushed e65b92e0 to instantiate session HTTP RFC 9457 routing/start/load mappings in the library (Linux llvm-cov left those generic arms unexecuted). Exact-head Runtime CI is re-running. Keep #146 draft until #138 lands. Do not merge without independent last-push APPROVE. This comment is not approval.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: 35a5f536 classifies persist header-lock/insert/command-count/state-update through match and instantiates load/start Database and invalid-identity arms in the library. Exact-head coverage is re-running. Keep #146 draft until #138 lands. Do not merge without independent last-push APPROVE. This comment is not approval.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: a56081d8 classifies persist command query arms through match and instantiates first-insert seal-replay Database, header UPDATE failure, and Content-Length overflow/size framing in the library. Exact-head coverage is re-running. Keep #146 draft until #138 lands. Do not merge without independent last-push APPROVE. This comment is not approval.

seonghobae added a commit that referenced this pull request Aug 17, 2026
Keep persist-backed session HTTP as Active PR #232. Cover command-table
load, insert-sink, and replay-lookup Database arms from the library.
@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: merged protected-main #105 into this slice (8eacd551) and covered command-table load/insert/replay Database arms from the library. Exact-head coverage is re-running. Keep #146 draft until #138 lands. Do not merge without independent last-push APPROVE. This comment is not approval.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: cecaabb7 instantiates command-sequence lookup Database and oversized Content-Length reject from the library. Exact-head coverage is re-running. Keep #146 draft until #138 lands. Do not merge without independent last-push APPROVE. This comment is not approval.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: bot merge 69c3d917 left required checks empty/action_required. e7e8d148 instantiates SequenceConflict, command insert Database, and full-buffer HTTP reject from the library so exact-head workflows run again. Keep #146 draft until #138 lands. Do not merge without independent last-push APPROVE. This comment is not approval.

@seonghobae

Copy link
Copy Markdown
Contributor

Hourly loop: f295f3f8 instantiates command-replay ConflictingReplay, invalid UTF-8 request decode, and write BrokenPipe from the library. Exact-head coverage is re-running. Keep #146 draft until #138 lands. Do not merge without independent last-push APPROVE. This comment is not approval.

seonghobae
seonghobae previously approved these changes Aug 17, 2026

@seonghobae seonghobae 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.

Independent last-push review of exact head 1302cfdc.

HTTP start/reload stays on the sealed persist path: Idempotency-Key is the durable session_ref, unpublished/invalid stored releases fail closed with RFC 9457 next-action types, and command HTTP / tenant isolation stay out of scope. Latest coverage commit exercises first-write failure, helper flush, and UnpublishedStart/InvalidStartRelease Display arms without changing start semantics.

Merge only after exact-head Runtime CI / coverage succeed. Prefer this head over #149/#161 for public session start.

@cursor
cursor Bot force-pushed the cursor/bc-4d6bccac-fbb0-4845-a6b4-48658cecdea5-45f4 branch from 1302cfd to 5648ce3 Compare August 17, 2026 17:53
seonghobae
seonghobae previously approved these changes Aug 17, 2026

@seonghobae seonghobae 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.

Independent last-push review on exact head 5648ce3. Persist-backed session HTTP on the sealed start path; RFC 9457 next-action errors. Merge if live product checks stay green.

cursoragent and others added 2 commits August 17, 2026 21:32
Rebased onto current main after #235. Persist-backed session HTTP stays
on the sealed start path; this rebase only keeps both sides of stale
changelog/traceability/module-list overlap and does not change persist
or session behavior.
Linux llvm-cov left the Content-Length wait-continue path and the
start-from-already-unpublished in-memory catalog replay arm unexecuted.
Prove the listener waits for the declared body, and that a buyer who
already started can retry after the in-memory catalog is suspended.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/bc-4d6bccac-fbb0-4845-a6b4-48658cecdea5-45f4 branch from 5648ce3 to d984c5d Compare August 17, 2026 21:37
@seonghobae

Copy link
Copy Markdown
Contributor

Rebased onto current protected main (0c695b9, includes #228). New exact head is d984c5d.

Coverage work on this head: the listener now waits for a fragmented Content-Length body before dispatch, and start from an already-unpublished in-memory catalog replays an exact stored session. Previous approval on 5648ce3e does not transfer.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

@seonghobae I will review the current exact head d984c5d.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 18 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 06f6f465-e395-4d98-ba7a-a5195f005df6

📥 Commits

Reviewing files that changed from the base of the PR and between 0c695b9 and 71d05b9.

📒 Files selected for processing (27)
  • CHANGELOG.md
  • docs/QUALITY_ATTRIBUTES.md
  • docs/TRACEABILITY.md
  • docs/adr/0005-hosted-assessment-runtime-state-machine.md
  • docs/adr/0014-api-and-event-contract-representation.md
  • docs/architecture/AS_BUILT_SCHEMA.md
  • docs/architecture/ERD.md
  • docs/architecture/UML.md
  • docs/doctoring/standards-and-evidence.md
  • migrations/0014_assessment_session.sql
  • migrations/0016_assessment_session_command.sql
  • openapi/sessions.yaml
  • src/instrument.rs
  • src/lib.rs
  • src/postgres_assessment_session.rs
  • src/postgres_instrument_release.rs
  • src/session.rs
  • src/session_http.rs
  • tests/postgres_assessment_session_persistence.rs
  • tests/postgres_instrument_release_query.rs
  • tests/postgres_session_http.rs
  • tests/session_aggregate_lifecycle.rs
  • tests/session_http_contract.rs
  • tests/session_http_framing.rs
  • tests/session_persisted_identity.rs
  • tests/session_start.rs
  • tests/session_state.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Exercise invalid header bytes, GET reload, numeric start identity, and the
PostgreSQL session HTTP port from the library so production line and branch
coverage can close the remaining persist-backed start/reload paths.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@seonghobae

Copy link
Copy Markdown
Contributor

@coderabbitai review

Rebased onto current protected main (0c695b9) and pushed c73e04a to close the remaining Production line/branch coverage gaps on the persist-backed session HTTP slice.

This head adds real-world tests for:

  • invalid UTF-8 session request headers (fail closed)
  • library GET reload after POST create, including content_type
  • numeric start identity rejected by the memory port
  • colon-less header lines still locating Idempotency-Key
  • PostgresSessionHttpPort start + GET reload from the library crate
  • created_session_for_start_from_published_snapshot locale/reference fail-closed
  • stored-release start, exact replay, conflicting replay, numeric stored participant load, and seal-replay when stored identity columns are missing

Product slice is unchanged: POST /v1/sessions and GET /v1/sessions/{session_ref} on the persist-backed HTTP path. Leftover PRs are not absorbed.

Please review this exact head. Independent last-push approval is still required after rebase.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

@seonghobae I will review the current exact head c73e04a. I will assess the persisted POST /v1/sessions and GET /v1/sessions/{session_ref} paths and the new fail-closed and replay coverage.


🧠 Learnings used
Learnt from: seonghobae
Repo: ContextualWisdomLab/psychometrics-commons PR: 84
File: src/anonymous_credential.rs:243-245
Timestamp: 2026-08-15T23:03:50.253Z
Learning: In Rust domain records such as `src/anonymous_credential.rs::AnonymousCredential`, tenant, participant, and session references are consumed from other product boundaries rather than issued locally. Enforce opaque public-ID generation at the responsible issuer and shared reference contract, not with an ad-hoc format or entropy parser in each consuming domain record. `src/reference.rs::normalized_reference` is the shared canonical-reference validation boundary; pull request `#78` hardens it to reject whitespace-padded aliases.
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

The assessment_session table rejects a numeric participant_ref at insert.
Drop that check first so load can prove it still fails closed when a
repaired-badly store contains an illegal stored identity.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@seonghobae

Copy link
Copy Markdown
Contributor

@coderabbitai review

seonghobae
seonghobae previously approved these changes Aug 17, 2026

@seonghobae seonghobae 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.

Independent last-push review on exact head 14fa6cb. Persist-backed session HTTP on the sealed start path after #228; RFC 9457 next-action errors. Merge when live product checks including line/branch coverage stay green.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Execute command replay, fail-closed corrupt history, and persist-backed
GET/UTF-8 framing in the library crate so Linux llvm-cov instantiations
reach the production line and branch gates.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
cursoragent and others added 2 commits August 17, 2026 22:47
Cover the Linux llvm-cov From<PersistenceError> instantiation and the
decode_request_bytes map_err closure that remain after library load
replay tests, without changing session HTTP behavior.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Execute library and integration-crate start/persist error arms that LLVM
JSON counts per instantiation so production line coverage can reach 100%
without changing product behavior or coverage policy.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@seonghobae

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Linux llvm-cov JSON counted the `|` or-pattern source lines in
From<InstrumentReleaseQueryError> as uncovered (1850/1854) even though
the last arm executed. Give each query-error variant its own match arm
and execute those mappings from the integration crate, including the
Database start path, without changing persist or session start semantics.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
@seonghobae

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae seonghobae 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.

Independent last-push review on exact head 71d05b9. Persist-backed session HTTP on the sealed start path; RFC 9457 next-action errors. Production line/branch coverage, Rust, Strix, and product CI are green on this head. Squash merge.

@seonghobae
seonghobae merged commit db9b307 into main Aug 18, 2026
34 checks passed
cursor Bot pushed a commit that referenced this pull request Aug 18, 2026
Rebase onto db9b307 must not keep claim-next, observation-time ingest, or
persist-backed session HTTP as Active PR work. Keep #242 append-only audit
evidence explicitly segregated.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Aug 18, 2026
Rebase onto 5dd52d4 must not keep claim-next, observation-time ingest,
persist-backed session HTTP, or supplied-record anonymous command
authorization as Active PR work. Keep #242 append-only audit evidence
explicitly segregated.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
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