Repository navigation
Parse CTO in-process with concerto-clj's Clojure parser - #28
Merged
Merged
Conversation
Model loading no longer needs Node. store/put-model! and load-registry parse with concerto-clj's instaparse port of Accord's CTO grammar (store/default-parser -> :clojure); TRUSTBLOCKS_CTO_PARSER=cli switches back to Accord's CLI. - concerto-clj pinned at 3fd274e (was d80655f): the parser, compiled size validators, and its concerto-conformance checks. - parser_test holds the port to Accord's CLI on every model this app loads (both templates, identity.cto, snow-removal.cto, late-delivery.cta): identical metamodel from both. It fails, not skips, without the CLI. - About 100x faster: 12 models parse in ~50 ms in-process vs ~5 s spawning the CLI per file. Node remains for the differential test, the babashka half of the walkthrough, and the planned TypeScript clause runtime. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
concurrent-state-changes-are-never-lost flaked (about 1 run in 10): with eight writers on one contract a trigger can lose the optimistic race max-attempts times running and be refused as :state-conflict, which the design intends. The test's guarantee -- every execution that lands is counted, none is silently lost -- held in the failing run; its assertion that every refusal is :out-of-order was too strict. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Model loading no longer needs Node.
store/put-model!andload-registrynow parse.ctowith concerto-clj's instaparse port of Accord's grammar, in-process.TRUSTBLOCKS_CTO_PARSER=cliswitches back to Accord's CLI.3fd274e(wasd80655f). This brings the parser, compiled size validators, and its own concerto-conformance checks.store/default-parserreturns:clojureunless the environment variable sayscli.parser_testholds the port to Accord's CLI, the reference implementation, on every model this app loads: both templates,model/identity.cto,snow-removal.cto, andlate-delivery.cta's models. Both parsers must produce identical metamodel. The test fails, rather than skips, when the CLI is missing.Verification
bin/clj -M:run code-quality: 66 tests, 248 assertions, 0 failures; lint clean.nodethat always fails first on PATH andCONCERTO_CLIpointing nowhere, the 29 model-loading tests (library, certification, render, execute) pass and the fake is never called. The same run withTRUSTBLOCKS_CTO_PARSER=clifails with "concerto CLI not found", as it should.Two flakes found while verifying
Repeated full runs surfaced two intermittent problems. I tracked both down.
concurrent-state-changes-are-never-lostfailed about 1 run in 10. With eight writers on one contract, a trigger can lose the optimistic racemax-attemptstimes in a row and be refused as:state-conflict, which Read contract state as of the request's own time; refuse late state changes #19 designed for. The test's real guarantee held in the failing run: every execution that lands is counted, and none is lost. Its assertion that every refusal is:out-of-orderwas too strict, and now accepts:state-conflict.PSQLException: The connection attempt failed. In XTDB 2.1,xt/qon a node opens a new local JDBC connection per query and transaction (viawith-connto the node's own pgwire server). A burst of thousands of connections (back-to-back suites, or a stress loop) can exhaust macOS's 16,384 ephemeral ports while sockets sit in TIME_WAIT. A 150-round stress of eight concurrent triggers reproduced it at round 123. This is an environment limit, not trigger logic. It's recorded in AGENTS.md, and it's a question for production: holding or pooling a connection should be evaluated before any real load.🤖 Generated with Claude Code