Repository navigation
fix(topics): harden stream safety trim config and lookup failures - #4075
Conversation
- Pass OPENC3_STREAM_MAX_AGE_SECONDS to the operator in compose.yaml since setting it in .env had no effect - Skip the cap when the TargetModel log cycle lookup fails and retry every LOG_CYCLE_LOOKUP_RETRY_SECONDS instead of caching the default - Raise max ages below STREAM_MAX_AGE_MIN_SECONDS (120s) to the floor so a small value can't wipe a stream on writer clock offset - Raise in write_topic when both maxlen and minid are given - Define LogWriter.CLEANUP_DELAY from Topic.LOG_CLEANUP_DELAY_SECONDS Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/stream-safety-trim #4075 +/- ##
===========================================================
+ Coverage 80.26% 80.28% +0.01%
===========================================================
Files 901 901
Lines 68776 68801 +25
Branches 2665 2714 +49
===========================================================
+ Hits 55204 55235 +31
+ Misses 12906 12894 -12
- Partials 666 672 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|



Follow-up to #3951, addressing review findings. Targets
feat/stream-safety-trim.What
compose.yamlpasses env vars to each service by name, andOPENC3_STREAM_MAX_AGE_SECONDSwasn't listed, so setting it in.envdid nothing. It's now in the operator's pass-through list. All writers of these streams (interface and decom microservices) run under the operator. Enterprise/k8s pod specs need the same change.TargetModel.getthrew on the first packet (e.g. a Redis blip), the 600 s default cycle was cached for the life of the process. A target withTLM_LOG_CYCLE_TIME 3600would then be capped at 1320 s instead of 7320 s. Now that stream isn't capped until a lookup succeeds. The lookup is retried everyLOG_CYCLE_LOOKUP_RETRY_SECONDS(60 s), with one warning per try.STREAM_MAX_AGE_MIN_SECONDS, twice TSDB's 60 s retention). Testing against Valkey 9.1.2 showed that a MINID ahead of the stream's ids deletes the whole stream, including the entry being added. For*ids the cutoff comes from the writer's clock, not Redis's, so a tiny value (e.g.0.5) plus a small clock offset could wipeDECOMCMD__. The docs and code comments now cover the minimum and the need for NTP.write_topicraises (RubyArgumentError, PythonValueError) if given bothmaxlenandminid, instead of silently droppingmaxlen.LogWriter.CLEANUP_DELAYis now defined fromTopic.LOG_CLEANUP_DELAY_SECONDS, so there's only one value. Both LogWriters already import Topic.2 × (cycle + 60).Testing
write_topicrejectingmaxlen+minid.bundle exec rspec spec/topics spec/logs: 126 passed.spec/microservices spec/utilities/store* spec/api: 524 passed.uv run pytest test/topics test/logs test/microservices: 215 passed.ruff checkis clean.🤖 Generated with Claude Code
Summary by CodeRabbit
OPENC3_STREAM_MAX_AGE_SECONDSsetting from the host environment or.env.