Context
This follow-up task was identified during the review of PR #58.
Source PR: #58
PR Title: fix: cross-handler SPA navigation, navigation edge cases, and Tier 1 file uploads
Suggested by: @claude[bot]
Priority: Low
Task Description
LiveTemplateClient.sendHTTPMultipart(form, action, formData) has several caller responsibilities that are currently enforced only by doc comments:
- FormData must be built BEFORE
setActiveSubmission disables the fieldset (otherwise it's empty)
- FormData must already include the
lvt-action entry
- Callers must not mutate or reuse the passed FormData after the call
These implementation details leak into the public method signature. Since the only real caller is EventDelegator (via EventDelegationContext.sendHTTPMultipart), the contract is contained in practice — but a dedicated payload type could enforce it statically.
Proposed Fix
Introduce a branded type or interface that encodes the contract:
// Example shape — actual design TBD
interface Tier1UploadPayload {
readonly form: HTMLFormElement;
readonly action: string;
readonly formData: FormData; // pre-captured, includes lvt-action
}
sendTier1Upload(payload: Tier1UploadPayload): void;
The EventDelegator would be the only factory for Tier1UploadPayload, ensuring the contract is met at construction time.
Original Comment
The method is public and the doc comment lists requirements callers must meet: build FormData before fieldset disable, include lvt-action, don't mutate. Since the only real caller is EventDelegator via EventDelegationContext, this is contained — but these feel like internal implementation details leaking into the interface. Consider whether a dedicated payload type could enforce the contract at compile time rather than via doc comment.
This issue was created from PR #58 review comments.
Context
This follow-up task was identified during the review of PR #58.
Source PR: #58
PR Title: fix: cross-handler SPA navigation, navigation edge cases, and Tier 1 file uploads
Suggested by: @claude[bot]
Priority: Low
Task Description
LiveTemplateClient.sendHTTPMultipart(form, action, formData)has several caller responsibilities that are currently enforced only by doc comments:setActiveSubmissiondisables the fieldset (otherwise it's empty)lvt-actionentryThese implementation details leak into the public method signature. Since the only real caller is
EventDelegator(viaEventDelegationContext.sendHTTPMultipart), the contract is contained in practice — but a dedicated payload type could enforce it statically.Proposed Fix
Introduce a branded type or interface that encodes the contract:
The
EventDelegatorwould be the only factory forTier1UploadPayload, ensuring the contract is met at construction time.Original Comment
This issue was created from PR #58 review comments.