Skip to content

refactor: add redact for line numbers#1481

Open
peter-jerry-ye wants to merge 1 commit intomainfrom
zihang/improve-test
Open

refactor: add redact for line numbers#1481
peter-jerry-ye wants to merge 1 commit intomainfrom
zihang/improve-test

Conversation

@peter-jerry-ye
Copy link
Contributor

  • Related issues: None
  • PR kind: optimization

Summary

Previously the test was extremely unstable due to the fact that stack trace was snapshot. Whenever the core has file change, the line number gets updated, and the test result is changed.

This PR adds redaction for the line numbers.

Metadata

  • Tests added/updated for bug fixes or new features
  • Compatible with Windows/Linux/macOS

@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 13, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  crates/moonrun/tests/test.rs  71% smaller
  crates/moon/tests/test_cases/native_abort_trace/mod.rs  5% smaller
  Cargo.lock Unsupported file format
  Cargo.toml Unsupported file format
  crates/moon-test-util/Cargo.toml Unsupported file format
  crates/moon-test-util/src/lib.rs  0% smaller
  crates/moon-test-util/src/stack_trace.rs  0% smaller

@peter-jerry-ye peter-jerry-ye force-pushed the zihang/improve-test branch 6 times, most recently from 3ba5da9 to 4de72bb Compare February 13, 2026 10:29
@peter-jerry-ye peter-jerry-ye requested a review from Yu-zh February 14, 2026 02:05
@peter-jerry-ye peter-jerry-ye marked this pull request as ready for review February 14, 2026 02:05
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a6d0d15e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

.insert(
"[CORE_PATH]",
regex::Regex::new(
r"(?<redacted>(?:\$MOON_HOME|(?:[A-Za-z]:)?/[^ \t\r\n]*\.moon)/lib/core)",

Choose a reason for hiding this comment

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

P2 Badge Handle non-.moon MOON_HOME in core-path redaction

stack_trace_redactions only redacts core paths that already contain $MOON_HOME or whose absolute path has a .moon segment before /lib/core, but moonutil::moon_dir::home() allows arbitrary MOON_HOME values. In environments where MOON_HOME is set to something like /opt/moonbit, this pattern will not match, so the updated snapshots in crates/moonrun/tests/test.rs and crates/moon/tests/test_cases/native_abort_trace/mod.rs that now require [CORE_PATH] will fail with unreplaced absolute paths.

Useful? React with 👍 / 👎.

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.

2 participants