fix: replace widget file FFI with simplifile - #24
Merged
Conversation
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.
Closes #14.
Summary
Moves the widget-definition file boundary (
src/glendix/define/file_boundary.gleam) off the handwritten Nodefs/JSON.parseadapter and ontosimplifile(existence checks, UTF-8 read/write) andgleam_json(a smallwidgetNamedecoder), mappingsimplifile.FileError/gleam_json.DecodeErrorinto the existing publicFileErrortaxonomy in pure Gleam.Acceptance criteria
read/write/find_widget_xmldelegate tosimplifileandgleam_json; no handwrittenfs/JSON.parseremains in this boundary.src/glendix/define/file_boundary_ffi.mjsremoved (no longer referenced).FileErrorvariants and theirpath/reasonfields are unchanged.package.json, missing/emptywidgetName, missing XML file, successful read/write, and read/write failure paths.glendix -> mendrawretains its declared Hex dependency source form.Behavior preservation & edge cases
widgetName->WidgetNameWasNotDeclared.src/<widgetName>.xml->WidgetXmlWasNotFound.FileCouldNotBeRead/FileCouldNotBeWritten.reasontext is now package-derived and deterministic (viasimplifile.describe_errorand a stablegleam_json.DecodeErrordescription) instead of raw Nodeerror.message.FileCouldNotBeReadwith a deterministic reason.widgetName->WidgetNameWasNotDeclared, matching the original adapter's observable behavior while also removing a latent uncaughtTypeErrorthe old adapter threw for a top-levelnulldocument.Verification
Validated after rebasing onto
mainat5071385:gleam format --check src test,gleam check,gleam build --warnings-as-errors,gleam docs buildgleam test --runtime bun— 51 tests passed./scripts/check-all.sh— style, boundaries, 313 FFI export contracts, and generated-source diff passed./scripts/family.sh widget-build— valid MPK produced./scripts/family.sh lustre-e2e— browser smoke check passed./scripts/test-all.shwas also attempted after the rebase. Dependency-mode and Codex tests plus the glendam, glendix, and mendraw standalone consumers passed; the final fresh mxpak consumer resolution was blocked by the shared Hex API rate limit. Direct package/browser suites and the end-to-end routes passed independently.