Skip to content

Fix #169: novelty accepts the AC request shape (texts:[string] / ideas:[string])#171

Merged
mkreyman merged 2 commits into
masterfrom
fix/169-novelty-request-shape
Jun 24, 2026
Merged

Fix #169: novelty accepts the AC request shape (texts:[string] / ideas:[string])#171
mkreyman merged 2 commits into
masterfrom
fix/169-novelty-request-shape

Conversation

@mkreyman

Copy link
Copy Markdown
Owner

Summary

Closes #169. POST /api/v1/knowledge/novelty worked but only accepted ideas: [{text}], deviating from the #152 AC / CREATIVITY.md contract (texts: [string]). The documented shapes (texts:[...], ideas:["string"]) returned 400 "each idea must be an object".

Fix (the "accept the AC shape too" non-deferral option)

The endpoint now coerces all three shapes to idea objects:

A bare string becomes %{"text" => string}; objects pass through. Neither ideas nor texts is required individually — provide one. The documented request shape and the idea-synthesizer consumer now agree.

Docs (all in-PR)

  • OpenAPI novelty request_body + description document both texts and ideas shapes, meta.prior_count, novelty_score semantics, and the default proposal prior corpus.
  • MCP knowledge_novelty tool accepts/forwards texts; schema lists both texts and ideas (neither required). mcp-server README + CHANGELOG (2.21.1).

ACs re-validated (#152 novelty)

  • texts:[string]200 with scored ideas (was 400).
  • ideas:[string] → 200; ideas:[{text}] → 200 (unchanged).
  • meta.prior_count + novelty_score (cosine distance to nearest prior, default tag:proposal) present and documented.

Tests added for the texts/strings shapes. Full suite green (2527), mix precommit + MCP 45/45 clean.

mkreyman added 2 commits June 23, 2026 23:38
…s:[string])

POST /api/v1/knowledge/novelty worked but only accepted `ideas: [{text}]`,
deviating from the #152 AC / CREATIVITY.md contract `texts: [string]` and from a
plausible `ideas: [string]`. Passing either of the documented shapes returned
400 "each idea must be an object", which would bite the idea-synthesizer
integration.

Fix (non-deferral, the "accept the AC shape too" option): the endpoint now
coerces all three shapes to idea objects:
- `texts: ["...", ...]`            (the #152 AC shape — strings)
- `ideas: ["...", ...]`            (bare strings)
- `ideas: [{text|title/...}, ...]` (objects, unchanged)

A bare string becomes `%{"text" => string}`; objects pass through (text resolved
server-side from text/title/spark/thesis). Neither `ideas` nor `texts` is
required individually — provide one. The documented request shape and the
consumer now agree.

Docs (all in-PR): OpenAPI novelty request_body + description document both
`texts` and `ideas` shapes + meta.prior_count + novelty_score semantics + the
default `proposal` prior corpus; MCP knowledge_novelty tool accepts/forwards
`texts`, its schema lists both (neither required); mcp-server README + CHANGELOG
(2.21.1) updated.

ACs re-validated (#152 novelty): texts:[string] → 200 scored; ideas:[string] →
200; ideas:[{text}] → 200 (unchanged); meta.prior_count + novelty_score present
and documented. Tests added for the texts/strings shapes. Full suite green
(2527), precommit + MCP 45/45 clean.
…t README parity

Team review (engineer/BA) on PR #171 — verdict APPROVE, contract fully reconciled.
Two findings fixed:

- Engineer LOW: `ideas: []` shadowed a valid `texts` list (an empty list is truthy
  in Elixir, so `params["ideas"] || params["texts"]` short-circuited on `[]`).
  Extracted `resolve_ideas_param/1` which prefers whichever of `ideas`/`texts` is a
  NON-empty list, so `ideas: [], texts: [...]` now uses `texts`. Added a test.
  (Also keeps `normalize_ideas` under the credo cyclomatic-complexity cap.)
- BA F1: the root README knowledge-tools table `knowledge_novelty` row now documents
  the accepted request shapes (`texts:[string]` / `ideas:[string|object]`) and
  `meta.prior_count`, matching mcp-server/README + the OpenAPI spec.

BA F2 (CREATIVITY.md) is an EXTERNAL consumer spec, not in this repo — the in-repo
docstrings now match its `texts:[string]` shape, which is the reconciliation #169
asked for.

Full suite green (2528), precommit + MCP JS clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verify follow-up (#152): novelty request shape deviates from AC (ideas:[{text}] vs texts:[string])

1 participant