For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Align the conversation-share client, service, and mock with backend API revision 23: slim confirm requests and two-hash preview/continuation integrity.
Architecture: Keep the UI and RPC contract unchanged. Split publish integrity from preparation idempotency: the confirm DTO contains only selected turns, public rows, two integrity hashes, and disclosure confirmation, while the service hashes that complete slim DTO separately for preparation.payload_sha256. The stateful mock reconstructs metadata and artifact descriptors from preparation/upload state before producing preview and continuation responses.
Tech Stack: TypeScript, Zod, Vitest, Node.js crypto, pnpm workspace.
ConversationRow fields stay camelCase; share-service fields stay snake_case.schema_version, client_request_id, title, access_mode, content_selection_id, artifacts, or integrity.payload_sha256.projection_sha256 and artifact_set_sha256.payload_sha256 as an idempotency key.pnpm typecheck and pnpm lint before completion.Files:
packages/shared/src/conversation-share.ts:121-217packages/shared/test/conversationShareContract.test.ts:54-270Interfaces:
ConversationShareIntegrity with exactly two hashes.ConversationShareConfirmRequest with exactly four top-level fields.Consumers: HTTP client, service integrity builder, mock transport, Preview and Continuation parsers.
[x] Step 1: Write failing contract tests
Change the confirm fixture to the revision 23 body and assert the parsed key set:
const parsed = conversationShareConfirmRequestSchema.parse({
selected_product_turn_ids: ["product-turn-1"],
projection: { rows: completedRows },
integrity: {
projection_sha256: SHA_256,
artifact_set_sha256: SHA_256,
},
disclosure_confirmation: {
version: 1,
accepted_at: 1_788_415_002_000,
acknowledged_no_secret_detection: true,
},
});
expect(Object.keys(parsed)).toEqual([
"selected_product_turn_ids",
"projection",
"integrity",
"disclosure_confirmation",
]);
Add an assertion that a legacy confirm body containing payload_sha256 throws. Remove payload_sha256 from Preview and Continuation fixtures and assert both parse successfully.
Run: pnpm exec vitest run packages/shared/test/conversationShareContract.test.ts
Expected: FAIL because the current confirm schema requires legacy metadata/artifact fields and current response integrity requires payload_sha256.
Change conversationShareIntegritySchema to:
export const conversationShareIntegritySchema = z
.object({
projection_sha256: conversationShareSha256Schema,
artifact_set_sha256: conversationShareSha256Schema,
})
.strict();
Change conversationShareConfirmRequestSchema to the four allowed fields from the failing fixture. Keep Preview and Continuation using the two-hash integrity schema.
Run: pnpm exec vitest run packages/shared/test/conversationShareContract.test.ts
Expected: PASS.
Files:
packages/services/src/conversation-share/conversationShareIntegrity.ts:1-105packages/services/src/conversation-share/conversationShareService.ts:145-174packages/services/test/conversationShareIntegrity.test.ts:55-104packages/services/test/conversationShareService.test.ts:190-230Interfaces:
ConversationShareConfirmRequest from Task 1.buildConversationShareConfirmRequest(input) returning the slim DTO.Produces: sha256ConversationShareJson(confirmRequest) passed only as preparation.payload_sha256.
[x] Step 1: Write failing integrity and service tests
Replace the four-hash integrity test with assertions that the builder returns no legacy fields:
expect(request).toEqual({
selected_product_turn_ids: ["product-turn-1"],
projection: { rows },
integrity: {
projection_sha256: "7a748f1dac380029522841af7a40f7d33004368435c7e08a09c4a09c7592b7ba",
artifact_set_sha256: "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
},
disclosure_confirmation,
});
In the service test, assert:
expect(confirmRequests[0]).not.toHaveProperty("payload_sha256");
expect(confirmRequests[0].integrity).not.toHaveProperty("payload_sha256");
expect(preparationRequests[0].payload_sha256).toBe(
sha256ConversationShareJson(confirmRequests[0]),
);
Also assert preparation metadata still comes from PublishTextConversationInput, because it is no longer present on the confirm request.
Run: pnpm exec vitest run packages/services/test/conversationShareIntegrity.test.ts packages/services/test/conversationShareService.test.ts
Expected: FAIL because the builder and service still use legacy confirm fields and read preparation metadata/hash from confirm.
Define the builder input as the slim confirm fields plus a local-only artifact descriptor array:
type ConversationShareConfirmRequestBase = Omit<
ConversationShareConfirmRequest,
"integrity"
> & {
artifacts: ConversationShareArtifactDescriptor[];
};
Compute projection_sha256 from projection.rows, compute artifact_set_sha256 from the sorted local-only artifacts, and return only the revision 23 confirm schema. In ConversationShareService, construct preparation with input.clientRequestId, input.title.trim(), input.accessMode, and sha256ConversationShareJson(confirmRequest).
Add a Chinese comment at the service boundary explaining that revision 23 removed the hash from confirm and preparation now receives the independently calculated idempotency key.
Run: pnpm exec vitest run packages/services/test/conversationShareIntegrity.test.ts packages/services/test/conversationShareService.test.ts
Expected: PASS.
Files:
packages/services/src/conversation-share/conversationShareMockApiClient.ts:1-458packages/services/test/conversationShareHttpClient.test.ts:102-227packages/services/test/conversationShareMockApiClient.test.ts:1-330Interfaces:
Produces: Mock Preview/Continuation responses whose metadata comes from preparation and whose artifact list comes from successful uploads.
[x] Step 1: Write failing HTTP and Mock tests
Update the HTTP logging/serialization fixture to the slim body and assert the serialized body equals it exactly. In Mock lifecycle tests, assert Preview and Continuation integrity contain exactly:
expect(Object.keys(preview.integrity).sort()).toEqual([
"artifact_set_sha256",
"projection_sha256",
]);
Add a strict rejection test showing that a legacy confirm body with payload_sha256 returns code 3001. Keep the existing upload-incomplete and invalid-public-row cases, but construct their preparation hash with sha256ConversationShareJson(confirmRequest).
Run: pnpm exec vitest run packages/services/test/conversationShareHttpClient.test.ts packages/services/test/conversationShareMockApiClient.test.ts
Expected: FAIL because the Mock still reads metadata, artifacts, and payload hash from confirm.
Store accessMode, title, and sorted uploaded artifacts on StoredShare separately from the slim confirm request:
interface StoredShare {
shareId: string;
shareCode: string;
ownerToken: string;
createdAt: number;
expiresAt: number;
title: string;
accessMode: ConversationShareAccessMode;
artifacts: ConversationShareArtifactDescriptor[];
request: ConversationShareConfirmRequest;
}
In confirm, require preparation.uploads.size === preparation.request.artifact_count, sort the uploaded descriptors by artifact_id, rebuild the expected two hashes with buildConversationShareConfirmRequest, and compare only those hashes. Build response metadata from preparation and artifact responses from StoredShare.artifacts.
Add a Chinese comment explaining that revision 23 intentionally removes preparation metadata and artifact descriptors from confirm, so the Mock must reconstruct them like the backend.
Run: pnpm exec vitest run packages/services/test/conversationShareHttpClient.test.ts packages/services/test/conversationShareMockApiClient.test.ts
Expected: PASS.
Files:
packages/shared/test/conversationShareContract.test.tspackages/services/test/conversationShare*.test.tsdocs/superpowers/specs/2026-08-10-conversation-share-api-integration-design.mdInterfaces:
Produces: verified revision 23 implementation with no unrelated changes staged.
[x] Step 1: Run all conversation-share tests
Run: pnpm exec vitest run packages/shared/test/conversationShareContract.test.ts packages/services/test/conversationSharePublicProjection.test.ts packages/services/test/conversationShareService.test.ts packages/services/test/conversationShareHttpClient.test.ts packages/services/test/conversationShareIntegrity.test.ts packages/services/test/conversationShareComposition.test.ts packages/services/test/conversationShareMockApiClient.test.ts
Expected: all files and tests PASS.
Run: pnpm typecheck
Expected: exit code 0.
Run: pnpm lint
Expected: exit code 0 with no new warnings attributable to changed files.
Run: git diff --check
Run: git diff -- docs/superpowers/plans/2026-08-11-conversation-share-revision-23.md packages/shared/src/conversation-share.ts packages/shared/test/conversationShareContract.test.ts packages/services/src/conversation-share/conversationShareIntegrity.ts packages/services/src/conversation-share/conversationShareService.ts packages/services/src/conversation-share/conversationShareMockApiClient.ts packages/services/test/conversationShareIntegrity.test.ts packages/services/test/conversationShareService.test.ts packages/services/test/conversationShareHttpClient.test.ts packages/services/test/conversationShareMockApiClient.test.ts
Expected: only revision 23 contract, hash, mock, tests, and this plan are present.
[x] Step 4: Commit the implementation
git add docs/superpowers/plans/2026-08-11-conversation-share-revision-23.md packages/shared/src/conversation-share.ts packages/shared/test/conversationShareContract.test.ts packages/services/src/conversation-share/conversationShareIntegrity.ts packages/services/src/conversation-share/conversationShareService.ts packages/services/src/conversation-share/conversationShareMockApiClient.ts packages/services/test/conversationShareIntegrity.test.ts packages/services/test/conversationShareService.test.ts packages/services/test/conversationShareHttpClient.test.ts packages/services/test/conversationShareMockApiClient.test.ts
git commit -m "fix(conversation-share): align revision 23 confirm contract"