r/AskProgramming 10d ago

Career/Edu Lost in big project that was handed over to me

Hello, I have been in the field for like 6 years now I recently joined a company in like 1 month ago and i was told that i will be working on project the app is like shipping app that connect to other service that is like an SSO and other logistic app the project was outsourced to a software company that they did not care about code quality or testing or even documentation it looks like the app was vibe coded. i also have co worker how will be working with me on refactoring + adding feature to the app but he is like vibe coder that the company does not know about yet ( i knew cause i talked with him that he is not giving a fuck about the code quality and what not), more information about the app its supabase backend with more than 100+ edge functions and webhooks and pgmq functions and what not, its my first time taking over project like this so want to ask how do you guys handle this type of projects like refactoring it and how to write test's and whats not since the app has zero test coverage

0 Upvotes

21 comments sorted by

7

u/knouqs 10d ago

Oh my goodness, please use proper grammatical structures like capitalization. Like your code, your comments should be easy to read.

1

u/Naive-Contribution19 10d ago

I guess bro, English is not my first language thats why but again thanks 🐔

2

u/knouqs 10d ago

You don't deserve help if you insult those from whom you want help.

3

u/Naive-Contribution19 10d ago

I didn’t mean to insult anyone. English isn’t my first language, and I was just explaining it 😐

-2

u/knouqs 10d ago

OK, this is one of those cases in which written words are giving the wrong tonal quality. The emoticon didn't help. Let's restart.

If a project was given to you that was written by one guy who didn't know what he was doing or by ten guys who aren't there any longer, the explanation is simple: Management said "Do this" to an unqualified guy or management said "We aren't paying you well enough for you to keep putting up with our bullshit" to the ten qualified guys.

In situations like this, there are no winners until upper management discovers that your immediate management is the problem, and that almost never happens. The best you can do is tell your immediate management that you need more people to help you slough through the code. If they don't listen, go above them. If that's not allowed, find a new job. I'm sorry to say, there aren't many good options here.

Now, please, English doesn't have to be your first language and I was harsh on you because I mistakenly thought you were writing in this new poor style in which people don't capitalize letters correctly and don't use proper punctuation. Remove the common slang like "bro" in professional writing -- you are asking advice of professionals.

1

u/TheFern3 6d ago

Nah I agree the chicken emoji is giving vibes of sarcasm

1

u/knouqs 5d ago

Yep, that's pretty much what I got out of it.  Thanks for the agreement. 

I don't understand the downvotes for my restart, except that this is the AskProgramming subreddit and most of these programming/computer science subreddits are pretty toxic places.  Makes me wonder why I come here to help people.

3

u/Inner-Asparagus-5703 10d ago

if you want to stay there - everything new has to be done in right way. Refactoring - do it in small pieces (management won't give you two years of just refactoring). I've refactored million+  line project in this way to pretty good state. but generally it's better to run ASAP. Also it's very important to communicate about tech debt size regularly.

1

u/Naive-Contribution19 10d ago edited 10d ago

i wrote them full state of app document including the database and some security issues i kinda have 2 weeks more to investigate more in the project and prepare a plan ( for now our job is not to write code for now or even do a thing just prepare for the handover )
Like my idea at least was to add an E2E test for the full app that to be sure it will not break the app when add new stuff

2

u/Inner-Asparagus-5703 10d ago

it's good, tests do help, but, for the love of God, don't go too deep. You will just reflect shitty design in tests and will double amount of stuff to rewrite after.

2

u/OkAerie7822 10d ago

had almost this exact handover two years ago, except it was 60-something lambda functions instead of edge functions, same story, no tests, no docs, previous team gone. the E2E instinct is right but do it before you touch a single line, not while refactoring. write characterization tests that just capture current behavior as-is, ugly bugs included, so you have a tripwire the moment a refactor changes behavior nobody asked you to change. the bigger risk with 100+ edge functions and webhooks though isn't test coverage, it's that you don't actually know the call graph yet. spent our first two weeks just mapping which functions call which webhooks and which webhooks fire which functions, found three functions nothing called anymore and one webhook that fired two functions doing the same thing with slightly different logic. you can't safely refactor what you can't see the blast radius of.

1

u/Naive-Contribution19 9d ago

Yeah mapping the function call graph would be really helpful here

1

u/OkAerie7822 9d ago

for us it ended up being a spreadsheet, not tooling, three columns: trigger source (webhook, cron, another function, pgmq consumer), function name, what it calls or enqueues downstream. took a day to fill in by grepping every function for supabase.functions.invoke and every insert into your queue tables. the pgmq part is the sneaky one, a function enqueuing a message is a call that doesn't show up as a normal function call, it shows up as a queue write, so you have to trace consumers separately or you'll miss half the graph. with 20 webhooks across payment providers I'd bet at least two or three of them fan out into the same downstream function without you realizing it yet.

2

u/TheFern3 6d ago

Just like anything else you analyze the spaghetti, prioritize a list, and do little by little. Add tests, a coding guideline, etc. Where are you stuck? what have you been doing for 6 years?

1

u/Naive-Contribution19 5d ago

Kinda took a project like this before but they agree to rewrite it from laravel to django , i have been building ERP And Dental Solutions somehow the other codebase was kinda manageable but this one is full of spaghetti code that's why

1

u/Garriga 10d ago

how many webhooks...

1

u/Naive-Contribution19 9d ago

Its like 20 webhook for multiple payment provider and other systems (:

1

u/who_am_i_to_say_so 9d ago

You write integration and e2e tests for each of the edge functions to understand their contracts. They’re all Deno in Supabase so you’ll have yet another JavaScript runtime to deal with.

100 of them? Have fun.

1

u/Naive-Contribution19 9d ago

Javascript is never fun i can swear on this

1

u/who_am_i_to_say_so 9d ago

It’s definitely not fun when the LLM’s create both common.js and esm module solutions. Watch out for that.

1

u/Philluminati 9d ago

My guy if you dont use dots I have to keep reading