feat(id): brand SessionID through Drizzle and Zod schemas (#16953)

This commit is contained in:
Kit Langton
2026-03-11 19:16:56 -04:00
committed by GitHub
parent 4e73473119
commit cb67465675
44 changed files with 226 additions and 158 deletions

View File

@@ -2,6 +2,7 @@ import { test, expect } from "bun:test"
import { Question } from "../../src/question"
import { Instance } from "../../src/project/instance"
import { tmpdir } from "../fixture/fixture"
import { SessionID } from "../../src/session/schema"
test("ask - returns pending promise", async () => {
await using tmp = await tmpdir({ git: true })
@@ -9,7 +10,7 @@ test("ask - returns pending promise", async () => {
directory: tmp.path,
fn: async () => {
const promise = Question.ask({
sessionID: "ses_test",
sessionID: SessionID.make("ses_test"),
questions: [
{
question: "What would you like to do?",
@@ -43,7 +44,7 @@ test("ask - adds to pending list", async () => {
]
Question.ask({
sessionID: "ses_test",
sessionID: SessionID.make("ses_test"),
questions,
})
@@ -73,7 +74,7 @@ test("reply - resolves the pending ask with answers", async () => {
]
const askPromise = Question.ask({
sessionID: "ses_test",
sessionID: SessionID.make("ses_test"),
questions,
})
@@ -97,7 +98,7 @@ test("reply - removes from pending list", async () => {
directory: tmp.path,
fn: async () => {
Question.ask({
sessionID: "ses_test",
sessionID: SessionID.make("ses_test"),
questions: [
{
question: "What would you like to do?",
@@ -146,7 +147,7 @@ test("reject - throws RejectedError", async () => {
directory: tmp.path,
fn: async () => {
const askPromise = Question.ask({
sessionID: "ses_test",
sessionID: SessionID.make("ses_test"),
questions: [
{
question: "What would you like to do?",
@@ -173,7 +174,7 @@ test("reject - removes from pending list", async () => {
directory: tmp.path,
fn: async () => {
const askPromise = Question.ask({
sessionID: "ses_test",
sessionID: SessionID.make("ses_test"),
questions: [
{
question: "What would you like to do?",
@@ -236,7 +237,7 @@ test("ask - handles multiple questions", async () => {
]
const askPromise = Question.ask({
sessionID: "ses_test",
sessionID: SessionID.make("ses_test"),
questions,
})
@@ -261,7 +262,7 @@ test("list - returns all pending requests", async () => {
directory: tmp.path,
fn: async () => {
Question.ask({
sessionID: "ses_test1",
sessionID: SessionID.make("ses_test1"),
questions: [
{
question: "Question 1?",
@@ -272,7 +273,7 @@ test("list - returns all pending requests", async () => {
})
Question.ask({
sessionID: "ses_test2",
sessionID: SessionID.make("ses_test2"),
questions: [
{
question: "Question 2?",