Split the README, and fix two demos that crashed instead of explaining themselves - #49
Open
sqlparser wants to merge 1 commit into
Open
Split the README, and fix two demos that crashed instead of explaining themselves#49sqlparser wants to merge 1 commit into
sqlparser wants to merge 1 commit into
Conversation
…g themselves
The README had grown to 877 lines, and roughly half of it was archaeology:
detailed post-mortems of bugs fixed over the preceding three days. That history
is worth keeping -- several of those mistakes are easy to make again -- but it
sat between a new user and the information they needed.
README.md 877 -> 403 lines, ordered for someone who has
just cloned: what it is, quick start, the demos,
tests, the parser dependency, layout, the
standalone jar, the .bat route, CI, contributing.
docs/maintenance-notes.md 499 lines. All the history, moved rather than
deleted, under a contents list and a before/after
table, opening with the lesson every entry shares.
Nothing was dropped. Distinctive facts from the original were diffed against
both files afterwards.
Fixed while documenting them
----------------------------
Three dead links: the Tutorials section pointed all three entries at
commonTest/testModifySql.java, which left in 683f67b when the library-side test
tree went back to gsp_java_core. Replaced with a table of seven demos that do
exist here, showing what a parse tree is actually for -- the thing an evaluator
most wants to see, and the old README never showed it.
`scriptwriter` went straight to sqlstatements.get(0) without checking what
parse() returned. Its built-in query is a deliberately hard ~49 KB Oracle
statement, and the trial parser refuses input over 10,000 bytes, so the parse
failed, the list was empty, and the demo died with
IndexOutOfBoundsException: Index 0 out of bounds for length 0
which names neither the cause nor the fix. It now checks the return code,
prints the parser's own error, says so when the input is over the limit, and
takes an optional <file.sql> so it can demonstrate something with the trial
jar. The README's claim that the trial build is "enough for every demo here"
was wrong and is corrected.
`events/ProcessSQLStatement` had a hardcoded absolute path into one developer's
Downloads folder, so it could not run anywhere else. The file was missing,
parse() failed, and the error branch then called
getErrormessage().substring(0, 1000) on a shorter message -- throwing
StringIndexOutOfBoundsException from the code meant to report the error. It now
takes the file as an argument and bounds the substring.
Both passed CI. run-all-demos.sh matched only linkage failures
(NoClassDefFoundError and friends), so a demo could crash on its own logic and
still be reported as started. It now also fails any demo that throws
"Exception in thread \"main\"" when run with no arguments: with nothing to work
on, a demo should print a usage line, not a stack trace. That check is what
found ProcessSQLStatement. All 77 pass it.
Verified: mvn clean package green, 144 tests pass with nothing skipped,
run-all-demos.sh 77/77, run-demo-cases.sh 22/22, smoke-dlineage-jar.sh green,
every command the new README documents actually run, and every relative link
and anchor in both files resolved programmatically.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012qPRpoD8exYRrUmbfXXWXj
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.
The README had grown to 877 lines, and roughly half was archaeology — detailed post-mortems of bugs fixed over the preceding three days. That history is worth keeping; several of those mistakes are easy to make again. But it sat between a new user and the information they needed.
README.mddocs/maintenance-notes.mdThe new README runs: what it is → quick start → the demos → rewriting SQL → tests → the parser dependency → project layout → standalone jar →
.batroute → CI → contributing.The maintenance notes open with a before/after table and the lesson every entry shares (anything CI does not run is load-bearing only by luck), then a contents list covering the package rename, the test-tree return,
lib/→lib-repo/, thepom_dlineagesaga, the Dependabot sweep, and the rest.Nothing was dropped. I diffed distinctive facts from the original against both files afterwards —
57% of every source file,263 of 273,Cp1252, Nashorn,sun.misc.Unsafe, all of it.Fixed while documenting them
Three dead links. The Tutorials section pointed all three entries at
commonTest/testModifySql.java, which left in683f67bwhen the library-side test tree went back togsp_java_core. Replaced with a table of seven demos that do exist here, showing what a parse tree is actually for — the thing an evaluator most wants to see, and the old README never showed it.scriptwritercrashed on startup. It went straight tosqlstatements.get(0)without checking whatparse()returned. Its built-in query is a deliberately hard ~49 KB Oracle statement, and the trial parser refuses input over 10,000 bytes — so the parse failed, the list was empty, and the demo died with:which names neither the cause (a licensing limit) nor the fix. It now checks the return code, prints the parser's own error, says so explicitly when the input is over the limit, and takes an optional
<file.sql>so it can demonstrate something with the trial jar:This also means the README's claim that the trial build is "fully functional for evaluation and enough for every demo here" was wrong. Corrected, with the limit documented.
events/ProcessSQLStatementcould never run. Its input was:A hardcoded absolute path into one developer's Downloads folder. The file was missing,
parse()failed, and the error branch then calledgetErrormessage().substring(0, 1000)unconditionally on a shorter message — throwingStringIndexOutOfBoundsExceptionfrom the code whose job was to report the error. It now takes the file as an argument, prints a usage line without one, and bounds the substring.The CI gap that let both through
run-all-demos.shmatched only linkage failures (NoClassDefFoundErrorand friends), so a demo could crash on its own logic and still be reported as started. It now also fails any demo that throwsException in thread "main"when run with no arguments — with nothing to work on, a demo should print a usage line, not a stack trace.That check is what found
ProcessSQLStatement; I only went looking afterscriptwriter. All 77 demos pass it.Worth recording, and it's in the notes: my first survey of this reported "0 of 77 throw" and was wrong — it used a relative
-cp target/classesfrom another working directory, so every demo failed to load and matched no pattern.run-all-demos.shbuilds an absolute classpath for exactly this reason.Verification
mvn clean packagerun-all-demos.shrun-demo-cases.shsmoke-dlineage-jar.sh🤖 Generated with Claude Code
https://claude.ai/code/session_012qPRpoD8exYRrUmbfXXWXj