OSS-first docs
These docs teach the open system first: contracts, generated surfaces, runtimes, governance, and incremental adoption. Studio shows up as the operating layer on top, not as the source of truth.
Add a comment to an approval request.
Goal
Allow discussion on approval requests.
Context
Approval detail view.
Emitted Events
•
`workflow.approval.comment.added` (v1.0.0)
Source Definition
import {
defineCommand,
defineQuery,
} from '@lssm-tech/lib.contracts-spec/operations';
import { defineSchemaModel, ScalarTypeEnum } from '@lssm-tech/lib.schema';
import { ApprovalDecisionEnum, ApprovalStatusEnum } from './approval.enum';
import { ApprovalCommentModel, ApprovalRequestModel } from './approval.schema';
export const AddApprovalCommentContract = defineCommand({
meta: {
key: 'workflow.approval.comment.add',
version: '1.0.0',
stability: 'stable',
owners: ['@example.workflow-system'],
tags: ['workflow', 'approval', 'comment'],
description: 'Add a comment to an approval request.',
goal: 'Allow discussion on approval requests.',
context: 'Approval detail view.',
},
io: {
input: defineSchemaModel({
name: 'AddCommentInput',
fields: {
requestId: {
type: ScalarTypeEnum.String_unsecure(),
isOptional: false,
},
content: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
isInternal: { type: ScalarTypeEnum.Boolean(), isOptional: true },
},
}),
output: ApprovalCommentModel,
},
policy: { auth: 'user' },
sideEffects: {
emits: [
{
key: 'workflow.approval.comment.added',
version: '1.0.0',
when: 'Comment is added',
payload: ApprovalCommentModel,
},
],
},
acceptance: {
scenarios: [
{
key: 'add-comment-happy-path',
given: ['Approval request exists'],
when: ['User adds a comment'],
then: ['Comment is added', 'CommentAdded event is emitted'],
},
],
examples: [
{
key: 'add-question',
input: {
requestId: 'req-123',
content: 'Can you clarify budget?',
isInternal: false,
},
output: { id: 'com-789', content: 'Can you clarify budget?' },
},
],
},
});