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

[Bug]: Pythogora constantly tries to create new files (not always) with "changes" instead of correcting files it created before. #916

Open
phalexo opened this issue May 8, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@phalexo
Copy link

phalexo commented May 8, 2024

Version

Command-line (Python) version

Operating System

Ubuntu Linux

What happened?

Instead of incrementally improving the files that have already been created, it starts creating new files (often in new directories) while abandoning the old files, instead of correcting them.

Is there any way to overcome this bizarre behavior?

@phalexo phalexo added the bug Something isn't working label May 8, 2024
@techjeylabs
Copy link

hey there, does this happend during troubleshoot or debugging ?

@techjeylabs techjeylabs changed the title Pythogora constantly tries to create new files (not always) with "changes" instead of correcting files it created before. [Bug]: Pythogora constantly tries to create new files (not always) with "changes" instead of correcting files it created before. May 9, 2024
@phalexo
Copy link
Author

phalexo commented May 9, 2024

hey there, does this happend during troubleshoot or debugging ?

Not sure what the difference is between "troubleshoot" versus debugging. It certainly happens often when it "asks" me if everything is working and whether I want to change anything. So I describe the problem, and what I want I want to be done. Below is an example of output. I have no idea why it created the app.js when there is already server.js It already has folder "models" but then it creates "src/models" and puts junk there, etc....

I have initialized the mongodb string like 30 times, and from time to time, it just decides to overwrite it, for no reason at all.

Sometimes it creates database.js, and sometimes it creates db.js in a different folder.

It should INIT the folder structure with npm init (if node is used) and stick with it. The folder structure should be self-consistent.

Dev step 202

const mongoose = require('mongoose');

// INPUT_REQUIRED {MongoDB connection string}
const connectionString = 'mongodb://localhost:27017/mydatabase';

mongoose.connect(connectionString, {
useNewUrlParser: true,
useUnifiedTopology: true
});

const db = mongoose.connection;

db.on('error', (err) => {
console.error('Error connecting to MongoDB:', err.message, err.stack);
});

db.once('open', () => {
console.log('Connected to MongoDB');
});


Sending code for review...

{
"hunks": [
{"number": 1, "reason": "The hunk accurately delivers the intended functionality of connecting to MongoDB and handling errors.", "decision": "apply"}
],
"review_notes": ""
}

Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/.env
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/.env.example
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/package.json
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/server.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/routes/userRoute.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/routes/authRoutes.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/routes/index.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/routes/middleware/authMiddleware.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/views/login.ejs
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/views/index.ejs
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/views/register.ejs
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/views/partials/_header.ejs
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/views/partials/_head.ejs
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/views/partials/_footer.ejs
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/src/app.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/src/index.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/models/User.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/public/js/main.js
Saving file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/public/css/style.css

Dev step 203

{"hunks": [{"number": 1, "reason": "The hunk accurately delivers the intended functionality of connecting to MongoDB and handling errors.", "decision": "apply"}], "review_notes": ""}

Applying entire change
Review finished. Continuing...
Updated file /home/developer/PROJECTS/gpt-pilot/workspace/MenAtWork/src/models/db.js

Input required on line 3:
// INPUT_REQUIRED {MongoDB connection string}

? Please open the file ./src/models/db.js on the line 3 and add the required input. Please, also remove "// INPUT_REQUIRED" comment and once you're done, press "continue".

@phalexo
Copy link
Author

phalexo commented May 9, 2024

You see how here it realizes that it created a bunch of unnecessary files, with duplicated code?

Dev step 206

After reviewing the task implementation, I found some issues that need to be addressed:

1. In `views/index.ejs`, the register and login tabs are still present, but they should be removed according to the colleague's input (point 2).
2. The `public/forms/registration.js` and `public/forms/login.js` files were created during this task, but they are not being used anywhere in the code.
3. There is some "dead code" in `views/ login.ejs`. The `<!-- Register form fields will be added here -->` comment indicates that the register form was supposed to be implemented, but it's still empty.
4. Duplicating code: In `routes/index.js`, the `/` route renders the `/auth/login` page, which is not necessary since the login functionality should be handled by a separate route.

To fix these issues, I recommend the following changes:

1. Remove the register and login tabs from `views/index.ejs`.
2. Delete the unused files `public/forms/registration.js` and `public/forms/login.js`.
3. Implement the register form fields in `views/login.ejs` or create a separate `views/register.ejs` file to handle registration.
4. Refactor the routes to handle login and registration separately.

After these changes, the implementation should be reviewed again to ensure everything is correct.

@techjeylabs techjeylabs self-assigned this May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants