fix(save): never add a param only to spell out its sidecar default #223
No reviewers
Labels
No labels
bug
enhancement
needs-triage
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/deckle!223
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/219"
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?
Closes #219
What was wrong
The element form seeds an absent param with its sidecar default, and
MergeParamswrote every value it received. So saving an element without changing it addedalign="left"to a hero whose file omittedalign. The default-language sync then copied that into every connected translation, and the pending chip showed "2 changes" for a save that changed nothing.Fix
elemops.MergeParamswrites a managed param in two cases: the shortcode already holds it, or the value differs from the sidecar default.l10n.Hashuses.Schema.Checkwould refuse an inline chip with a required, defaulted param on the next body save, because it rejects a missing required param whatever its default. No shipped inline element has such a param today.buildItemShortcodesmatches each row to its stored child by the uid the row echoes back, and only that child's managed params count as already held.scaffold/site/AGENTS.md("Editing content by hand") and theedit-contentskill now state the rule.migrate-sitemakes no claim about defaults in files, so it needed no change.Tests
internal/server:enanddefiles byte-identicalalign: centerpropagates to the connected translation, and the free one stays untouchedinternal/elemops: rule unit tests, covering number, bool, select, datetime and link defaults, required params, and items matching.internal/l10n:HashandItemHashare the same with and without a spelled-out default.go vet ./...,go test ./...andcd web && npm test(2792 tests) pass.harness checkpasses ontestdata/multilingual-site(0 errors, 4 warnings about shortcode templates the fixture doesn't ship) and on a freshly scaffolded site.Notes for follow-up (not changed here)
FrontMatterChanges) still write a defaulted front-matter field that the page lacks on an unchanged save. The issue puts this out of scope.elementFingerprintinpending.gocompares raw params, so a hand edit that adds or drops a spelled-out default shows as a pending change.TestSaveItemsHandAuthoredNewlineSeparatedChildrenand is separate from this issue.🤖 Generated with Claude Code
[autoland] verdict: pass
Validated: CONCERNS (non-blocking). Approving; not auto-merging.
Signal relied on:
labctl pr checks 223, aggregatesuccess.ci / build-and-testran green in 19m29s (Go vet/test/build plus frontend build/test, run unconditionally, so it covers this diff and the AGENTS.md and skills drift tests).ci / releasewas skipped, which is normal for a PR. I re-ran nothing locally.Conventions: the Conventional Commits title is fine,
Closes #219is present, and AGENTS.md and theedit-contentskill are updated.migrate-sitemakes no claim about param defaults, so it needs no change. The diff matches #219's decisions and acceptance criteria. The tests cover each server criterion, the items rows and the l10n hash.Concern: rich-text inline chips no longer get defaults on insert, and AGENTS.md now says the opposite.
ChipDialogsubmitssubmitInline(ref, original = {}, snapshot)(web/src/rte/RichTextField.tsx:754). That goes toelemops.MergeParams(nil, …)(internal/server/forms.go:829). Nothing is held, so the new skip atinternal/elemops/save.go:209drops every optional param that sits at its default.buttonchip inserted with variantprimaryused to be stored asvariant="primary"; it is now stored withoutvariant.scaffold/site/AGENTS.md:1275-1276says "an element the editor inserts starts with every default written". That is still true for block elements (NewShortcode) but now false for inline chips.button.htmlfalls back withdefault "primary".handleFormInlinedoc comment (internal/server/forms.go:784-794), or[autoland] verdict: pass
Verdict: CONCERNS (non-blocking). Validated with /land-pr; awaiting the human's confirmation to merge.
Signal relied on:
labctl pr checks --wait 223, aggregatesuccess(ci / build-and-testgreen,ci / releaseskipped as usual for a PR). Nothing re-run locally. The head merges cleanly with the currentmain(two editor/rte fixes landed since the branch point, no overlap).Conventions: Conventional Commits title,
Closes #219present, AGENTS.md and theedit-contentskill updated in the same change. The diff matches #219's decisions and acceptance criteria; tests cover the server criteria, items rows and the l10n hash.Concern (non-blocking), same as the autoland note: a new rich-text inline chip is submitted through
handleFormInline(internal/server/forms.go) with empty original params, soMergeParamsnow omits its optional defaulted fields at insert. Rendering is unaffected (templates fall back), but the new sentence inscaffold/site/AGENTS.md("an element the editor inserts starts with every default written") is only true for block elements. Follow-up: narrow that sentence to block elements and refresh thehandleFormInlinedoc comment, or write defaults on chip insert.Pushed
87e7717toafk/219to resolve the approval's concern:scaffold/site/AGENTS.md("Editing content by hand") now says only a block-level element the editor inserts starts with every default written, and that an inline chip the rich-text editor inserts starts with only its non-default andrequiredparams; thehandleFormInlinedoc comment ininternal/server/forms.gosays the same. Docs only, no behaviour change. Locally:go vet ./...andgo testoninternal/element,scaffold,internal/elemops,internal/serverpass (the AGENTS.md and skills drift tests included).[autoland] verdict: pass
Verdict: PASS. Validated with /land-pr on head
87e7717; awaiting the human's free-text confirmation to merge.Signal relied on:
labctl pr checks --wait 223, aggregatesuccessfor the current head (ci / build-and-testgreen in 15m44s,ci / releaseskipped as usual for a PR). Nothing re-run locally.git merge-treeagainst the currentmainreports no conflict.Conventions: Conventional Commits title,
Closes #219present, AGENTS.md ("Editing content by hand") and theedit-contentskill updated in the same change;migrate-sitemakes no claim about defaults in files. The diff stays within #219's decisions and acceptance criteria:elemops.MergeParamsskips an unheld param whose canonical value equals its sidecar default (required params excepted),buildItemShortcodesmatches rows to stored children by uid so the same rule applies per row, and the l10n hash is pinned as default-agnostic.Earlier concern resolved: the follow-up commit
87e7717narrows the AGENTS.md sentence about inserted elements to block-level rows and documents that a rich-text chip starts without its optional defaults; thehandleFormInlinedoc comment says the same. No open concerns remain.