fix(org-import): started event emits after YAML parse so name is populated #142
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/org-import-started-event-name"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The
org.import.startedevent was firing immediately after request body bind, before the YAML atbody.Dirwas loaded. Payloadnamewas""whenever the caller passeddir(the common path — canvas and all live imports usedir, not inlinetemplate). Three started rows already in the local platform'sstructure_eventshave emptyname.Follow-up to PR #137; called out as a follow-up in that PR's body.
Fix
Move the started emit (and
importStarttimestamp) to after the YAML unmarshal / inline-template fallthrough, wheretmpl.Nameis guaranteed populated.Bonus side-effect
Pre-parse error returns (invalid body, traversal-rejected
dir, file-not-found, YAML expansion fail, YAML unmarshal fail, neitherdirnortemplateprovided) no longer emit an orphanstartedrow. Everystartedis now guaranteed a pairedcompleted/failed— semantically "we couldn't even start an import" doesn't claim it started.Verification
molecule-dev-only; new started row instructure_eventscarries"Molecule AI Dev Team (dev-only)"instead of""go test ./internal/handlers/...greengo buildclean🤖 Generated with Claude Code