<feed xmlns='http://www.w3.org/2005/Atom'>
<title>guess-market/tools, branch master</title>
<subtitle>definitely not polymarket
</subtitle>
<id>https://git.sartin.in/guess-market/atom?h=master</id>
<link rel='self' href='https://git.sartin.in/guess-market/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/'/>
<updated>2026-10-15T16:36:15Z</updated>
<entry>
<title>ui-web: add browser client for the Ex4 bonus</title>
<updated>2026-10-15T16:36:15Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-10-15T16:35:48Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=c263497ec8b05bc0f9254ed2f7ecb4dba6f67d4e'/>
<id>urn:sha1:c263497ec8b05bc0f9254ed2f7ecb4dba6f67d4e</id>
<content type='text'>

A React + TypeScript single-page client served by Vite, working against
the same servlets as the desktop client: login, the events screen with
filters, details, order books and trading, and the account screen with
deposit, holdings, ledger rows and the user directory. No file upload,
as the exercise specifies.

It looks like the desktop client on purpose: the three skins of
theme.css as CSS variables, the four animations redone with SVG and
keyframes, and the desktop's Nerd Fonts, which npm run dev copies from
ui-fx instead of keeping a second copy in the repo. The shared chat sits
in a drawer above the status bar, as on the desktop, on its own poll
because chat lines don't move the market version.

Vite forwards /guess-market to Tomcat on 8080, so the page and the API
share an origin and the session cookie needs no CORS. The client polls
/api/sync once a second and reloads only when the version moved.

run-web.bat installs the packages and starts it on localhost:5173.
package.sh stages the sources under build/dist/ex4, without
node_modules.

</content>
</entry>
<entry>
<title>tools: package the server as a WAR and the client as a directory</title>
<updated>2026-10-13T16:20:05Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-10-13T16:19:40Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=da4f3ceb1fc1f317a3cca788b6c9b78ffab12de2'/>
<id>urn:sha1:da4f3ceb1fc1f317a3cca788b6c9b78ffab12de2</id>
<content type='text'>

The Ex3 submission is exactly one WAR for Tomcat's webapps/ plus a
directory holding the client, its jars and its batch file.

package.sh now stages both under build/dist/ex3. The WAR is named
guess-market.war after the context path the client expects, and carries
the api and service jars with gson and JAXB; Tomcat only has to provide
the servlet API. The client directory holds ui-client, api, ui-fx,
gson, OkHttp and JavaFX, and nothing of the engine.

An executable's Class-Path used to name every module. List only the
modules it depends on, so the client jar no longer points at
service.jar, and stop producing a plain jar for the server module.

Add tomcat.sh to try the result by hand: it copies the packaged WAR
into a local Tomcat ($CATALINA_HOME, or the newest
C:\tomcat\apache-tomcat-*) and runs it in the foreground.


</content>
</entry>
<entry>
<title>ui-client: add desktop client that talks to the server</title>
<updated>2026-10-13T07:42:40Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-10-13T07:42:15Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=a8bc9dce528abb6340315f7daa61ad76be4a8739'/>
<id>urn:sha1:a8bc9dce528abb6340315f7daa61ad76be4a8739</id>
<content type='text'>

New module for the Ex3 desktop app. It reuses the ui-fx views and
depends on the api only, never on the engine.

ServerClient owns the OkHttp session and the last snapshot pulled from
/api/sync. RemoteCatalogContext, RemoteGuessMarketContext and
RemoteAccountContext implement the api interfaces on top of it: reads
are answered from the snapshot, so AppState never waits on the network,
and writes go over HTTP and pull a fresh snapshot before returning.

A daemon thread polls once a second with blocking calls and refreshes
AppState through Platform.runLater only when the server's version
moved. AppState reselects the event and user by id, so a refresh keeps
the selection.

Server and user name come from --server= and --user= until the login
screen exists.


