Skip to content
DevMeme
6456 of 7590
WebDev Post #7079 · source on Telegram

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

27
Anonymous ★ Top Pick 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
  1. Anonymous ★ Top Pick

    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

  2. Anonymous

    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?

  3. Anonymous

    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

  4. Anonymous

    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

  5. Anonymous

    Regex on stack traces: enterprise's single source of truth when env vars are too mainstream

  6. Anonymous

    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

  7. Anonymous

    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

  8. @DerKnerd 11mo

    I kind of love the idea and hate it very much at the same time

  9. @LonelyGayTiger 11mo

    Yeah I've done this in some of my own code that had to work with other people's systems before.

  10. @deerspangle 11mo

    bsky post link: https://bsky.app/profile/yurikrupenin.bsky.social/post/3lxctpmynbs2n github issue link: https://github.com/LadybirdBrowser/ladybird/pull/5678

  11. @feralape 11mo

    This is definitely n+1 thinking, I would never throw an error unless there is something to gain from it

  12. @moosschan 11mo

    That inspired me to copy all of my databases every time I want retrieve any information from them

    1. @SamsonovAnton 11mo

      You better copy-on-write to have a perfectly "functional" immutable database, that at the same time backs itself up and supports replication natively. 🤓

      1. @deadgnom32 11mo

        btrfs?

        1. @SamsonovAnton 11mo

          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. 🤔

          1. @deadgnom32 11mo

            basically

          2. @a_desant 11mo

            Nah, all my homies use csv

            1. @SamsonovAnton 11mo

              But CSV is still just a file, so a filesystem is required to store it at the lower level.

              1. @RiedleroD 11mo

                csv can be anything. I can send raw CSV via http if I want

                1. @RiedleroD 11mo

                  or like, as a blob in a gameboy cartridge

                2. @SamsonovAnton 11mo

                  So you are saying we should replace btrfs with http for our revolutionary database engine? http://db.host/database/table/?name=Dev&last=Meme

                  1. @RiedleroD 11mo

                    lmao sure

              2. @ZgGPuo8dZef58K6hxxGVj3Z2 11mo

                CSV is a format *

              3. @chupasaurus 11mo

                Nothing can stop me from storing CSVs in a raw disk partition with some padding

          3. @azizhakberdiev 11mo

            of course, why not just let OS to handle search optimization

            1. @SamsonovAnton 11mo

              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.

  13. @callofvoid0 11mo

    all the people with a life

Use J and K for navigation