Skip to content

[TENT] Reject malformed numeric metrics environment overrides - #3228

Merged
alogfans merged 1 commit into
kvcache-ai:mainfrom
Hubert-Zhu:hzhu/fix-tent-metrics-numeric-config
Aug 3, 2026
Merged

[TENT] Reject malformed numeric metrics environment overrides#3228
alogfans merged 1 commit into
kvcache-ai:mainfrom
Hubert-Zhu:hzhu/fix-tent-metrics-numeric-config

Conversation

@Hubert-Zhu

@Hubert-Zhu Hubert-Zhu commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Intro

Hi team, I couldn’t find a clearly scoped issue that seemed suitable for a first contribution, so I used AI to help inspect the codebase and identify this potential issue. I’m also hoping to use this opportunity to become familiar with the project’s contribution workflow.

Please let me know if anything here is incorrect or could be improved. If there are other directions you would recommend, I’d be very happy to explore them.

Description

TENT numeric metrics environment overrides currently accept partial parses such as 8080junk, 2x, and 30s because std::stoi is used without checking whether the complete input was consumed. This can silently turn malformed configuration into a valid but unintended value.

This change:

  • requires integer and port parsers to consume the complete input;
  • preserves the configured default for partially parsed values;
  • adds parser-level and environment-loader regression coverage.

No matching open issue or pull request was found.

Module

  • Transfer Engine (mooncake-transfer-engine)
  • Mooncake Store (mooncake-store)
  • Mooncake EP (mooncake-ep)
  • Mooncake PG (mooncake-pg)
  • Integration (mooncake-integration)
  • P2P Store (mooncake-p2p-store)
  • Python Wheel (mooncake-wheel)
  • Common (mooncake-common)
  • Mooncake RL (mooncake-rl)
  • CI/CD
  • Docs
  • Other

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Breaking change
  • Documentation update
  • Performance improvement
  • Other

How Has This Been Tested?

Test commands:

pre-commit run --files mooncake-transfer-engine/tent/src/common/config.cpp mooncake-transfer-engine/tent/tests/metrics_config_loader_test.cpp

The production config sources were also compiled on macOS with Apple Clang using -Wall -Wextra -Werror, then exercised with partially parsed port, thread-count, and report-interval inputs.

Test results:

  • Unit tests pass
  • Integration tests pass (not applicable)
  • Manual testing done as described above

The repository TENT unit target requires the Linux dependency stack and was not run locally.

Checklist

  • I have performed a self-review of my own code
  • I have formatted my code using ./scripts/code_format.sh
  • I have run pre-commit run --all-files and all hooks pass
  • I have updated the documentation (not applicable for this bug fix)
  • I have added tests to prove my changes are effective
  • For changes >500 LOC: I have filed an RFC issue (not applicable)

AI Assistance Disclosure

  • No AI tools were used
  • AI tools were used (specified below)

OpenAI Codex helped identify the parsing edge cases, implement the focused fix, and add regression tests. The human submitter has reviewed the scope and is responsible for understanding and defending every changed line.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@alogfans alogfans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alogfans
alogfans merged commit 4a413a8 into kvcache-ai:main Aug 3, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants