Skip to content

fix(smart-forms): pushSmartForm Windows path-separator bug when creating a new page#71

Open
yelyzavetaberest wants to merge 1 commit into
corezoid:developfrom
yelyzavetaberest:fix/smartform-push-windows-parentid
Open

fix(smart-forms): pushSmartForm Windows path-separator bug when creating a new page#71
yelyzavetaberest wants to merge 1 commit into
corezoid:developfrom
yelyzavetaberest:fix/smartform-push-windows-parentid

Conversation

@yelyzavetaberest

Copy link
Copy Markdown
Contributor

What

Fixes pushSmartForm failing on Windows when creating files inside a new subfolder — the common case being a new Smart Form page (pages/<id>/config + locale).

Root cause

In handlePushSmartForm Phase 2 (create-files), the tool mapped the server's create response back to local paths using filepath.Dir(relPath). On Windows filepath.Dir returns backslash-separated paths (pages\survey), which miss the always-slash-keyed manifest.Folders map. The lookup returned 0, the response key never matched, and the push aborted with:

[Error] server did not return id for created file "pages/<id>/config"

Crucially, the POST that creates the objects used resolveParentID (which normalizes with ToSlash), so the folder and files were already created server-side — a subsequent pullSmartForm showed the new page. That is the reported symptom: push errors, but pull shows the page.

macOS/Linux were unaffected because filepath.Dir uses / there.

Fix

The response mapping now reuses resolveParentID — the exact same ToSlash-normalized lookup used when POSTing — so the key is consistent with the parent id actually sent, on every OS. The change is a no-op on macOS/Linux (ToSlash does nothing when paths already use /).

Testing

  • go build ./... and go vet ./... — clean.
  • Full module suite go test ./... — green.
  • A local (uncommitted) regression test confirmed on Windows that the old inline filepath.Dir lookup returns 0 while resolveParentID returns the correct folder id; the assertions are OS-independent and pass on Linux/macOS too.
  • Verified end-to-end: pullSmartForm → add a new pages/<id>/ folder locally → pushSmartForm now succeeds instead of erroring.

Version

Patch bump 2.4.0 → 2.4.1 across all manifests (.claude-plugin, .codex-plugin, .kiro-plugin, marketplace.json) + CHANGELOG.md, per repo house rules.

🤖 Generated with Claude Code

@gh-corezoid

Copy link
Copy Markdown

AI Review

Fixes a Windows-only path-separator bug in pushSmartForm Phase 2 response mapping by replacing an inline filepath.Dir call with the existing resolveParentID helper (which already normalises to forward slashes via ToSlash). No behaviour change on macOS/Linux.

Checklist

Check Result
U1 — Conventional commit format ⚠️ warning
U2 — No leaked credentials ✅ pass
U3 — No merge commits ✅ pass
U4 — Correct base branch (develop) ✅ pass
U5 — Build & tests (Go) ✅ pass
U6 — Architectural & design consequences ⚠️ advisory
S1 — No manual edits to public/ ⏭️ skip (no public/ changes)
S2 — API path parameter names ⏭️ skip (no internal/tools/ changes)
S3 — New tools have eval scenarios ⏭️ skip (no new tools)
S4 — Discovery artifacts committed ⏭️ skip (implementation-only change; no signature/description delta — discovery output unaffected)
S5 — All six manifest files version-synced ❌ error
S6 — README / ARCHITECTURE updated for new tools ⏭️ skip (no new tools)

Issues found

[error] S5 — Two of the six required manifest files were not bumped to 2.4.1

The PR updates four of the six version locations but leaves two at 2.4.0:

File Expected Actual
.agents/plugins/marketplace.jsonplugins[0].version 2.4.1 2.4.0
POWER.mdversion: frontmatter field 2.4.1 2.4.0

Fix: bump both fields to 2.4.1 to match the other four manifest files.


[warning] U1 — Commit subject line is 82 characters (limit: 70)

fix(smart-forms): resolveParentID in pushSmartForm response mapping, bump to 2.4.1

Suggested shorter form (69 chars):

fix(smart-forms): resolveParentID push response map, bump to 2.4.1

[advisory] U6 — No unit tests for the fixed code path

The resolveParentID second return value (bool) is correctly discarded via _ — it is a map-lookup "found" signal, and the downstream byKey lookup already gates on ok. No correctness concern there.

However, internal/engines/smartform/ has zero test files. The Windows regression that motivated this fix was verified locally but never committed. A table-driven test covering the root path case ("config"envRootFolderID) and a nested path case ("pages/abc/config" → folder ID) would prevent the same class of path-separator bug from regressing silently. This is advisory only — not blocking.


This review was generated automatically. A human maintainer should still make the merge decision.

pushSmartForm Phase 2 mapped the create response back to local paths with
filepath.Dir, which returns backslash-separated paths on Windows and misses the
slash-keyed folder map. Creating a new page (pages/<id>/config) then aborted
with "server did not return id for created file ...", even though the server had
already created the folder and files (pullSmartForm showed them). The mapping
now reuses resolveParentID (the same ToSlash-normalized lookup used when
POSTing), so the key is consistent across OSes. No behaviour change on
macOS/Linux (ToSlash is a no-op there).

Bumps version 2.4.0 -> 2.4.1 across all six manifests + CHANGELOG.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yelyzavetaberest yelyzavetaberest force-pushed the fix/smartform-push-windows-parentid branch from 024e482 to 11ce860 Compare July 10, 2026 08:32
@gh-corezoid

Copy link
Copy Markdown

AI Review

Re-review after synchronize: fixes Windows path-separator bug in pushSmartForm Phase 2 by replacing inline filepath.Dir with the resolveParentID helper; now also bumps all six manifest files to 2.4.1 and adds a CHANGELOG.md entry.

Checklist

Check Result
U1 — Conventional commit format ✅ pass
U2 — No leaked credentials ✅ pass
U3 — No merge commits ✅ pass
U4 — Correct base branch (develop) ✅ pass
U5 — Build & tests (Go) ✅ pass
U6 — Architectural & design consequences ⚠️ advisory
S1 — No manual edits to public/ ⏭️ skip (no public/ changes)
S2 — API path parameter names ⏭️ skip (no internal/tools/ changes)
S3 — New tools have eval scenarios ⏭️ skip (no new tools)
S4 — Discovery artifacts committed ⏭️ skip (no discovery-affecting changes)
S5 — All six manifest files version-synced ✅ pass
S6 — README / ARCHITECTURE updated for new tools ⏭️ skip (no new tools)

Issues found

[advisory] U6 — No unit tests for the fixed code path

internal/engines/smartform/ still has zero test files. The Windows regression that motivated this fix was verified locally but no test was committed. A table-driven test covering the root-path case ("config"envRootFolderID) and a nested-path case ("pages/abc/config" → folder ID) would prevent the same class of path-separator bug from regressing silently. Advisory only — not blocking.


Fixed since last review ✅

Finding Evidence
[error] S5 — .agents/plugins/marketplace.json and POWER.md not bumped Both files now show version: 2.4.1; all six manifest fields are consistent.
[warning] U1 — Commit subject 82 chars (limit 70) New commit message fix(smart-forms): pushSmartForm Windows path bug, bump to 2.4.1 is 63 characters.

This review was generated automatically. A human maintainer should still make the merge decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants