Skip to content

test: clear remaining Codacy args_os finding on OS-restart smoke - #62

Merged
rmems merged 1 commit into
mainfrom
cursor/codacy-proc-self-exe-85e9
Sep 18, 2026
Merged

rmems merged 1 commit into
mainfrom
cursor/codacy-proc-self-exe-85e9

Conversation

@rmems

@rmems rmems commented Sep 18, 2026

Copy link
Copy Markdown
Member

User description

Follow-up after #61 was squash-merged as 3b777f8 while Codacy still had a high finding on that head. Does not cargo publish, tag, or create a GitHub Release. Cargo.toml stays at 0.3.0.

Codacy findings (from GitHub check annotations)

#61 comment had no inline finding text. Source of truth was check-run annotations.

Commit Annotation Verdict
bae6ff8 medium Method thalamic_os_process_restart_does_not_leak_safety has 62 lines of code (limit is 50) Already fixed on 4cd90b6 / in #61. Test body is split into helpers.
bae6ff8 high current_exe should not be used for security operations Same Semgrep rule. #61 swapped to args_os.
4cd90b6 (merged) high args_os should not be used for security operations at tests/thalamic_brainstem_smoke.rs:423 Still valid on main. Codacy Semgrep flags both APIs.

Change

Linux corpus-ipc OS-restart child re-exec now uses std::fs::read_link("/proc/self/exe") instead of current_exe / args_os. This test only runs on the Ubuntu corpus-ipc job.

Related: #61 (merged).

Open in Web Open in Cursor 

Summary by cubic

Fixes the Codacy high finding on the OS-restart smoke test by resolving the test binary via /proc/self/exe instead of args_os or current_exe.

  • This test only runs on the Ubuntu corpus-ipc job, so the /proc dependency is safe.
  • Does not bump the Cargo.toml version or create a release.

Written for commit 66877ea. Summary will update on new commits.

Review in cubic


CodeAnt-AI Description

Run the Linux OS-restart smoke test using the actual test executable

What Changed

  • The OS-restart smoke test now locates and launches its child process through Linux’s executable path
  • The test continues to verify that safety state is not inherited by the restarted process

Impact

✅ Reliable Linux process-restart testing
✅ Preserved safety-state isolation
✅ Fewer security-scanner findings

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Codacy Semgrep flags both current_exe and args_os as "should not be used
for security operations". The corpus-ipc smoke is Linux-only, so resolve
the test binary through /proc/self/exe instead.

Co-authored-by: Raul Cardenas Montoya <montoyaraul34@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR addresses a Codacy security finding by replacing args_os with /proc/self/exe for test process re-execution. However, the implementation introduces a cross-platform compatibility issue that will cause test failures on non-Linux systems.

Critical Issue:

  • /proc/self/exe only exists on Linux and will panic on macOS/Windows

Required Fix:
Add platform-specific conditional compilation to prevent runtime panics on non-Linux platforms.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Comment thread tests/thalamic_brainstem_smoke.rs
@deepsource-io

deepsource-io Bot commented Sep 18, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 3b777f8...66877ea on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Rust Sep 18, 2026 12:43a.m. Review ↗
Secrets Sep 18, 2026 12:43a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@rmems
rmems marked this pull request as ready for review September 18, 2026 00:47
@codeant-ai

codeant-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 66877ea Sep 18, 2026 · 00:47 00:48

@codeant-ai

codeant-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@rmems
rmems merged commit cdfb75f into main Sep 18, 2026
12 checks passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T00:49:18.877718Z 66877ea Draft marked ready
🔒 Security Review Completed 2026-09-18T00:49:00.365216Z 66877ea Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@linear-code

linear-code Bot commented Sep 18, 2026

Copy link
Copy Markdown

LIM-1370

@codeant-ai codeant-ai Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Sep 18, 2026
@codeant-ai

codeant-ai Bot commented Sep 18, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. /proc/self/exe does not exist on non-Linux hosts or Linux environments without procfs, so this integration test panics instead of running.

Possible bug · tests/thalamic_brainstem_smoke.rs:425

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

Copy link
Copy Markdown

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: 66877ea971

ℹ️ 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".

Command::new(argv0)
// Linux `/proc/self/exe` (CI corpus-ipc job). Avoid `current_exe` / `args_os`,
// which Codacy Semgrep flags as "should not be used for security operations".
let exe = std::fs::read_link("/proc/self/exe").expect("read /proc/self/exe");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the OS-restart smoke portable outside Linux

When a developer enables corpus-ipc on macOS or Windows as supported by docs/ci.md:26-31, this test target still runs, but /proc/self/exe does not exist and the unconditional expect panics before spawning the child. The previous executable lookup was portable, so use a platform-specific fallback or gate this test to Linux rather than breaking the feature-enabled test suite on those systems.

Useful? React with 👍 / 👎.

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

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants