Atlassian Login Gets Base URL by Throwing Error and Parsing Error Stack
Description
A Bluesky/Mastodon post from Yuri Krupenin (@[email protected]) boosted by 'сережа' that reads: '>>Atlassian login gets the base URL for its module scripts by throwing an error and pulling out the current script's URL from error.stack with regex.' with a link to github.com/LadybirdBrow... The reaction image below shows Matthew McConaughey from True Detective lighting a cigarette with an intense, knowing expression -- the universal reaction to discovering horrifying-yet-functional enterprise code. The 'Translate' button suggests the post may have been in a different language originally
Comments
27Comment deleted
Atlassian's code doesn't have bugs -- it has surprise features that throw errors on purpose so regex can parse the stack trace for metadata. This is what peak enterprise engineering looks like
Sure, we could pass a BASE_URL constant - but why spoil the fun when we can yeet an exception, grep the stack, and pray the minifier doesn’t change line numbers?
When you've been debugging production issues for 15 years and discover that a Fortune 500 company's authentication system works by deliberately causing exceptions to parse stack traces with regex - suddenly you understand why their Jira tickets take 30 seconds to load and why 'There is no spoon' feels less like philosophy and more like architectural documentation
When your module loader needs to know its own URL but you've already shipped to production without proper configuration, just throw an error, parse the stack trace with regex, and call it 'runtime introspection.' It's not a hack if it's in the Atlassian codebase - it's enterprise-grade self-discovery. Bonus points: this probably survived multiple architecture reviews and still works across browser updates, which is either a testament to JavaScript's stability or a warning sign that we've all collectively given up on doing things the 'right' way
Regex on stack traces: enterprise's single source of truth when env vars are too mainstream
If your loader discovers its base URL by throwing and regexing error.stack, you don’t have modules - you have a séance, with CSP, source maps, and browser updates as the ghosts
Enterprise SSO, defined: discover your base path by throwing an exception and regexing the stack - right up until Chrome tweaks the format and auth dies at 3 a.m
I kind of love the idea and hate it very much at the same time Comment deleted
Yeah I've done this in some of my own code that had to work with other people's systems before. Comment deleted
bsky post link: https://bsky.app/profile/yurikrupenin.bsky.social/post/3lxctpmynbs2n github issue link: https://github.com/LadybirdBrowser/ladybird/pull/5678 Comment deleted
This is definitely n+1 thinking, I would never throw an error unless there is something to gain from it Comment deleted
That inspired me to copy all of my databases every time I want retrieve any information from them Comment deleted
You better copy-on-write to have a perfectly "functional" immutable database, that at the same time backs itself up and supports replication natively. 🤓 Comment deleted
btrfs? Comment deleted
Store each data record as a file. Use directories for database names and table names. Use file names for field values and indexed combinations. Create hardlinks to the same file (record) for each field name and indexed combination. 🤔 Comment deleted
basically Comment deleted
Nah, all my homies use csv Comment deleted
But CSV is still just a file, so a filesystem is required to store it at the lower level. Comment deleted
csv can be anything. I can send raw CSV via http if I want Comment deleted
or like, as a blob in a gameboy cartridge Comment deleted
So you are saying we should replace btrfs with http for our revolutionary database engine? http://db.host/database/table/?name=Dev&last=Meme Comment deleted
lmao sure Comment deleted
CSV is a format * Comment deleted
Nothing can stop me from storing CSVs in a raw disk partition with some padding Comment deleted
of course, why not just let OS to handle search optimization Comment deleted
I'm a bit preoccupied about transactional mechanisms, though. We would need low-level control on filesystem driver for this, rather than rely on conventional higher-level API. Filesystem scaling capability is also of a concern, as storing millions of directory entries is not a typical scenario for general-purpose filesystems. Comment deleted
all the people with a life Comment deleted