Skip to content

daytrader-go: account - #4

Open
devin-ai-integration[bot] wants to merge 1 commit into
migration/daytrader-gofrom
devin/1794800000-go-account
Open

devin-ai-integration[bot] wants to merge 1 commit into
migration/daytrader-gofrom
devin/1794800000-go-account

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Ports the account area of DayTrader 3 to Go + PostgreSQL. Only daytrader-go/internal/features/account/ and daytrader-go/templates/account_*.html are touched.

Legacy Go
TradeServletAction.doRegister + TradeSLSBBean.register web.RegisterPublicAction("register"): one profile row and one account row in Store.InTx, id from Store.NextID("account"), then app.Forward(..., "login", {"uid", "passwd"})
register.jsp web.RegisterRoute("GET /register.jsp"), template account_register (same form field names, prefilled from the request)
doAccount + account.jsp web.RegisterAction("account"), template account_account; status line from web.Attr(r, "results")
doAccountUpdate + updateAccountProfile web.RegisterAction("update_profile"): same two validation messages, update in Store.InTx, then the account page

Legacy behaviour kept:

  • Account page always prints Total Orders: 0 and an empty recent-orders table (docs/BASELINE.md quirk 2). accountOrders() returns an empty list on purpose; the order rows are still in the template.
  • Register: password mismatch or empty password re-shows the register page with Registration operation failed, your passwords did not match; an existing user id gives Registration operation failed;; a non-numeric money or a missing passwd is HTTP 500.
  • update_profile trims its fields like String.trim(); register does not trim.

Verification

  • gofmt -l ., go vet ./..., go test ./... clean in daytrader-go/ (Go 1.27.0). New unit tests in account_test.go (validation, templates, register failure paths, login gate); they need no database.
  • Legacy Liberty on :9083: make parity 13/13.
  • make parity TARGET=http://localhost:8080/daytrader on a local throwaway branch = this branch + devin/1794800000-go-auth + devin/1794800000-go-market (the siblings on origin at the time):
    • 08-account-update: PASS
    • 04-register: DIFF, only on its last step. The register and account steps match; the portfolio step shows the welcome page because the trading branch was not pushed yet. Not seen passing.
    • Also PASS in that combination: 01, 02, 09, 10 (other areas' scenarios).
  • Side by side with curl against Liberty (same requests, cookie jar, timestamps masked): register page, both register failure pages, the account page and the three update_profile outcomes are identical apart from blank lines, the account id and the items below.

Deliberate differences

  • A new account's lastlogin starts at the creation date instead of NULL, because store.Account.LastLogin is not nullable and the login that follows would fail to scan it. Not visible: login sets it straight after.
  • Account page doctype is HTML 4.01 (shared pageStart), legacy account.jsp says HTML 4.0.
  • Values are HTML-escaped by html/template; the JSPs print them raw.

Scaffold requests

  • None blocking. Optional: make store.Account.LastLogin nullable (*time.Time) if the NULL-until-first-login state should be stored as legacy does.

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/229a43d96c0948fabb011e57e8cf3029
Open in Devin Desktop: https://partner-workshops.devinenterprise.com/desktop/session/229a43d96c0948fabb011e57e8cf3029?variant=devin
Requested by: @sumitshatwara

@devin-ai-integration

Copy link
Copy Markdown
Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

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