Skip to content

refactor(review): update prompts and logic to handle file statuses in…#1

Merged
JStaRFilms merged 5 commits into
mainfrom
diff-chech-logic
Dec 14, 2025
Merged

refactor(review): update prompts and logic to handle file statuses in…#1
JStaRFilms merged 5 commits into
mainfrom
diff-chech-logic

Conversation

@JStaRFilms
Copy link
Copy Markdown
Owner

…cluding deletions

Enhance review process to distinguish between modified and deleted files, preventing false positives on bugs in removed code while flagging dangerous deletions.

…cluding deletions

Enhance review process to distinguish between modified and deleted files,
preventing false positives on bugs in removed code while flagging dangerous deletions.
@github-actions
Copy link
Copy Markdown

🟢 J Star Code Audit

Score Verdict 🚨 Critical 🔶 High 🔹 Medium 🔧 Nitpick
93/100 APPROVE - - - -

✨ No issues found. Ship it!


Powered by J Star Sentinel ⚡

@github-actions
Copy link
Copy Markdown

🟢 J Star Code Audit

Score Verdict 🚨 Critical 🔶 High 🔹 Medium 🔧 Nitpick
89/100 COMMENT - 1 1 -

📄 src/prompts.ts

Warning

Missing fix_prompt field in prompt template
The prompt template defines rules requiring a fix_prompt for CRITICAL/HIGH/MEDIUM findings but never includes the field in the JSON schema.

🛠️ Recommended Fixes

  • Missing fix_prompt field in prompt template: Add fix_prompt:string to the JSON schema inside the prompt and regenerate the instructions to match the required output format.

📄 src/orchestrator.ts

🔹 Reaction logic assumes verdict presence

Category: LOGIC

The final reaction is based on review.summary.verdict without checking if summary exists, risking runtime errors.

🛠️ Recommended Fixes

  • Reaction logic assumes verdict presence: Add a null check: const finalReaction = review?.summary?.verdict === 'REQUEST_CHANGES' ? 'confused' : 'rocket';

Powered by J Star Sentinel ⚡

…n fix_prompt type

- Prevent potential errors when review or summary is undefined
- Update JSON schema to allow null values for fix_prompt
@github-actions
Copy link
Copy Markdown

🟢 J Star Code Audit

Score Verdict 🚨 Critical 🔶 High 🔹 Medium 🔧 Nitpick
93/100 APPROVE - - - -

✨ No issues found. Ship it!


Powered by J Star Sentinel ⚡

@github-actions
Copy link
Copy Markdown

🟢 J Star Code Audit

Score Verdict 🚨 Critical 🔶 High 🔹 Medium 🔧 Nitpick
89/100 COMMENT - - 2 1

📄 src/orchestrator.ts

🔹 Missing explicit return type on PrFile interface

Category: MAINTAINABILITY

Interface PrFile lacks an explicit return type, violating the TypeScript strict rule.

🔹 Reaction fallback may double-react on PR

Category: LOGIC

When ctx.commentId is absent the code reacts to the PR issue; later it may add a second reaction based on verdict, leading to two reactions on the same PR.

🛠️ Recommended Fixes

  • Missing explicit return type on PrFile interface: Add the return type 'PrFile' to the interface declaration.
  • Reaction fallback may double-react on PR: Track if a reaction was already added to the PR issue and skip the final reaction if so, or consolidate into a single reaction call.

📄 src/test-local.ts

🔧 Mock file list includes fake [removed] entry

Category: STYLE

The mock entry 'src/deprecated.ts [removed]' is synthetic and could mislead tests.

🛠️ Recommended Fixes

  • Mock file list includes fake [removed] entry: Remove the fake [removed] entry or add a comment clarifying it is synthetic test data.

Powered by J Star Sentinel ⚡

@github-actions
Copy link
Copy Markdown

🟢 J Star Code Audit

Score Verdict 🚨 Critical 🔶 High 🔹 Medium 🔧 Nitpick
95/100 APPROVE - 1 2 -

📄 src/orchestrator.ts

Warning

Unsafe cast of unknown to string
The fetchPRDiff function casts response.data directly to string without runtime validation, risking undefined or malformed diffs.

🔹 Swallowed GitHub reaction errors

Category: MAINTAINABILITY

The catch block logs a generic message and discards the actual error, hiding transient GitHub API issues from operators.

🛠️ Recommended Fixes

  • Unsafe cast of unknown to string: Replace the unsafe cast with a runtime check: ensure response.data is a string; throw or return empty string otherwise.
  • Swallowed GitHub reaction errors: Log the full error object in the catch block: console.error('⚠️ Could not react:', e).

📄 src/test-local.ts

🔹 Test file pretends deprecated.ts was removed

Category: DOCUMENTATION

The mock diff claims deprecated.ts is deleted but the file list still includes it, causing reviewer confusion.

🛠️ Recommended Fixes

  • Test file pretends deprecated.ts was removed: Remove 'src/deprecated.ts [removed]' from MOCK_FILES or add it to the mock diff with proper deletion markers.

Powered by J Star Sentinel ⚡

Improve type safety by checking if response data is a string before returning,
and enhance error logging in reaction function. Also update test comment for clarity.
@github-actions
Copy link
Copy Markdown

✨ J Star Triage

Risk Level: LOW

Only changes to CI config, documentation, and test files with no impact on authentication, API, database, or security logic

No critical files detected. Skipping deep review. 🎉

@JStaRFilms JStaRFilms merged commit e73c722 into main Dec 14, 2025
2 checks passed
@JStaRFilms JStaRFilms deleted the diff-chech-logic branch December 14, 2025 10:28
@JStaRFilms JStaRFilms restored the diff-chech-logic branch December 22, 2025 23:27
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.

1 participant