Adds a library hold at its own BasicHTTP location - #176
Merged
Merged
Conversation
The reference host now shows statifier_router's durable BasicHTTP front in the library world. StatifierExamples.HoldDesk is a router configuration of its own that sets :basichttp, so each hold it creates gets a location; the parcel configuration sets none. A hold tells the branch desk it was placed through the processor, planned and performed in the host's executor, with its location as reply_to, and the desk's copy.shelved POST at that location reaches BasicHTTPController, which hands it to StatifierRouter.BasicHTTP.Front and answers response/1. A send the desk refuses re-enters as error.communication and the hold ends desk_unreached. A new migration creates the location table with up_locations/1. The router moves to ~> 0.9.2, the first release whose migrations and address reaper run on SQLite, statifier to ~> 2.10, and mix.lock takes statifier_persistence 0.24.0 with them; the guides' pin tables follow. Refs: se-jg43
A location's token rode in the path of every desk POST, and Phoenix logged that path at :info with the request line. The endpoint's Plug.Telemetry now takes log_level/1, which logs no request line under /basichttp; the route is log: false; and :filter_parameters names token. A test captures a POST at :debug and finds the token in no log line but Ecto's query lines, which print bound parameters at :debug; the guide and the controller's moduledoc say so. Refs: se-jg43
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.
The reference host now shows
statifier_router's durable BasicHTTP front, in the library world only.What it does
StatifierExamples.HoldDesk: a router configuration of its own that sets:basichttp(base URL: the endpoint's URL plus/basichttp). Each hold execution it creates gets a location.StatifierExamples.RoutedWorkflow's parcel configuration sets no:basichttp, and a test asserts that.priv/library/hold_desk.scxml): a patron's hold at a branch desk. Onhold.requestedit sendshold.placedwith<send type="basichttp">to the desk the request names, passingreply_toread from_ioprocessors['basichttp']['location']. It finishes inshelvedoncopy.shelved, or indesk_unreachedonerror.communication.StatifierRouter.BasicHTTP.deliver/3and performed withperform/2in the host's own executor (HoldDesk.execute/2). The router leaves outbound sends at the executor seam to the host. A delayed BasicHTTP send is refused.StatifierExamplesWeb.BasicHTTPController.event/2, routed for every method at/basichttp/:tokenoutside the browser pipeline. It builds the request map, callsStatifierRouter.BasicHTTP.Front.handle/3and answersFront.response/1: 204, 404, 405 withallow: POST, or 400.priv/repo/migrations/20260930120001_add_statifier_router_locations.exscallsStatifierRouter.Migrations.up_locations/1(down_locations/1on rollback). It uses the samedepot_idleading column as the app's first router migration.docs/guides/basichttp-front.md, theHoldDeskmoduledoc and the controller moduledoc all say so.test/statifier_examples_web/controllers/basic_http_controller_test.exsdrives it end to end through the endpoint with Phoenix ConnTest on the app's SQLite. The outbound POST goes to a test transport (test/support/desk_transport.ex), which hands it back to the test. The test then POSTscopy.shelvedat thereply_tolocation through the controller.Dependencies
{:statifier_router, "~> 0.9.2"}. 0.9.2 is the first release whose migrations (V03, fixed in 0.9.1) andAddresses.reap/3(fixed in 0.9.2) both run on this app's SQLite database. 0.9.0 ships the front.{:statifier, "~> 2.10"}, which router 0.9.2 requires. It shipsStatifier.Send.BasicHTTP.mix.lockmoves three entries: statifier 2.9.0 to 2.10.0, statifier_router 0.6.0 to 0.9.2, and statifier_persistence 0.21.0 to 0.24.0, which came in with the router update. The persistence requirement stays at~> 0.20, and none of 0.22.0 to 0.24.0 adds a migration.Provenance
These changes are forced by the bead but were not in its file map:
Plug.Parsersconsumes a form body before any action runs, and the front needs the body as it arrived. The parsers now takebody_reader: {StatifierExamplesWeb.RawBody, :read_body, []}, which keeps the raw body only for/basichttppaths. Every other path reads as before.docs/guides/first-workflow.md,docs/guides/first-workflow-routed.mdanddocs/guides/migrating-waiting-executions.mdstate whatmix.lockresolves. Their pin tables and move notes now name the new versions: version facts only, no new example. Three tests that pin versions in the recipes' first output line now match the new lines (first workflow, routed workflow, migrate waiting), andtest/statifier_examples/mix_deps_test.exsasserts the new requirements and lock entries.:info. The endpoint'sPlug.Telemetrynow takeslog: {StatifierExamplesWeb.Endpoint, :log_level, []}, which logs no request line under/basichttp; the route islog: false; andconfig :phoenix, :filter_parametersnamestokenbesidepassword. A test captures a POST at:debugand finds the token in no log line except Ecto's query lines. At:debugthose print bound parameters, and the router binds the token, so the guide and the controller's moduledoc tell a host to keep:debugout of production.error.communication, not a failed route. An executor{:error, _}for a send does not fail the delivery:statifier_persistenceenterserror.communicationinto the execution in the same step. The chart takes that todesk_unreached, and a test covers it.Gate
Full
mix qualityon the committed tree (head after the review cure). The same tree (git write-treebefore and after the run) was committed with the repo gate lock and a machine slot held throughout:Each sabotage noted above a new test was run on its own, restored from a copy (byte-equal by
cmp) and recompiled. Each turned a named test red on an assertion, including Phoenix ConnTest'sresponse/2status check.