Repository navigation
Mimicway 0.5.0
Added
-
Responses sent as server-sent events (
text/event-stream): a rule can answer with a list of events instead of a body, each with its data (a template, like a body, onedata:line per line), an optionalevent:name and a delay before it. The stream ends after its last event, or is cut at a chosen event: the connection is then dropped without the end of the response, and the client gets a transport error. The rule form edits the list in its new Event stream format, and a cut from a list of where it may happen. The request log records the stream once and fills its entry as it goes: the events sent, with their data, and whether the stream is open, ended, cut or left by its client. Bounds, checked when the rule is saved: 1,000 events, 60 seconds before one, 10 minutes in all; a stream holds at most 1 MiB of rendered events, and at mostMAX_OPEN_STREAMSstreams are open at once (new setting, 256 by default; the next one gets 503). In the configuration, the events areresponse.events(events,cut_at). A Kafka message never gets the answer of such a rule. -
Templates in response headers: a header value with
{{is rendered like a body, with the same variables and transformations, so that one rule answersLocation: http://{{header.host}}/jenkins/queue/item/{{path.job}}-{{seq}}/with the host the client called, the job of its path and a counter that grows with each call. A value without{{is sent as written, as before; header names are never rendered. A value whose result cannot be a header (a line break taken from the request) is left out of the response with a warning in the server log. The rule tester shows the response headers rendered for the captured request (response_headersin the request and the answer ofPOST /api/rule-test;{{seq}}gives 0 there). The header values of a rule suggested from observed traffic are written so that they render back to what the backend sent: a{{there never becomes a template. -
Help on templates in the response builders. The transformation field of a value lists every pipe with its label, inserts a working example (
first(3)rather thanfirst(N), which renders an empty text), shows what a single pipe does to that example, and warns about an unknown pipe or a number argument that is not one. A fixed value takes a pipe too, written as{{"value" | pipe}}. A fixed value is free text with suggestions:{{lists the values of the request and the fake data kinds,|the pipes, and a line under the field names an expression that would render empty or not as meant. The pipes, examples and warnings come from one catalogue that the engine renders in a test. -
Colors in the script editor: keywords, function and method calls, texts, numbers and comments each have their own color, in both themes, with the text contrast of the rest of the interface. Only the look changes: typing, selecting, the completion and what is saved are those of the plain text field, and in forced colors the field shows its text as before.
Changed
- Breaking:
parse_xml_itemsreads its path from the root element, as XPath conditions do, and returns the items at that path, and only them. A path that starts below the root or skips a level now gives an empty array, without an error, where it used to find items:"article"or"articles/article"in a SOAP envelope; write the whole path,Envelope/Body/GetOrderTotalsRequest/articles/article, as the documentation always did (how to upgrade). The old reading was wrong for paths written in full too: a sibling written before the items in their parent (<count>before the<product>elements of<products>) made it return none; a parent of the path found in an unrelated branch, or closed before the rest of the path began, made it return items from elsewhere in the body; and a self-closing item or field (<product/>,<qty/>) was skipped, so a list could come back shorter than it was. A judge now generates documents and paths and compares the items with those a walk of the document's tree finds. - CI measures how the cost of Mimicway grows with its input (
scripts/scale-test.mjs, job "Scale test"): each family of inputs (the rules of a service for one request, the services of a configuration, a series of requests, the conflict search of a rule being saved, loading and saving a configuration, suggestions from observed calls, the values a script returns, the calls recorded while a service is observed, with and without room for their endpoints) runs at n, 2n and 4n under Callgrind, which counts instructions rather than time (a count repeats within 0.01 %), and the job fails when a count grows from n to 4n faster than the growth written next to its family (linear for all of them today), with one tolerance. Requests go through the real router, middleware included. Only the growth is judged: a slower but still linear cost is measured once, in the change made for speed, and no baseline or timed benchmark is kept (decision 2). valgrind is needed to run it; the workloads compile with thescale-probefeature only, never into the binary. - CI changes the code of rule matching, of response templates and of the functions of rule scripts (
src/engine/matcher.rs,src/engine/template.rs,src/engine/script.rs) one mutation at a time with cargo-mutants (a&&made||, a match arm deleted) and fails when the tests still pass on one: on each push and pull request for the lines it changes, and every week for the whole files whensrc/changed, split into four jobs that each fit in the six hours of a GitHub job (scripts/mutants-gate.sh). The tests of a mutation get 2 GiB of memory at most: one that makes them allocate without end (an index ofurl_decodethat stops moving forward fills 6 GB in 19 seconds) is stopped within seconds and counts as caught, where it used to fill the runner's memory and stop the whole job. An equivalent mutation, one that cannot change any result, is excluded in.cargo/mutants.tomlwith its reason next to the tests. The first run left five changes that no test saw, now covered: the rule tester's hint for a header or form field condition whose key is in another part of the request, an XPath condition read past a syntax error or to the end of a body that lacks its element, and a sub-path segment with one brace only ({id), which is literal text. In templates, 33 changes went unseen, now covered by judges that generate their cases: where an expression ends whatever its quoted texts and pipe arguments hold, and the calendar ofnow_isoand of date pipes, walked one day at a time over 3,600 years. In scripts, 38 changes went unseen: 23 inparse_xml_items, whose way of following its path was wrong (see above), and the others in the limits ofxml_element, the escaping of quotes, the range ofseeded_intand the valid hours, minutes and seconds ofparse_date, now covered by judges that generate their cases (dates checked against a table of month lengths). - The end-to-end suite judges the accessibility of every screen it reaches with axe-core, against the WCAG 2.1 A and AA rules, in both themes, and the last screen of each test in both languages: a violation fails the test that showed it. The screens come from the suite itself (each view, with the forms and dialogs open in it), not from a list. A known violation can wait in
frontend/e2e/a11y-exceptions.json, at most six months, until a date the suite enforces.@axe-core/playwright4.14.0 is a development dependency (MPL-2.0, 3.4 MB installed, never part of the binary or the image). - The end-to-end suite refuses to run against a server that was not started with the new setting
DISPOSABLE_DATA=true, or withoutDATA_PATHset to an absolute directory outside the repository: it resets the configuration of the server it reaches, and an instance where someone keeps mocks, on port 7342 too, is no longer touched. The documented run and the CI use a temporary directory. - The README opens on what Mimicway does, shown rather than written: an animated diagram (your app calls Mimicway, a rule answers with a mock, another forwards to the real API, the request log records each call), then a demo of the real screens of a first mock, from the list of services to the request log. The diagram is an SVG of 5 KB per language that stops moving for readers who ask for less motion; the demo is an animated WebP of seven screens, 110 to 120 KB per language, with a still screenshot in its place for those readers. Both exist in English and French. The demo is played by the end-to-end suite on the real binary, so CI fails when a change of the interface breaks it, and
npm run docs:demoregenerates it. - The
curlwalk through the API moved from the README to a page of the guide, The API in five steps: a mocked service, a condition, a forwarded rule, the request log, on port 7343 with its data in a temporary directory. CI runs its commands as written against the binary it builds, in English and French, and fails when an answer changes (scripts/check-api-tour.sh). - The release workflow keeps its artifacts (binaries, archives, UI, SBOMs) and the record of its Docker build a week, rather than GitHub's default of 90 days, 56 MB a run: a rehearsal is read the day it runs, a tag publishes copies of them as release assets, and a week leaves time to rerun a failed job.
scripts/check-workflows.mjsfails on an upload or a Docker build of that workflow kept longer. - CI refuses an image over 150,000 bytes, a video or a GIF, and an SVG that holds a script, an event handler or a resource from elsewhere, or keeps moving for a reader who asked for less motion (
scripts/check-images.mjs). The documentation checks now also read the images of HTML blocks (<img src>,<source srcset>): a broken one, or one shown in one language only, fails like a Markdown image.
Fixed
- Recording a call of an observed service no longer searches the list of every endpoint followed: each call moved its endpoint to the end of the eviction order by looking for it from the start, so a burst of calls on new endpoints cost their number squared in comparisons (200 endpoints by default, more with
TRAFFIC_OBSERVATION_MAX_KEYS). An endpoint now finds its place in the order directly. Found by the scale test. - A request no longer costs the number of services times the number of groups: finding its service looked up the group of each service in the list of groups, so a configuration of 1,600 services in as many groups compared group names about a million times per request. The group codes are now gathered once per request. Found by the scale test.
- Suggestions from observed traffic no longer compare each response with every distinct response found before it: a route whose responses all differ (up to 1,600 kept by default, each body up to 16 KiB) cost their number squared in comparisons of whole bodies. Responses are now grouped through a table. Found by the scale test.
- The body of a Kafka message in its details, and the list of events a stream sent in the request log, can be scrolled with the keyboard: taller than their box, they scrolled with a mouse only (WCAG 2.1.1). Found by the accessibility check of the end-to-end suite.
- Forwarding to the real service no longer changes what crosses it. A header whose value holds a byte beyond ASCII (allowed by HTTP, RFC 9110 §5.5) was dropped, in both directions; a rule whose action is
proxyalso kept one value of a repeated request header (twoCookieorAcceptlines became one); and a path that starts with empty segments (/service//a) reached the backend as/a. A property test now sends generated requests (encoded paths and queries, repeated headers, bodies empty, binary, large or chunked) to a local backend directly and through each way Mimicway forwards (a service in proxy mode, observed or not, and aproxyrule), and requires the same status, headers and body, except the hop-by-hop headers and what Mimicway adds on purpose (X-Forwarded-Host,X-Forwarded-Proto, the sandbox policy and the CORSVary). - The conflict warning of the rule form reports only a rule that can never trigger: one whose every request is taken by a rule placed before it. A specific rule placed before a general fallback, which both still answer requests, is no longer reported; a rule with no condition placed before another one, which hides it, now is, OR conditions included. Detection is exact for equality,
contains, presence and plain-text patterns; with a real regular expression it may stay silent, never wrong. A path parameter that the rule's own sub-path captures is never empty: a rule whose only extra alternative was such a parameter equal to an empty text is now reported as hidden. - A full reset keeps the last change in its protected copy: the copy was taken from the disk without waiting for the changes still on their way to it, so a change made a moment before the reset could be missing from the copy meant to undo it. The reset no longer adds an ordinary backup holding the same bytes as its protected copy either (a 1,108-byte configuration was left twice), which took one of the five places for nothing; resetting a configuration already empty keeps no copy.
- Reading a template back into the guided view no longer cuts an array of values at a bracket inside an expression (
["{{query.x | default("]")}}"]).
Security
- An XML body nested deep no longer costs memory in proportion to its depth. Any client of a mocked service whose rules read XML could send 10 MiB of start tags (
<a><a><a>…): the process kept the name of each open element to follow the path of an XPath condition or a{{xpath.…}}variable, and quick-xml, the XML reader, an 8-byte index of its own for each, which raised the peak memory by 187 MiB for one request (release build, 0.4 seconds): two at once go past the 256 MiB of the Kubernetes manifests.parse_xml_itemskept about 30 MiB. XPath conditions and variables now follow their path with two counters, asparse_xml_itemsdoes, and these readers stop at the first element nested more than 1,024 deep, four times the default limit of libxml2: a condition or a variable then finds nothing it has not found before, as after a syntax error, andparse_xml_itemsstops the script with an error naming the limit. Names are compared without being copied, so a 10 MiB element name costs a condition one copy of it instead of two. The deepest body now adds less than 1 MiB to the peak of a condition, and a test sends 10 MiB bodies nested from 1 to 3.5 million elements deep, by powers of 4, to a condition, a variable and a script. - Caps on what users create and keep, so that one signed-in user cannot grow the configuration, the disk and the time of every write: 2 MiB of configuration (
MAX_CONFIG_BYTES), 100 services and 1,000 rules per group, the services outside any group counted together (MAX_SERVICES_PER_GROUP,MAX_RULES_PER_GROUP), 20 groups administered per user (MAX_GROUPS_PER_USER), and the 10 newest copies kept by full resets (PROTECTED_BACKUP_MAX_COUNT), which were kept 30 days whatever their number (a test suite that reset before each test had left 280 of them on one machine). A change, an import or a change of group admins past a cap is refused with 409 and a message that names the cap and its setting; a configuration already past one can still be edited and shrunk, never grown, and restoring a backup is not checked. The defaults and their reasons are in the README. npm ciinfrontend/runs no install script of the dependency tree on a contributor's machine, as it already did in the CI and the image:frontend/.npmrcsetsignore-scripts. The build, the tests and Playwright's browser download need none.- CI fails on a high advisory of any package of the interface, build and test tools included, where the tools only failed it on a critical one (
npm audit --audit-level=high;scripts/check-workflows.mjsrefuses a weaker audit in any workflow). Each ignored advisory carries a date to be looked at again, at most six months ahead:ignoreUntilinosv-scanner.toml, which osv-scanner enforces, and "review by" indeny.toml;scripts/check-exception-dates.mjsfails CI once a date is reached.libz-sys, brought by the Kafka client, moves to 1.1.31 (RUSTSEC-2026-0418: its build script wrote the environment undertarget/).deepmerge, which the Svelte plugin of the build uses to merge its options, is replaced by the project's own (frontend/vendor/deepmerge, about 90 lines, installed in its place throughoverrides): its advisory (GHSA-gcqx-w48m-w2h4, prototype poisoning, no fixed release) is no longer ignored but gone, and the interface has no advisory exception left. The replacement never copies a__proto__key; on 600 generated cases it gives the answer of the original deepmerge 4.3.1 on the same values without those keys, recorded once from the published package, and the built interface is byte for byte the same.