[STU-148] Fix production bug on customcode.connectio.com.au - #61
Open
sgardoll wants to merge 6 commits into
Open
[STU-148] Fix production bug on customcode.connectio.com.au#61sgardoll wants to merge 6 commits into
sgardoll wants to merge 6 commits into
Conversation
sgardoll
force-pushed
the
sgardoll/stu-148-bug-caught-on-customcodeconnectiocomau
branch
from
August 22, 2026 06:35
d8375d5 to
fc03cab
Compare
Owner
Author
|
@greptile review |
1 similar comment
Owner
Author
|
@greptile review |
sgardoll
force-pushed
the
sgardoll/stu-148-bug-caught-on-customcodeconnectiocomau
branch
from
August 23, 2026 02:20
fc03cab to
340c520
Compare
Owner
Author
Owner
Author
|
@greptile review |
1 similar comment
Owner
Author
|
@greptile review |
sgardoll
force-pushed
the
sgardoll/stu-148-bug-caught-on-customcodeconnectiocomau
branch
from
August 23, 2026 06:41
340c520 to
e884207
Compare
Owner
Author
|
@greptile review |
1 similar comment
Owner
Author
|
@greptile review |
sgardoll
force-pushed
the
sgardoll/stu-148-bug-caught-on-customcodeconnectiocomau
branch
from
August 24, 2026 07:21
e884207 to
f8a8e46
Compare
Owner
Author
|
@greptile review |
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.
Issue
https://linear.app/stuart-gardoll/issue/STU-148/bug-caught-on-customcodeconnectiocomau
STU-148's description is a screen recording only (Linear video upload — not accessible to this session). STU-147's Jam recording (https://jam.dev/c/8f62b047-f929-4646-b1dc-8d3993bda618) was viewable, but it documents the failures PR #60 already fixed. With no viewable recording for STU-148 itself, the single-file generation + commit pipeline was audited end-to-end instead — with an important discovery:
Production is already running the STU-147 fix. The deployed bundle (
dist/assets/index-CKpVTGFk.js) contains PR #60's sanitizer strings, i.e. the site was FTP-deployed from the unmerged PR branch. So STU-148's recording almost certainly captures a defect in that deployed sanitizer — and two concrete, reproducible defects were confirmed in exactly that code.Defects found and fixed
1. Sanitizer keeps prose between fenced blocks → "not formattable" (reproduced)
sanitizeGeneratedDartkept everything between the first and last fence line, only stripping the fence lines themselves. A multi-block LLM response like:committed with the prose lines intact → FlutterFlow's dart_style rejects the push with "Custom widget code is not formattable" — the exact STU-147 symptom recurring. Reproduced before the fix; the sanitized output contained the prose verbatim.
Fix: fence lines are now paired sequentially (open/close); only content inside completed pairs survives, so outer prose, inter-block prose, and fence lines are all removed. Content after an unclosed trailing fence (truncated response) is dropped — committing cut-off Dart fails formatting anyway.
2. Raw strings falsely rejected by the pre-commit formatter gate (reproduced)
The bracket scanner treated
\as an escape inside raw strings. For valid Dart likeRegExp(r'\')(a raw string holding one backslash), it skipped the closing quote, mis-scanned everything after, and blocked the commit with a bogus mismatch error (line 7: "}" closes nothing...). A false positive in a blocking pre-commit gate makes the commit impossible.Fix: the scanner detects raw string prefixes (
r/R, not part of a longer identifier) and, inside them, honors backslashes as literal characters and disables${...}interpolation detection — matching Dart semantics.3.
createZipFromFileMapswallowed errors and returned ""A JSZip failure produced an empty string that was pushed to FlutterFlow as the zip payload — a local packaging bug surfaced as an opaque server rejection. It now propagates; every caller already runs inside a try/catch that shows the real cause in the failure modal.
4. Successful push reported as failure on malformed response value
parsePushCodeResponsecalledJSON.parse(jsonResult.value)unguarded on the success path. A non-string or malformedvaluethrew after HTTP OK, so a push that did land was shown as a commit failure (inviting a duplicate re-push). It now degrades to "no warnings" and logs.5. Double-commit race in the confirm flow
confirmCommitToFlutterFlowclearedpendingCommitDataonly after the awaited commit finished. A second confirm click landing mid-commit read the same data and pushed twice concurrently. The pending data is now nulled synchronously before any await.Overlap with STU-147 (PR #60)
PR #60 is open and unmerged, but its sanitizer is what production runs. This branch is cut from
origin/mainper instructions, and carries forward #60's sanitizer + its app.js wiring (import,prepareCodeForCommitsanitization + canonical widget naming, pre-commit formatter/naming gates,fileNamethreading,identifierToFlutterFlowFileStemexport) with defect fixes 1–2 applied. Intentionally not carried: #60'slistProjectsendpoint/auth-error changes (independent of the sanitizer; they remain #60's alone).Merge guidance: whichever PR merges second will conflict in
app.js(sanitizer hunks) andsrc/flutterFlowCodeSanitizer.js— for the sanitizer file, take this branch's version (superset: #60's behavior + STU-148 fixes). The two PRs should be reconciled rather than both merged blind.Tests
src/flutterFlowCodeSanitizer.test.js(26 tests): all of [STU-147] Single-file generation: fix project list 403 + widget commit failures #60's coverage, the multi-block test strengthened to assert prose removal, plus STU-148 regressions — inter-block prose dropped, truncated trailing block dropped, raw string ending in backslash accepted, raw triple-quoted strings,${literal in raw strings, uppercaseRprefix, non-raw escape behavior preserved.npm test: 232/232 pass (206 baseline on main + 26 new, no regressions)node --checkclean on app.js and all touched filesnpm run buildsucceeds (rebuilt dist committed per repo convention)Caveats
Fixes STU-148
Greptile Summary
This PR strengthens generated-Dart preparation and the single-file FlutterFlow commit flow, primarily to address production failures associated with STU-148.
Confidence Score: 4/5
The PR is not yet safe to merge because malformed Dart with an unmatched bracket followed by an EOF line comment can still pass the pre-commit gate.
The scanner checks only its top frame at EOF; when that frame is a line comment it returns no error even if an unmatched bracket frame remains beneath it, allowing malformed code to reach FlutterFlow.
Files Needing Attention: src/flutterFlowCodeSanitizer.js
Important Files Changed
Reviews (5): Last reviewed commit: "STU-148: harden generation/commit pipeli..." | Re-trigger Greptile
Context used: