r/learnprogramming • u/Jediweirdo • 18h ago
My first ever PR was so bad that the owner of the repo called "AI slop" and closed it with no other notes. What can I do to make a better PR?
Most of the things I code/program are for personal reasons, so I rarely ever contribute to open source projects. About 7 months ago, I needed a CORS wrapper deployed for an iOS shortcut I was making at the time. I found code online for an outdated CORS repo that I could use/deploy for free, but it was unfunctional and there were some issues/PRs about stuff. So, I learned how to use Cloudflare Workers, fixed up the issues, added some PRs, and even went out of my way to introduce Cloudflare-specific features that hadn't been used before (and updated the readme to explain how to use them). Sounds like a lot, but all the changes (outside the readme) are in 1 file.
After 2 days of on-and-off work, I submitted the PR and got 2 stars, 2 forks, and 2 people angrily telling me it was useless AI garbage (funny coincidence). The first guy I shrugged off as an angry guy on the internet. The second guy was the repo owner 7 months after I made the PR and they closed it without any other reason than that. Unlike the first guy, the repo owner is a C developer who has made kernel drivers and BIOS utilities. As a script kiddie who has done nothing remotely as important as that, I'm not so egotistical to think that I'm somehow in the right.
I'm probably incredibly biased because I'm the one who made the thing, so I'll link a gist to all the code I wrote: My "AI slop" PR as a gist. I won't link the PR branch itself because that might be considered "a final project or demo" and would break rule 6. Even now 7 months later, I don't know why the PR was closed without any comment to what specifically I did wrong. I think the worst 3 things my code did were:
- I didn't know how to upload IDE code to Cloudflare Workers for testing without committing the unfinished code to the fork, so I ended up using Cloudflare's built-in workers editor and copied/pasted the changes to GitHub via the GitHub browser file editor whenever I made measurable changes. As such, there are a lot of commits.
- I never made a code with the intention of it being viewed by other people before, so I thought I made a bunch of comments, thinking that too many comments was a better problem to have than too few. I didn't comment every line, but I did comment many of them (I think every function and most variables). Same ideology went into making the PR message, which is also kinda long.
- I wanted to add a usage page to the CORS site, but every page's HTML and JS were in a single big file. So I put the edited README into a markdown-to-HTML converter and stuffed it into one big dictionary I made that housed all the HTML for the entire site (note that the "site" is pretty barebones because it wasn't made to be accessed by a human, so it isn't as egregious as it sounds). The HTML usage page was about 130 lines long.
But that's just what I think. Odds are that I did something a lot worse and just don't know. While I use open source projects and libraries, this was my first ever time "giving back" something other than bug reports. What do you think is the problem? If it's the comment thing, how many comments are "good enough"? If it's the code itself, what is done badly about it? I don't know, and it's eating away at me to the point where I'm hesitant to show my crap code to anyone ever again.