Fix #169: novelty accepts the AC request shape (texts:[string] / ideas:[string])#171
Merged
Conversation
…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.
This was referenced Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #169.
POST /api/v1/knowledge/noveltyworked but only acceptedideas: [{text}], deviating from the #152 AC /CREATIVITY.mdcontract (texts: [string]). The documented shapes (texts:[...],ideas:["string"]) returned400 "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:
texts: ["...", ...]— the Creativity support: distant pairs, novelty scoring, random walks (for idea-synthesizer) #152 AC shape (strings)ideas: ["...", ...]— bare stringsideas: [{text|title/spark/thesis,...}, ...]— objects (unchanged)A bare string becomes
%{"text" => string}; objects pass through. Neitherideasnortextsis required individually — provide one. The documented request shape and the idea-synthesizer consumer now agree.Docs (all in-PR)
noveltyrequest_body+ description document bothtextsandideasshapes,meta.prior_count,novelty_scoresemantics, and the defaultproposalprior corpus.knowledge_noveltytool accepts/forwardstexts; schema lists bothtextsandideas(neitherrequired). 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, defaulttag:proposal) present and documented.Tests added for the
texts/strings shapes. Full suite green (2527),mix precommit+ MCP 45/45 clean.