feat(agent-interface): accept write-in answers on select fields via allowCustom#20
Merged
Merged
Conversation
…llowCustom A select question with an "Other…" option could not accept the user's own text: validateInteractionAnswer rejected any value outside the declared options, so downstream UIs substituting typed text got a hard failure. - select fields gain an optional allowCustom flag - validateInteractionAnswer skips the option-membership check for such fields but stays fail-closed on shape: write-ins must be non-blank strings, and multi/required rules still apply - questionAnswerSpec propagates allowCustom from LegacyQuestion
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.
Problem
A select question with an "Other…" option cannot accept the user's custom text:
validateInteractionAnswerrejects any select value outside the declared options, so consumers that substitute the user's typed text as the answer value get a hard validation failure (surfaced as 400INVALID_INTERACTION_ANSWERin agent-dev-container's sidecar).Solution
allowCustomflag.validateInteractionAnswerskips the option-membership check for fields withallowCustom: true, but stays fail-closed on shape: write-ins must be non-blank strings, and the existingmulti/requiredrules still apply.questionAnswerSpecpropagatesallowCustomfromLegacyQuestion.allowCustom, so adapters whose native question tool supports custom answers can declare it.Additive/optional — no behavior change for existing specs. Changeset: minor bump of
@tangle-network/agent-interface.Tests
New
src/interaction.test.ts: schema round-trip, write-in accept/reject matrix (declared options, write-in with/without flag, blank write-in, multi + required rules),questionAnswerSpecpropagation. Full workspace green:pnpm build && pnpm check-types && pnpm test(458 tests).Context
Prerequisite for tangle-network/agent-dev-container#3048 (adapter stream-fidelity conformance suite; the "no write-in answers" finding). agent-dev-container will bump its pinned
^0.13.0once this publishes.