Software engineer writing about systems, security, and the code behind them.
I write about backend architecture and the practical decisions behind shipping production systems — authentication and security patterns in NestJS, AI model integration, and lately Solana-based fintech infrastructure. More to come. Mostly notes from things I've actually built and broken, not theory for its own sake.
Markdown supported · ⌘↵ to post
Mihai_LeanZero
The extractJSONFromMarkdown fence-stripping caught my eye. It only strips when the string starts with the literal "
json", but you say right above it that the model wraps its answer in a fence about half the time regardless of what you ask for. If it ever emits a barefence without the json tag, that startsWith check misses it, JSON.parse chokes on the leading backticks, and I don't see a try/catch anywhere around that call, so it looks like that would throw straight through, right on the authenticated persist path where you actually need the data to land. A regex like /^```(?:json)?\n?/ instead of the literal startsWith would catch both cases without adding much code.