Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Remove file validation and add sample scripts #778

Merged
merged 6 commits into from
Oct 15, 2024
Merged

Conversation

pelikhan
Copy link
Member

This pull request removes the file validation logic that was previously responsible for checking file outputs against specified schemas and patterns. In its place, several sample scripts have been added to demonstrate functionality and provide a clearer structure for future development. The changes aim to simplify the codebase and enhance usability by focusing on practical examples.

@@ -367,8 +367,7 @@ export async function runScript(
if (isJSONLFilename(outData)) await appendJSONL(outData, result.frames)
else await writeText(outData, JSON.stringify(result.frames, null, 2))

if (result.status === "success" && result.fileEdits && applyEdits)
await writeFileEdits(result.fileEdits, { trace })
await writeFileEdits(result.fileEdits, { applyEdits, trace })

Choose a reason for hiding this comment

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

The result.fileEdits and applyEdits are not checked before calling writeFileEdits. This could lead to unexpected behavior if result.fileEdits is undefined or applyEdits is false.

generated by pr-review-commit missing_check

// Iterate over each file edit entry
for (const fileEdit of Object.entries(fileEdits || {})) {
// Destructure the filename, before content, after content, and validation from the entry
const [fn, { before, after, validation }] = fileEdit

if (!applyEdits && !validation?.valid) {

Choose a reason for hiding this comment

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

The condition !applyEdits && !validation?.valid will never be true because if applyEdits is false, the function will not be called due to the missing check in run.ts. This could lead to unexpected behavior.

generated by pr-review-commit logic_error

// TODO: implement fibonacci algorithm
return 0 // BODY
} // this one needs to go
// another comment

Choose a reason for hiding this comment

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

The function fibonacci is not implemented and will always return 0. This could lead to incorrect results.

generated by pr-review-commit unimplemented_code

@pelikhan pelikhan merged commit 978ede6 into main Oct 15, 2024
6 of 10 checks passed
@pelikhan pelikhan deleted the filesedval branch October 15, 2024 18:37
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