Skip to content

;dev:web: don't let the add-form tests depend on post param order - #2713

Draft
acinader wants to merge 1 commit into
plaintextaccounting:mainfrom
acinader:web-test-param-order
Draft

;dev:web: don't let the add-form tests depend on post param order#2713
acinader wants to merge 1 commit into
plaintextaccounting:mainfrom
acinader:web-test-param-order

Conversation

@acinader

@acinader acinader commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Reported by @hseg in #2700: two write tests fail on stack98.yaml.

yesod-test before 1.7.0 renders post params in reverse addition order (fixed by
yesodweb/yesod#1867). The add form pairs the repeated account/amount params by
position, so on those snapshots the second posting's blank amount arrives first and leaves
an account with no amount. The post fails validation, and "adds a transaction when the CSRF
token is present" and "does not let the add form write a newline into the journal" fail.

Sending an explicit amount for both postings makes the pairing correct in either order.
hledger-web itself is unaffected — a browser sends form fields in document order.

Affected: stack96.yaml (yesod-test 1.6.16), stack98.yaml (1.6.16), stack910.yaml (1.6.19).
Fine on stack.yaml (1.7.0.2) and stack912.yaml (1.7.0.1), which is why ci.yml is green.
oldest.yml (stack96.yaml) runs the suites too, but its head is 36740f0, before these
tests landed — so it would go red as it stands.

Verified with stack test hledger-web, and by posting the params
in reverse order on the current stack.yaml to simulate the older yesod-test — that
reproduces the reported failure, and passes with this change.

AI usage: Claude Opus 5, ~25k output tokens

The add form pairs the repeated account and amount params by position.
yesod-test before 1.7.0 renders post params in reverse addition order
(fixed by yesodweb/yesod#1867), so the second posting's blank amount
arrived first, leaving an account with no amount. The post then failed
validation.

Sending an explicit amount for both postings makes the pairing correct
in either order. Reported by hseg on stack98.yaml; stack96.yaml
(yesod-test 1.6.16) and stack910.yaml (1.6.19) are affected too.
stack.yaml has 1.7.0.2, which is why ci.yml is green.

AI usage: Claude Opus 5, ~25k output tokens
@acinader

acinader commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

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.

1 participant