brain/gateway: prohibit mission_tasks.status as a write source (M4-3a phase 1)
ci/woodpecker/pr/ci Pipeline was canceled

SHARED-CONTRACT §5.1 phase 1 N-1 patch, ahead of the M4-3a expand DDL:
- mission-tasks repo (sole write path) strips status on create/update;
  the column keeps its DB default and stays declared and readable.
- missions controller stops forwarding dto.status on create.
- DTO status fields stay declared (forbidNonWhitelisted would 400 frozen
  legacy consumers) but are documented deprecated/ignored.
- §5.5 write-prohibition spec: 4 tests on what reaches the Drizzle chain.
This commit is contained in:
fred
2026-08-29 16:21:04 -05:00
parent 5399c6b7e7
commit 931542ee19
4 changed files with 106 additions and 3 deletions
@@ -108,11 +108,13 @@ export class MissionsController {
) {
const mission = await this.brain.missions.findByIdAndUser(missionId, user.id);
if (!mission) throw new NotFoundException('Mission not found');
// dto.status is deliberately not forwarded: mission_tasks.status is
// write-prohibited through the N-1 window (SHARED-CONTRACT §5.1 phase 1);
// the repo strips it as well.
return this.brain.missionTasks.create({
missionId,
taskId: dto.taskId,
userId: user.id,
status: dto.status,
description: dto.description,
notes: dto.notes,
pr: dto.pr,
+12
View File
@@ -77,6 +77,12 @@ export class CreateMissionTaskDto {
@IsUUID()
taskId?: string;
/**
* @deprecated Accepted for N-1 wire compatibility but ignored: mission_tasks.status
* is write-prohibited through the migration window (SHARED-CONTRACT §5.1 phase 1).
* The field stays declared because the global ValidationPipe runs with
* forbidNonWhitelisted, and removing it would 400 frozen legacy consumers.
*/
@IsOptional()
@IsIn(taskStatuses)
status?: 'not-started' | 'in-progress' | 'blocked' | 'done' | 'cancelled';
@@ -102,6 +108,12 @@ export class UpdateMissionTaskDto {
@IsUUID()
taskId?: string;
/**
* @deprecated Accepted for N-1 wire compatibility but ignored: mission_tasks.status
* is write-prohibited through the migration window (SHARED-CONTRACT §5.1 phase 1).
* The field stays declared because the global ValidationPipe runs with
* forbidNonWhitelisted, and removing it would 400 frozen legacy consumers.
*/
@IsOptional()
@IsIn(taskStatuses)
status?: 'not-started' | 'in-progress' | 'blocked' | 'done' | 'cancelled';