blob: 65dae50925403d503af29995560d4cbf2820127a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
---
name: claudomator-stories-not-null-bug
description: "POST /api/stories fails with NOT NULL constraint errors unless validation and deploy_config are explicitly passed, contradicting their documented \"nil/omitted if unset\" semantics"
metadata:
node_type: memory
type: project
originSessionId: 560b9055-7a3f-483e-b1a0-1a4c70419390
---
`POST /api/stories` rejects a request that omits `validation` or `deploy_config` with `"NOT NULL constraint failed: stories.validation_json"` / `"...stories.deploy_config"`. `internal/story/story.go`'s `Story.Validation`/`Story.DeployConfig` fields (`json.RawMessage`, `omitempty`) are documented as "freeform JSON... nil/omitted if unset" and `internal/storage/story.go` has a `rawJSONOrNull` helper that appears intended to convert a nil `RawMessage` to a real SQL NULL — but the `stories` table's `validation_json`/`deploy_config` columns apparently have `NOT NULL` constraints that contradict this. Found 2026-07-10 while creating a story via the REST API directly (no chatbot MCP story-creation tool was exposed in that session).
**Why:** Not investigated further — could be the columns were declared `NOT NULL` in an early migration before the "nullable, freeform" design was settled, or `rawJSONOrNull` has a bug. Not fixed as part of this finding.
**How to apply:** When creating a story via `POST /api/stories` (REST directly, not through a UI/tool that already works around this), always pass explicit `"validation": {}` and `"deploy_config": {}` even if you have no real content for them yet — omitting either field fails the request. Worth a real fix (either drop the `NOT NULL` constraint via a migration, or make `rawJSONOrNull` actually write a valid empty-JSON default instead of relying on true SQL NULL) if this comes up again.
|