Skip to content

feat(limits): add delete_limits_set API#3493

Open
jmthomas wants to merge 1 commit into
mainfrom
feature/delete-limits-set-3464
Open

feat(limits): add delete_limits_set API#3493
jmthomas wants to merge 1 commit into
mainfrom
feature/delete-limits-set-3464

Conversation

@jmthomas

Copy link
Copy Markdown
Member

Summary

Adds a delete_limits_set(name) API (Ruby + Python) to remove a limits set, as requested in #3464.

Cleanup performed:

  1. Removes the set key from every TLM item definition in TargetModel packets
  2. Removes the set from each item blob in <scope>__current_limits_settings
  3. hdel the set from <scope>__limits_sets
  4. Stream openc3_limits_events needs no cleanup (append-only, capped at 1000)

Guards: refuses to delete DEFAULT, the currently active set, or a non-existent set.

Design decisions (the open questions in the issue)

  • Cleans up TargetModel packet item definitions too (not just current_limits_settings) for a complete removal.
  • No new LIMITS_DELETE_SET event type. That would require new Limits#remove_set infrastructure; a deleted (non-active) set lingering in a running microservice's memory is harmless and is cleared on the next restart/resync from current_limits_settings.

Performance

  • Packet-definition cleanup writes per packet, not per item (≤ N packet hset calls).
  • current_limits_settings cleanup is batched into a single hmset/hset mapping rather than one Redis round trip per item — important since this hash can be large (e.g. 100 packets × 1000 items).

Changes

Area File
Ruby API openc3/lib/openc3/api/limits_api.rb
Ruby topic openc3/lib/openc3/topics/limits_event_topic.rb
Ruby script wrapper openc3/lib/openc3/script/limits.rb
Python API openc3/python/openc3/api/limits_api.py
Python topic openc3/python/openc3/topics/limits_event_topic.py
Python script wrapper openc3/python/openc3/script/limits.py
JS API binding openc3-js-common/src/services/openc3Api.js
Docs docs.openc3.com/docs/guides/scripting-api.md
Tests Ruby specs ×2, Python test ×1

Testing

  • Ruby: limits api/script/topic specs pass
  • Python: limits api/topic tests pass
  • ruff + eslint clean

Closes #3464

🤖 Generated with Claude Code

Add delete_limits_set(name) to remove a limits set from all telemetry
items, the limits_sets hash, and current_limits_settings. Guards against
deleting the DEFAULT and currently active sets. Batches the
current_limits_settings cleanup into a single hmset to avoid a Redis
round trip per item. Adds Ruby and Python implementations, script
disconnect wrappers, JS API binding, docs, and tests.

Closes #3464

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jmthomas jmthomas requested review from clayandgen and ryanmelt June 18, 2026 20:45
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
3 New issues

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.24%. Comparing base (f29c725) to head (1009613).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3493      +/-   ##
==========================================
- Coverage   79.25%   79.24%   -0.01%     
==========================================
  Files         689      689              
  Lines       57293    57358      +65     
  Branches      728      728              
==========================================
+ Hits        45406    45452      +46     
- Misses      11809    11828      +19     
  Partials       78       78              
Flag Coverage Δ
python 80.30% <ø> (+0.02%) ⬆️
ruby-api 80.95% <ø> (-0.38%) ⬇️
ruby-backend 83.11% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add API to delete limits set

1 participant