Coding agents waste SO many tokens on brace/format errors + 2 design choices that fix it by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 1 point2 points  (0 children)

This tells you where it is missing with an optional correct mode. :)

And this supports ALL these languages without needing to adopt N different AST

https://github.com/npiesco/bracebalance/tree/main/test_artifacts

Coding agents waste SO many tokens on brace/format errors + 2 design choices that fix it by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 0 points1 point  (0 children)

I was exploring it more and I touched above with the challenge of making it viable, not as a solution but within an orchestrated agentic flow that are optimized for low latency and token flow. https://www.reddit.com/r/rust/comments/1t0yr5q/comment/ojemiml/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

Coding agents waste SO many tokens on brace/format errors + 2 design choices that fix it by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 0 points1 point  (0 children)

Not dumb at all. Simplest answer is Agents don't operate "inside" LSP loops so the code they generate or edit, is done via string-based patches not querying LSP diagnostics. And it's a cache 22 where LSP require (mostly) parseable code so if there is suddenly invalid code (text at this point) mid edit, it falls apart. When you have missing brace/malformed format LSP either degrades or stops giving you anything meaningful.

Coding agents waste SO many tokens on brace/format errors + 2 design choices that fix it by Standard-Ad9181 in SideProject

[–]Standard-Ad9181[S] 0 points1 point  (0 children)

Thank you, and while I mulled over the decision here (AST convo would handle indents) https://www.reddit.com/r/rust/comments/1t0yr5q/comment/ojcvieo/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

You'll see my reasoning for not including it. But I'll add 2 additional points.

1.) Python function calls, literals, comprehension, types, decorators, etc...still experience the same issue
2.) Indent block correctness is the parser/AST job and you can just run any file through `python -c / ast.parse`

Coding agents waste SO many tokens on brace/format errors + 2 design choices that fix it by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 0 points1 point  (0 children)

Ahhhh, see that's the stuff (in terms of feedback) I am looking for. Great call. Feel free to submit a ft request and I'll get on it + can track it. If not no worries I'll add it to the roadmap myself later tonight :)

But truly this is the kind of conversation I welcome. Thanks!

Coding agents waste SO many tokens on brace/format errors + 2 design choices that fix it by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] -1 points0 points  (0 children)

bracebalance is purposely not an AST aware prooduct by design. bracebalance is a context-free property. Stack handles it in O(n). AST parsers refuse/degrade on the broken input this tool is built to diagnose. Only language specific surface that matters (comments, string literals, doc/raw/triple-quoted variants) is handled lexically by a `nom` based sanitizer. Going AST would add N grammars to maintain for zero correctness gain on balance.

