Text chat 55: fluxer-proto and fluxer-api entrance-sound library endpoints (#384) #401
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "textchat-55-proto-api-entrance-library"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this builds
fluxer-proto (
models/soundboard.rs,limits.rs,lib.rs):EntranceSoundUploadRequest { name, audio }(bare base64, nodata:prefix;Debugprints only the length),EntranceSoundRenameRequest { name },EntranceSoundSelectionRequest { scope_id, sound_id }(Noneis written asnull, noskip_serializing_if).EntranceSoundScope::{Global, Guilds, Dms, Guild(Snowflake)}withid(),parse(),fallbacks()(asEntranceSoundScopes.ts:65-74) andfor_voice().ENTRANCE_SOUND_MAX_PER_USER8,ENTRANCE_SOUND_MAX_BYTES1 MiB,ENTRANCE_SOUND_{MIN,MAX}_DURATION100 ms / 5.2 s,ENTRANCE_SOUND_NAME_MAX_CHARS32,SOUNDBOARD_SOUND_{MIN,MAX}_DURATION100 ms / 30 s;limits::FEATURE_VOICE_ENTRANCE_SOUNDSwithdefault_limitSome(0.0).fluxer-api (
voice.rs):upload_entrance_sound(POST, 201, not shown to the--recordobserver),rename_entrance_sound(PATCH),delete_entrance_sound(204),set_entrance_sound_selection(PUT, 204).How it was tested
entrance_upload_request_shape,selection_request_clear_serialises_null_sound_id,scope_ids_round_trip,scope_parse_rejects_unknown_and_empty_guild,scope_fallbacks_match_the_original,for_voice_without_guild_is_dms,entrance_limits_match_the_server_constants(tests/soundboard.rs),spec_contract_entrance_requests(tests/spec_contract.rs, againstspec/openapi.json: properties, required keys, nullablesound_id, scope-id pattern).upload_entrance_sound_posts_base64_and_parses_201,rename_entrance_sound_patches_name,delete_entrance_sound_expects_204,set_selection_puts_scope_and_null,quota_reached_is_a_validation_error_with_its_code, plusentrance_upload_is_not_shown_to_the_observer.fixtures/rest/entrance_sound_created.json(serializeSound,EntranceSoundController.ts:22-34) andfixtures/errors/entrance_sound_quota_reached.json(InputValidationError.fromCodeas written byErrorHandlers.ts:118-143).FLUXER_SCREENSHOT_TESTS=1 cargo xtask cipasses locally (Linux).Deviations from the plan
ApiErrorhas no such variant, and the server nests these codes inside a 400INVALID_FORM_BODY(errors[].code). SoApiError::classify(crates/fluxer-api/src/error.rs, same crate but outside the Files list) now returnsApiError::Http { status: 400, code: Some(<entrance code>), message: <entry message> }, but only for the four entrance-sound codes. Every other validation error keepsINVALID_FORM_BODY, so the login mapping in core does not change.fixtures/rest/entrance_sound_created.json, a newfixtures/errors/directory (an error body is not a proto model, andfixtures/restmust round-trip through models), andcrates/fluxer-proto/tests/models_roundtrip.rs(covers the new REST fixture).--recordobserver).Closes #384
🤖 Generated with Claude Code
Request shapes from fluxer_api/src/api/user/entrance_sound/EntranceSoundController.ts:72-96 and packages/schema/src/domains/user/EntranceSoundSchemas.ts; scopes from fluxer_app/src/features/notification/utils/EntranceSoundScopes.ts:65-74; limits from packages/constants/src/{EntranceSoundConstants,SoundboardConstants}.ts. Refs #384 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>Independent review: Text chat 55 (proto + api entrance-sound library)
Reviewed
6113a8e..origin/textchat-55-proto-api-entrance-library(c0c6a65) cold, against the plan's Task 55, Global Constraints and the fork sources.Tests named by the plan: all 13 are there (
entrance_upload_request_shape,selection_request_clear_serialises_null_sound_id,scope_ids_round_trip,scope_parse_rejects_unknown_and_empty_guild,scope_fallbacks_match_the_original,for_voice_without_guild_is_dms,entrance_limits_match_the_server_constants,spec_contract_entrance_requests,upload_entrance_sound_posts_base64_and_parses_201,rename_entrance_sound_patches_name,delete_entrance_sound_expects_204,set_selection_puts_scope_and_null,quota_reached_is_a_validation_error_with_its_code), and the values match the spec. Constants matchEntranceSoundConstants.tsandSoundboardConstants.ts. Fallbacks matchEntranceSoundScopes.ts:65-74. The status codes (201/200/204/204) matchEntranceSoundController.ts. There is also an extra observer test.Interfaces: every name and signature in the proto and api Interfaces block exists as written.
sound_idhas noskip_serializing_if, soNonegoes out asnull.default_limit(FEATURE_VOICE_ENTRANCE_SOUNDS) == Some(0.0).Deviation (error.rs): I accept it.
ApiErrorhas no validation variant. The server'sInputValidationError.fromCodereally does go out as a 400INVALID_FORM_BODYwitherrors[{path,message,code}](ErrorHandlers.ts:118-143). Promoting the nested code is limited to the 4ENTRANCE_SOUND_*codes, and only when the top-level code isINVALID_FORM_BODY. The captcha and IP branches are unaffected and every other validation error keeps its code, so the login mapping is unchanged.Invariants: the upload goes through
unobserved(), so the audio never reaches--record(the test proves it).EntranceSoundUploadRequest'sDebugprints only the length. There are no new dependencies (base64 was already a fluxer-api dependency), no core/ui/emoji changes and no secrets. The fixtures followserializeSound(EntranceSoundController.ts:22-34) and the localizedInputValidationErrorbody, and the commit messages cite the server lines they come from.Findings
fixtures/errors/entrance_sound_quota_reached.json: the entrymessage("You can save at most 8 entrance sounds.") is not the server's text.ErrorI18nMessages.ts:758resolves it to "You've reached the limit of 8 saved entrance sounds." The shape is right; only the text is invented. Suggest copying the real string, and the test's assertion with it.fixtures/rest/entrance_sound_created.json:hashhas 32 hex chars, but the server storesmd5(...).slice(0, 16)(EntranceSoundService.ts), which is 16. The existingentrance_sounds.jsonhas the same issue. It has no effect on parsing.EntranceSoundScope::parseaccepts whatSnowflake::from_straccepts. That may be laxer than the server's^guild:\d{1,20}$(for example a leading+, if the decimal parser allows it).id()always writes a valid id, so nothing invalid reaches the server.Claude Opus 5.5attribution, while the repo CLAUDE.md says Fable 5.2. This is consistent with the rest oftextchatand is an orchestrator question, not one for this task.CI:
cargo xtask ciin the review worktree passed (all steps; screenshot and livekit steps skipped locally).Verdict: APPROVED. No blocking findings.