Repository navigation
Document log list date filters, ordering, and history window; fix Voice Logs MOS and include_deleted - #989
Document log list date filters, ordering, and history window; fix Voice Logs MOS and include_deleted#989Devon-White wants to merge 1 commit into
Conversation
- Share one LogListQuery model (date filters + paging) across the voice, message, fax, video, and conference log lists, with format, bound, and UTC semantics from the shared Rails contract and scopes. - State newest-first order, filter-carrying links, and the one-year history window on each list. - Remove include_deleted from voice and message logs, which ignore it. - MOS: a leg that received no audio packets also scores 4.5. - Payment history: newest-first order, filter bounds, page_size max, and a links example for /api/space/payment_history.
|
Close to ready. I checked the date filters, ordering, history window, paging, PR descriptionThe description has a lot of internal material in it: source file paths and line numbers, class and method names, internal repo names, and commit hashes from private repos. Most of it sits in "Source anchors" and "Notes for reviewers". This repo is public, so please edit the description to keep the conclusions and drop the references. "The source orders results newest first" and "voice and message logs ignore Technical1. MOS: the 4.5 sentence contradicts the null wording.
Make the same change in 2. Everything else checked out against source:
Style3. Split the history-window sentence.
4. Link the error code. Optional. 5. Nit. The code comments at lines 10 and 50 of Other
|
Closes #927
Closes #960
What changed
Log list filters (#960). The voice, message, fax, video, and conference log lists all use the same Rails contract for dates and paging, so they now share one TypeSpec model,
LogListQuery(specs/signalwire-rest/_globally_shared/log-list-query.tsp), in place of five drifting copies. The parameter descriptions now state:YYYY-MM-DD, an ISO 8601 timestamp (withZ, an offset, or neither, which means UTC), or Unix time in seconds.created_afteris at or after the time andcreated_beforeis at or before it. A date means midnight UTC at the start of that day, socreated_after=Dincludes day D andcreated_before=Dleaves it out.created_oncovers one UTC day. A timestamp selects the whole UTC day that contains it.page_sizedefaults to 50 with a maximum of 1000. Thepage_numberandpage_tokendescriptions are unified.A shared
logListBehavioralias adds the same paragraph to all five list operations: results are newest first,links.nextcarries the filters, and history is limited to one year (see below).Voice Logs (#927).
include_deletedis removed from voice and message logs because both ignore it. Fax, video, and conference logs honour it, so they keep it on their own request models (spread over the shared model). Its default is nowfalseon all three; conference logs had no default before.List payment history (#960).
page_sizenow says "default50, maximum1000". This applies to the sharedSpacePaginationQuery, which members and member projects also use, and all of them use the same pagination contract.linksexample that points to/api/space/payment_history(with a carriedcreated_after) instead of/api/space/members.created_afteris inclusive andcreated_beforeis exclusive here, which differs from the log lists.Source anchors (prime-rails
origin/HEAD4c7f31a2b6 unless noted)Float, elseTime.zone.iso8601(date-only → midnight)app/services/common/parse_datetime.rb,app/concepts/shared/contracts/validate_date_or_timestamp.rbconfig.time_zoneunset;APIController/API::REST::BaseController/API::Space::BaseControllerneveruse_zoneconfig/application.rb:45,app/controllers/api_controller.rbapp/concepts/api/rest/{voice,messaging,fax,video}/log/contracts/index.rb,.../logs/conference/contracts/index.rbcreated_aftergteq,created_beforelteq,created_onbeginning_of_day..end_of_dayapp/models/{voice_segment,message_segment,fax_segment,video_segment,conference_segment}.rbscopescursor_order_only: true→reorder(cursor: :desc);cursoris the auto-increment set on creationapp/services/common/cursor_pagination.rblinks.nextcarries filters:sanitized_paramsincludesallowed_query_params; links mergecurrent_paramsapp/concepts/shared/contracts/cursor_pagination.rb,app/serializers/api/rest/shared/pagination_meta.rbpage_sizemax 1000 (all users of the shared contract, payment history and members included)app/concepts/shared/contracts/cursor_pagination.rbcreated_after(HistoryLogs::DateRange.run)on every list; earlier filter values →exceeds_history_logs_limitapp/services/history_logs/date_range.rb(1.year.ago.beginning_of_day),app/validators/timestamp_within_accessible_history_range_validator.rb, eachoperations/index.rbinclude_deletedignored by voice and messaging (scope.kept # unless contract.parsed_include_deleted); honoured by fax, video, conferenceapp/concepts/api/rest/voice/log/operations/index.rb:21,.../messaging/log/operations/index.rbvs the other threeorder(created_at: :desc),date_gte(date..),date_lt(...date), path-helper linksapp/concepts/api/space/payment_history/operations/index.rb,app/models/balance_adjustment.rb:85-86,app/serializers/api/space/payment_history_serializer.rbR = 100, recomputed only whenrecved > 0;mos = 1 + 0.035R + …→ 4.5 at R=100master2d6e498src/switch_rtp.cdo_mos(:1252-1292)Notes for reviewers
include_deleted, one-year history limit #927 claim 2 (RTT "in steps of 10") is not changed, because it is correct. FreeSWITCH writesrtp_audio_rtt_*in seconds with%0.2f(signalwire/stacksrc/switch_core_media.cadd_stat_double, :2009, used at :2092-2095). mod_laml multiplies that by 1000 (mod_laml.c:4790-4802, mod_laml 57c1bb1), so the values come in 10 ms steps. The issue's source only covers the ×1000 step, not the formatting before it.created_before=Texcluded a log created at exactly T. The scopes uselteq, so the docs follow the source and say "at or before". A likely cause: Rails serializescreated_atwith millisecond precision by default, while the stored value keeps sub-millisecond digits. Acreated_atcopied from a response is therefore usually a little earlier than the stored value, whichlteqthen excludes. That explanation is inferred and not tested. Payment history really is exclusive (...date), and its docs say so.include_deletedwas in the spec: it came with the 2026-01-09 migration from the old docs repo (e9f5fa3f0a), and the 2026-02-10 Voice API audit (d72f3b2543) added its= falsedefault. No comment explains it. The Rails contracts still listinclude_deletedinallowed_query_paramsand validate it as a boolean, which is probably where it came from. Only the voice and messaging operations comment out its use. The visible prime-rails history starts at a squashed commit (2157da1adf), so it doesn't show when that was commented out.master. I didn't confirm the deployed image's stack pin, butdo_mosandadd_stat_doubleare long-standing upstream FreeSWITCH code.ParseDatetimetriesFloat()first. A side effect: an 8-digit basic-format date such as20261101is read as epoch seconds and fails the history check. The basic format isn't documented, so this text doesn't promise it.linksexample is a property-level@exampleon a$refproperty, the sameallOf+examplespattern used about 500 times in this OpenAPI file. Please confirm the rendered response example on the preview.PaginationLinksexamples (/api/video/rooms?page=2) and the fax/message 422 examples that link to/docs/rest/overview/error-codes/.yarn build:specsandyarn fern-md-checkpass.yarn fern-checkfails only on "Missing redirects check skipped: could not reach FDR (403)", which is environmental.Preview pages:
/docs/apis/rest/voice-logs/list-voice-logs,/docs/apis/rest/message-logs/list-message-logs,/docs/apis/rest/fax-logs/list-fax-logs,/docs/apis/rest/video-logs/list-logs,/docs/apis/rest/conference-logs/list-conferences, List payment history, and/docs/compatibility-api/cxml/reference/voice(MOS line).