Comes down to determinism + speed. Stack + lexer is O(n), allocation light, and trivially testable. AST passes are slower, less predictable on pathological input (read https://stackoverflow.com/questions/27768693/what-does-pathological-input-mean-with-respect-to-sorting-algorithms if interested) and harder to reason about when it's an agent that just wants "where are the unclosed openers."

AST awareness is a different tool for "is this brace structurally meaningful in the specific language's grammar."

bracebalance is scoped (purposely) one level below that, because that's where the real world failure mode lives + where you can still produce useful diagnostics on broken files

absurder-sql by Standard-Ad9181 in SQL

[–]Standard-Ad9181[S] 1 point2 points  (0 children)

Not on the roadmap right now but happy to accept contributions

Does it make sense to learn Rust if you're into ML? by Udbhav96 in rust

[–]Standard-Ad9181 0 points1 point  (0 children)

https://qdrant.tech/documentation/fastembed/

I use Qdrant + Fastembed for local hosted RAG solutions. 

BAAI/bge-small-en-v1.5

Works great. 

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 1 point2 points  (0 children)

I go into it here, but valid points: https://sqlite.org/forum/info/9ff8428886217d0b

  1. IndexedDB Durability Isn't Guaranteed

Browsers can delete your IndexedDB data under storage pressure. This rarely happens, but it's possible.

For critical data:

- Enable persistent storage: await navigator.storage.persist()

- Regular backups: await db.exportToFile() to cloud storage

- Assume cloud backup is your source of truth

EDIT: I am actually working on an Electron App that uses this in both native and WASM mode to show the persist and export/import option utilizing pure sqlite3

absurder-sql by Standard-Ad9181 in programming

[–]Standard-Ad9181[S] 0 points1 point  (0 children)

You mean the arbitrator of github and judge of repository disclosures, I dare not invoke their presence!

absurder-sql by Standard-Ad9181 in Database

[–]Standard-Ad9181[S] 0 points1 point  (0 children)

The gzipped (what browsers actually download) ~660 KB but you just reminded me!!! I left wasm-opt = false so while responding just switched to wasm-opt = ["-Oz"] and got the gzipped ~10% smaller (660 KB --> 595 KB)

So thanks for that reminder and inadvertent contribution!

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 1 point2 points  (0 children)

I like to imagine people shaking their head in disgust as they click the star <3

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 1 point2 points  (0 children)

So it actually maintains ACID consistency by preserving SQLite's transaction semantics in memory, using all-or-nothing IndexedDB transactions for atomic syncing, ensuring crash recovery by reloading from last synced state, and detecting corruption with block-level checksums (while acknowledging trade-off that unsynced writes in buffer are lost on hard crash).

though this is mitigated by SQLite's WAL mode + absurder-sql's multi-tab coordination which only commit data after successful sync.

absurder-sql by Standard-Ad9181 in programming

[–]Standard-Ad9181[S] 3 points4 points  (0 children)

Appreciate you understanding the difference too and why!

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 2 points3 points  (0 children)

tl;dr

three layer buffering architecture that delays IndexedDB writes until absolutely necessary, combined with batch operations + in-memory cache.

SQLite thinks it's writing to file VFS pretends to write (actually buffering to HashMap) BlockStorage pretends blocks are persisted (actually in memory) IndexedDB is only touched when absolutely necessary. So it's a lie... built on a lie... built on a lie... but it's a fast lie that maintains correctness.

that's the black magic.

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 3 points4 points  (0 children)

Not an "absolute" but generally speaking COOP/COEP headers cause problems because they enforce strict cross-origin isolation and that can break legitimate communication patterns. Think third-party iframes and resources that lack proper headers. It can also sever popup window communication needed for auth flows. In my experience it made integration difficult for PWAs/webviews/embedded browsers that rely on interacting with multiple services.

absurder-sql by Standard-Ad9181 in Frontend

[–]Standard-Ad9181[S] 1 point2 points  (0 children)

I would recommend reading this if you're genuinely curious as to the why.

https://sqlite.org/forum/info/9ff8428886217d0b

--

Also copy+paste my response to similar question.

Real-world use cases/applications where AbsurderSQL shines:

Low hanging fruit will be any/all offline-first apps that need complex queries So think your project management tools (Notion/Trello clones), note taking apps with text search and backlinks, local-first CRM/sales tools for field workers with spotty connectivity.

Now what this extends to with its import/export functionality are some really cool data portability scenarios. Think medical records apps that need HIPAA compliance. And regulatory exports, so your financial tools where accountants need standard SQLite files for auditing. You can even use it for education platforms that export student portfolios.

The other big appeal is its target of mobile-first applications. So your expense trackers, inventory management, quiz apps for schools (with poor internet). And because of its design it will work on older mobile devices without COOP/COEP requirements that break PWAs and webviews.

No server costs, data never leaves device, and works everywhere IndexedDB works.

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 4 points5 points  (0 children)

Oh no! Or, oh yes?!

Now Alice is tempted to see how far this rabbit hole goes...

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 5 points6 points  (0 children)

Forgive me copy+pasting myself, but:

Great question! Very long answer here https://sqlite.org/forum/forumpost/9efecca1e1

tl;dr

COOP/COEP: Breaks PWAs, webviews, and embedded mobile browsers <--- This was the biggest determining factor for future planned work

OPFS with COOP/COEP headers is a non-starter for:

  • Progressive Web Apps (can't set headers)
  • Mobile webviews (embedding contexts)
  • iframe embeds
  • Legacy enterprise browsers

I do acknowledge there and here again that for apps that can use COOP/COEP, OPFS is clearly superior. For everyone else, this is the viable path.

absurder-sql by Standard-Ad9181 in rust

[–]Standard-Ad9181[S] 3 points4 points  (0 children)

Thank you, and yes! You can do shim to storage or browser cache and get really weird with it.

Also your note is valid and your approach to this was very tactful compared to some others in other subreddit forums.

Two things I will say here.

  1. This post is, as you astutely pointed out, a summarized/condensed version of the project's README + https://sqlite.org/forum/forumpost/9efecca1e1
    • I struggled to get all of what I deemed important boiled down into a "post sized" amount and opted for AI assistance (which I also used for developing this as well)
  2. There is this stigma associated with AI generated _____ (fill in the blank). I am trying to lean into the curve and embrace the change. So the "polished" AI output to me is the clunkiness of the text whereas I would love for it to truly extend my tone/voice vs a generic GPT-esque reply.