Conversation
The server and client configs now parse through hconf and save by reconciliation: user comments, blank lines, layout and line endings survive every programmatic write, new options materialize with their documentation via ensure, and a corrupt file fails the save loudly instead of being overwritten. Historical Gson-written JSON parses unchanged, and the state documents stay on Gson. hconf ships as a zero-dependency jar shadowed into the loader (amp_libs relocation); the Gson-tree bridge lives in HconfConfigs with @comment field declarations driving generated defaults. Validated: 539 core tests, format and build gates, and autotester installed-group-acquisition + download-only scenarios on 1.20.1-forge. (The group-acquisition restart-nudge step fails identically on unmodified main - pre-existing, unrelated to this change.)
The format is deliberately not HOCON, so .conf would mislead users and editors; .hconf is self-identifying and gives our own grammar a clean home. Reads fall back to the legacy .json when the .hconf does not exist yet, and the first automatic save migrates: a fresh documented file is generated with the old values carried over, and the .json is removed only after the new one is written. The autotester seeds legacy .json configs on purpose now - every scenario exercises the fallback and the migration - and reads live configs through a minimal hconf reader. Spec status line updated to recommend .hconf. Validated: 10/10 HconfConfigs tests, 539/539 core tests, format and build gates, and the installed-group-acquisition + download-only scenarios pass on 1.20.1-forge with the migrated config in place.
The library's comment declarations moved out of the tree into a Comments value carried beside it, so fresh generation passes the banner and the per-field comments to canonical form directly. The jar now comes from the tree-based editor rewrite; behavior and public surface are otherwise the same for this bridge.
Pulls in the tombstone-scope, move-classification, and BOM fixes from the differential fuzzing pass on the concrete-syntax-tree architecture.
The vendored jar picks up the hconf queue closure: reconcile is insert-only over user array content, the migration verbs fail before a partial application, and tombstone scope excludes nested blocks. The javadoc on readState now states the split the code already had: machine-written rebuildable state may set a torn file aside (a torn repair journal must never block a boot), while user-owned configs take the strict read path that fails with a position and never regenerates.
Reconcile is insert-only, and this save path's model is read from the very file being saved - so an element missing from the model is a deliberate removal (a normalized-away rule, a pin removed in the UI), and leaving it standing resurrected it on the next read. The save now sets array members from the model after reconciling; object members still recurse and user formatting outside arrays stands.
The vendored jar picks up the consolidation: one removal rule, one literal classifier, one key spelling, one escape table, move dispatched from its case table. No API change; the hconf suite and soaks are byte-identical before and after.
Skidamek
force-pushed
the
hconf-configs
branch
from
September 20, 2026 22:04
6f2bd60 to
7950dce
Compare
hconf is our library, not a third-party dependency: it now ships under its own package in the loader and merged jars, the same handling the mcholepunch jars get. The amp_libs relocation applied only to it and nothing referenced the relocated names.
Skidamek
force-pushed
the
hconf-configs
branch
from
September 20, 2026 22:49
c89efc3 to
700acd2
Compare
The library now follows the standard module naming and versions like the mcholepunch jars. Imports in HconfConfigs follow the rename; hconf.Path stays fully qualified because of the java.nio.file.Path import.
Skidamek
force-pushed
the
hconf-configs
branch
from
September 20, 2026 22:59
700acd2 to
fbac246
Compare
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 server and client configs move from JSON to hconf, a small configuration format written for this mod, with an editor that changes config files in place instead of regenerating them. If you run a server or play with the mod, you do not need to do anything: your current config keeps working, and the mod moves it to the new format on the first save.
What was wrong with JSON
The old save path serialized the whole config object back to disk on every save:
Users learned not to touch their own config. That is backwards for the one file they are supposed to edit.
The format
Keys and values usually need no quotes.
#starts a comment, to the end of the line. Braces nest, one entry per line. A JSON file with an object at the top is already a valid hconf file, so existing JSON configs parse as they are.The parser is strict. A typo fails with the line, the column and the reason:
What a save does now
The mod parses the current file, applies its changes to the document, and writes the result. Bytes outside a changed value are untouched:
Comments, key order, layout and line endings (LF, CRLF, CR) survive every save. Unknown keys and hand-added entries survive. One rule to know: deleting a documented key's line brings it back with its default value on the next boot. To disable a setting permanently, comment the line out instead; it stays off, and uncommenting it turns it back on.
Files
server-config.jsonbecomesserver-config.hconf, andclient-config.jsonbecomesclient-config.hconf. Reads fall back to the old.jsonname, and the first save writes the.hconffile and removes the old one. If you have scripts or volume mounts that point at the old filenames, point them at the new ones. A corrupt config is never regenerated: the mod fails loudly, names the line and column, and expects a human to fix or remove the file.For developers
@Commentget that comment on fresh generation and are materialized into old files that lack them. Other fields never reappear on their own.libs/. It has its own parser, writer and edit operations.Testing
HconfConfigsTest: fresh generation, legacy JSON reads, byte-preserving saves, idempotence, corrupt-file failures, tombstones staying out, migration on first save, rule removal.download-onlyon 1.21.11-fabric andinstalled-group-acquisitionon 1.20.1-forge pass.