</content>
</entry>
<entry>
<title>ui-fx: move the JavaFX UI into a module that sees only the api</title>
<updated>2026-10-11T16:28:30Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-10-11T16:28:04Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=3a734b84705ccb8174e9cf24b74d7a3c3b2c1beb'/>
<id>urn:sha1:3a734b84705ccb8174e9cf24b74d7a3c3b2c1beb</id>
<content type='text'>

Exercise 3 asks for a new desktop client that reuses the Exercise 2
screens, and the course asks that clients depend on the DTO contract,
never on the engine. ui-desktop mixed both: its views and controllers
only talk to the api interfaces, but AppView and AppState each had a
convenience constructor that built a ServiceEngine, which tied every UI
class to the service module.

Move the screens, controllers, components, FXML, skins and fonts into
a new ui-fx module that depends on api alone. Packages are unchanged,
so FXML controller names and resource paths keep working as they are.
ui-desktop keeps only the Exercise 2 app: Launcher, App, which now
builds the ServiceEngine and passes its contexts in, and ServiceEngine
itself. The Exercise 3 client can then reuse ui-fx with remote
contexts and never put the engine on its classpath. The build proves
the split: ui-fx compiles with nothing but api visible.

Tests move with the code they cover. AppStateTest drives the real
engine, so it stays in ui-desktop.


</content>
</entry>
<entry>
<title>server: add Tomcat webapp module with shared engine and CORS</title>
<updated>2026-10-09T09:55:40Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-10-09T09:55:16Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=9a62e94261e6531c6b60d296322e0cef2a5b21e1'/>
<id>urn:sha1:9a62e94261e6531c6b60d296322e0cef2a5b21e1</id>
<content type='text'>

Exercise 3 moves the market behind a Tomcat server that the desktop
and browser clients share. Add a server module, registered in the
build scripts, holding the pieces every later endpoint builds on:

- ServerEngine wires one in-memory market (repositories, ledger,
  trading pipeline, v3 upload loader) and lives in the servlet context
  for the webapp's lifetime. Its catalog refuses path-based loading,
  so events can only arrive through uploaded streams and the server
  never reads or writes files.
- EngineBootstrap builds that engine when the webapp deploys.
- CorsFilter answers preflights and echoes the caller's Origin with
  Allow-Credentials, which the browser client needs to send its
  session cookie from another origin. With usernames as the only
  login, echoing any origin exposes nothing a page couldn't get by
  logging in itself.
- /api/health reports that the engine is up.

Vendor tomcat-juli 10.1.26 next to the other Tomcat jars. It ships in
Tomcat's bin/ rather than lib/, and embedded Tomcat cannot start
without it. A test deploys the module into embedded Tomcat, so
annotation scanning, the health check and CORS are checked against a
real container.


</content>
</entry>
<entry>
<title>ui-desktop: build the JavaFX market UI on top of the service</title>
<updated>2026-09-09T07:05:12Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-09-09T07:05:12Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=f23c20c1c66b39fb1f49307e08e8593fa708e026'/>
<id>urn:sha1:f23c20c1c66b39fb1f49307e08e8593fa708e026</id>
<content type='text'>
Replace the placeholder hello-world window with a working desktop
client for the guess market.

ServiceEngine wires the in-memory repositories, XML loader, risk,
matching, fulfillment and settlement contexts together, and AppState
exposes their results as observable JavaFX state for the views to bind
to. The FXML views have an events tab and a users tab. The events tab
lists events with mechanism and commission filters, and shows each
event's price chart, order book ladder, trade history and participants.
The users tab shows each user's ledger and positions, and lets them
place buy and sell orders. Dialogs cover loading an XML file (in a
background task), creating an event and resolving one.

