Repository navigation
Conversation
Motivation: a state declared with an expression default (kind `seeded`) received a String from a literal `data-herb-set` (e.g. `page=1`), while `data-herb-increment` wrote a Number. `coerceState` only converts for boolean, integer and nil, so seeded kinds fell through to the raw text. The state's type then depended on which action wrote it last, and the `Herb-State` header could carry `"page":"1"` after `"page":2`. Approach: in `assignedValue`, when the declared kind is `seeded`, read the state's current value and coerce the literal to its type: a number for an integer-looking literal when the state holds a number, a boolean for `true`/`false` when it holds a boolean. Otherwise (string, null) the raw text is kept as before. Limitation: if the seeded state currently holds null, there is no type to follow and the literal is still written as a String. The `$value` path is unchanged. Validation: in javascript/packages/client, `npx vitest run test/actions.test.ts` passes (44 tests). The new test fails without the src change and passes with it. Full `npx vitest run`: 772 tests pass; one test file fails to collect because the generated `state-kinds` module is missing in this checkout, unrelated to this change (`tsc` reports the same missing module). Report: marcoroth#2743 Signed-off-by: Pujitha Paladugu <10557236+pujitha24@users.noreply.github.com> Assisted-by: claude-sonnet-5-5 (via Claude Code)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation: a state declared with an expression default (kind
seeded)received a String from a literal
data-herb-set(e.g.page=1), whiledata-herb-incrementwrote a Number.coerceStateonly converts forboolean, integer and nil, so seeded kinds fell through to the raw text.
The state's type then depended on which action wrote it last, and the
Herb-Stateheader could carry"page":"1"after"page":2.Approach: in
assignedValue, when the declared kind isseeded, read thestate's current value and coerce the literal to its type: a number for an
integer-looking literal when the state holds a number, a boolean for
true/falsewhen it holds a boolean. Otherwise (string, null) the rawtext is kept as before.
Limitation: if the seeded state currently holds null, there is no type to
follow and the literal is still written as a String. The
$valuepath isunchanged.
Validation: in javascript/packages/client,
npx vitest run test/actions.test.tspasses (44 tests). The new test fails without thesrc change and passes with it. Full
npx vitest run: 772 tests pass; onetest file fails to collect because the generated
state-kindsmodule ismissing in this checkout, unrelated to this change (
tscreports the samemissing module).
Report: #2743
Signed-off-by: Pujitha Paladugu 10557236+pujitha24@users.noreply.github.com
Assisted-by: claude-sonnet-5-5 (via Claude Code)
Fixes #2743