fix(smart-forms): mime type, conflict detection, dup guard#79
fix(smart-forms): mime type, conflict detection, dup guard#79gh-corezoid wants to merge 1 commit into
Conversation
- defaultMimeType: add pages/<page>/style → text/css rule; the file is named "style" (no extension) but is always Less/CSS; old code returned application/json here (unfix-able by PUT) - push diff phase detects MIME-only drift and includes those files in modifiedFilePaths so a PUT self-heals the wrong Content-Type without a delete/recreate cycle - Phase 3 PUT re-derives mimeType from path instead of the stale manifest value; updates manifest.MimeType accordingly - Before creating new files, fetch the live server tree and block the push if a file already occupies that (folder,title) slot — mirrors the UI one-style-file-per-page constraint and surfaces the orphan in the error with guidance to re-pull - pullSmartForm conflict detection: if any local file's hash differs from last-pulled manifest hash, pull aborts listing conflicts; pass force=true to discard local edits and proceed - Add force bool param to pullSmartForm tool registration - Tests: TestDefaultMimeType + TestDetectPullConflicts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI ReviewFixes MIME type misassignment for Checklist
Issues found
In the Phase 2 duplicate detection error path in "env": "develop",This is a literal string rather than the actual env title being iterated. The current codebase only allows pushing to
When This review was generated automatically. A human maintainer should still make the merge decision. |
Summary
defaultMimeTypefix:pages/<page>/stylefiles are now correctly assignedtext/csson creation. The file is always named exactlystyle(no extension) but contains Less/CSS source — the old check only recognised the top-levelstyles/tree and returnedapplication/jsonhere, which the backend cannot correct via a content-only PUT.modifiedFilePaths. Phase 3 always re-derives the type from the path instead of trusting the stale manifest value, so a wrongContent-Typeis corrected in the same PUT that updates the source — no UI delete/recreate needed.pushSmartFormfetches the live server tree and checks whether a file already occupies that(folderId, title)slot. If it does the push aborts with a clear error message (including the server file ID and MIME type) and guidance to runpullSmartFormto re-sync the manifest. This mirrors the UI's one-style-file-per-page constraint on the API create path.pullSmartFormnow loads the existing.manifest.jsonbefore overwriting and compares on-disk hashes against the last-pulled hashes. If any local file has been edited since the last pull the pull is refused with the list of conflicting paths. Passforce=trueto discard local edits and proceed.forcebool param added topullSmartFormregistration.TestDefaultMimeTypecovers all path patterns including the regression case;TestDetectPullConflictscovers no-manifest, unchanged, modified, missing, and mixed scenarios.Context
tool: pushSmartForm / pullSmartForm | version: 2.3.5 | install: 6054ea78-1ace-49ad-8e81-e64cdb7b97d6
Checklist
make build/make vetpass locallymake testpasses locally (all packages green)make discoveryrun — no changes topublic/CHANGELOG.mdchange includedTest plan
pages/<page>/stylefile; verify the server assignstext/css(notapplication/json)pushSmartFormwithout changing content; verify it issues a corrective PUT and updatesmanifest.Files[...].MimeTypepushSmartForm; verify it aborts withduplicateFilesguidance instead of creating a second filepullSmartFormagain; verify it aborts listing the conflict; verifyforce=trueproceeds and overwrites