Bundle a CSS theme and Nerd Font faces so the UI looks the same on
every machine. Teach build.sh to copy each module's src/main/resources
into its class output, since FXML, CSS and fonts are loaded from the
classpath at runtime.
</content>
</entry>
<entry>
<title>ex-2: add invalid-input fixtures and wire ui-desktop to the service</title>
<updated>2026-09-06T07:36:54Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-09-06T07:36:54Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=508898f52c16cc737bc7d08b8ee4c29fab8d1146'/>
<id>urn:sha1:508898f52c16cc737bc7d08b8ee4c29fab8d1146</id>
<content type='text'>
The ex-2 loader has to reject documents that are schema-valid but
logically broken, and so far only error-2.xml and error-3.xml exercised
that path. Add one fixture per validation rule under
test-data/ex-2/invalid, each a copy of small.xml with a single defect
described in a leading comment: a non-.xml extension, a duplicate event
id, commission outside 0..90 on either side, a duplicate user name,
zero or negative initial cash, a market maker referencing an unknown
event, and an event with no market maker or with two.

Teach LedgerMapper to map individual LedgerEntry records to
LedgerEntryDTO, renaming id to seq and time to at and rendering the
timestamp through InstantOptions.humanize, so callers can show a ledger
history rather than only the account summary.

Make ui-desktop depend on api and service in the build tooling and in
its Eclipse classpath, since the desktop UI now talks to the service
layer directly, and put lib/openjfx on java.library.path for the test
run so tests touching JavaFX can load its native libraries.
</content>
</entry>
<entry>
<title>openjfx: ship native libraries so the desktop UI can launch on Windows</title>
<updated>2026-08-23T15:10:32Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-08-23T15:10:32Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=c0dde6531e831730c25230097fd85a8a38214101'/>
<id>urn:sha1:c0dde6531e831730c25230097fd85a8a38214101</id>
<content type='text'>
lib/openjfx held only the JavaFX API jars, with no Prism/Glass native
libraries backing them. At startup JavaFX tried the d3d then sw
rendering pipelines and both failed to load, since NativeLibLoader had
no native code to find, crashing before any window opened.

Bump the jars to 25.0.4 to match the target JDK and add the matching
native DLLs alongside them. Drop the web/media/swt/swing jars and
their natives (including the 92MB jfxwebkit.dll) since ui-desktop
never references those modules.

Update package.sh to also stage *.dll files when copying runtime libs
into build/dist, and point java.library.path at lib/openjfx in the
generated run-*.bat so the natives are found at launch.
</content>
</entry>
<entry>
<title>model: relocate market DTOs out of the flat api package</title>
<updated>2026-08-23T14:05:29Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-08-23T14:05:29Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=843820ea9f357220d69f3795f3289ee41eed355c'/>
<id>urn:sha1:843820ea9f357220d69f3795f3289ee41eed355c</id>
<content type='text'>
Move AccountDTO/MarketDTO/MarketStateDTO/PurchaseReceiptDTO/TradeRowDTO
out of the catch-all api package into model.market (and LedgerDTO into
model.ledger), matching the existing model.event convention so DTOs
live next to the domain they describe rather than in the interface
package. Relocate LedgerMapper from mapper.v2 to infrastructure.adapter
to match the module's established package layout, and update all call
sites and imports accordingly.

Also register the ui-desktop module in the build tooling: add it to
MODULES, add openjfx to the shipped runtime libs, and generalize
package.sh so each executable module (ui-console, ui-desktop) gets its
own Main-Class/Class-Path manifest and run script instead of
special-casing ui-console. Fold long Class-Path manifest lines at 72
bytes per the JAR spec, since adding ui-desktop's dependencies pushed
the line past the limit.
</content>
</entry>
<entry>
<title>Add MapStruct LedgerMapper and wire annotation processing into build.sh</title>
<updated>2026-08-20T14:39:50Z</updated>
<author>
<name>Kostya</name>
<email>mail@sartin.in</email>
</author>
<published>2026-08-20T14:39:50Z</published>
<link rel='alternate' type='text/html' href='https://git.sartin.in/guess-market/commit/?id=fbfd2e275e9d645e4ec8a1874bc57d98b1c38300'/>
<id>urn:sha1:fbfd2e275e9d645e4ec8a1874bc57d98b1c38300</id>
<content type='text'>
build.sh now passes -processorpath/-s so MapStruct's generated impl
compiles alongside hand-written sources.
</content>
</entry>
</feed>
