• v0.1.0 feb086b9e4

    v0.1.0
    All checks were successful
    Release / chart-1 (push) Successful in 4s
    Release / shellcheck (push) Successful in 9s
    Release / changelog (push) Successful in 4s
    Release / test (push) Successful in 22s
    Release / ci (push) Successful in 0s
    Release / plan (push) Successful in 4s
    Release / image (push) Successful in 34s
    Release / chart (push) Successful in 6s
    Release / release (push) Successful in 0s
    Stable

    city-root released this 2026-11-13 03:06:46 +00:00 | 1 commits to main since this release

    Added

    • The schedule core computes outage windows from an integer-millisecond UTC instant, with the default 1 day period, 15 minute outage, 90 % availability, even placement and seed 0 giving 10 outages per period.
    • The flap server starts from environment variables alone (FLAP_ADDR, FLAP_BASE_URL, FLAP_MAX_HANG, FLAP_MAX_HANGS, FLAP_MAX_DROP_BYTES, FLAP_LOG_LEVEL, FLAP_DRAIN_DELAY), refuses invalid values at startup and reports its version from -X main.version.
    • Every request writes one structured JSON access log line with method, path, sanitised query, status, response bytes, duration, outage state, failure kind and client address.
    • GET /healthz always answers 200 ok, and GET /readyz answers 200 ok until shutdown begins and 503 afterwards, so both work as Kubernetes probes.
    • On SIGTERM the server turns readiness to 503, keeps serving for the drain delay (default 5 s), releases held requests and shuts down within 10 s.
    • Scattered and grid placements draw window positions from the seeded stream, so a rerun with the same seed reproduces the same outages. Grid placement needs a period that is a multiple of the outage length and at most one outage per slot. A golden file pins the windows of 67 parameter sets and fails the tests on any drift; go test ./internal/schedule -run Golden -update regenerates it.
    • Schedule parameters (period, outage, count, availability, seed, placement) are parsed from query values with defaults and bounds, and rejected with a distinct client-facing message when unusable. Unknown, repeated and empty parameters are errors, so a typo never falls back to a default, and the internal/schedule parameter table lists every parameter, default and bound.
    • GET /inspect describes a schedule without triggering a failure: it always answers 200 for valid parameters, in or out of an outage, with the evaluated instant, state, next change, achieved availability, the windows overlapping the current period and ready-to-call links for status, hang and drop that carry the same schedule parameters. format=json|html|svg forces the format; otherwise an Accept that ranks text/html above application/json gives HTML and anything else, including */*, gives JSON. at=<RFC 3339 or unix seconds> evaluates another instant. Absolute links use FLAP_BASE_URL, else X-Forwarded-Proto and X-Forwarded-Host, else the request host. HTML and SVG are placeholders until the timeline view lands.
    • /status/{code} answers any method with the chosen status (200 to 599; 1xx and other codes are refused with 400) during an outage and with 200 ok outside one. retry_after=<seconds> or retry_after=remaining adds Retry-After during an outage, where remaining is the time to the end of the outage rounded up to whole seconds and at least 1. Schedule parameters, retry_after and the code are validated before the clock is read, so an invalid request is a 400 and never produces a failure. Every response carries Cache-Control: no-store, and X-Flap-State: up|down whenever the schedule was consulted.
    • /hang holds the response during an outage for the shorter of the time to the outage end and the optional duration parameter (1 ms to 366 d), capped by FLAP_MAX_HANG, then answers 200; outside an outage it answers 200 at once. A hold ends when the client disconnects or the server shuts down. Above FLAP_MAX_HANGS concurrent holds, /hang answers 429 with an X-Flap-Reason header instead of holding.
    • /drop resets the connection during an outage after the number of body bytes given by bytes (default 0, at most FLAP_MAX_DROP_BYTES): it declares a longer Content-Length than it sends and ends the connection with a TCP reset (after a FIN, so a client never waits for the missing byte), and answers 200 ok outside an outage. Invalid or over-cap bytes is rejected with 400 before the connection is touched.
    • GET /docs serves a reference page generated from the parameter tables the server validates with, so it cannot drift from behaviour: every schedule parameter with its default and bounds, the three placements, the three failure kinds and their parameters (retry_after, duration, bytes, format, at), the Retry-After forms, the configured hang, concurrent-hang and drop-byte limits, the /inspect JSON shape, and the caveats that /drop through an ingress is not a true TCP reset and that proxy timeouts can cut /hang. Its curl examples are run against a test server in the test suite.
    • GET /inspect?format=html (or a browser Accept) returns a page with an inline SVG timeline of the current period, the schedule parameters, the state in words, the next change, the window table and the failure links, and format=svg returns the same timeline as a standalone, self-contained SVG. An outage that wraps over a period boundary is drawn as two dashed segments, a tail from the left edge and a head to the right edge. The page is server-rendered from escaped html/template templates, with no script and no external asset.
    • A multi-stage Dockerfile builds a static, non-root scratch image of flap, and the charts/flap Helm chart deploys two replicas with a PodDisruptionBudget, node spread, /healthz and /readyz probes, a read-only security context, a preStop sleep matching the drain delay and a TLS ingress for flap.sarak.sh whose proxy timeout is checked against FLAP_MAX_HANG.
    • scripts/loadtest.sh runs the built binary with the chart's runtime settings under steady requests plus the maximum concurrent hangs, records idle and peak resident memory against the budget (16 MiB idle, 32 MiB loaded, measured on Linux) and exits non-zero when one is missed, and go test ./... -run Determinism starts two real server processes and compares their /inspect?at= bodies byte for byte, also after restarting one. docs/loadtest.md records the Linux numbers measured with Apple's container CLI (9.4 MiB idle, 20.4 MiB loaded, so the budget is met and Go stays) and the levers tried (GOMEMLIMIT, GOGC, FLAP_MAX_HANGS); cmd/loadtest takes -gomemlimit and -gogc to try them.
    • GET / serves an explorer front page with one input for every schedule parameter, generated from the parameter table, that fetches /inspect as the values change and shows the state, next change, timeline, window count, achieved availability, an inline error for rejected values and copyable status, hang and drop links. It is a single embedded page with vanilla JavaScript, no framework, no build step and no schedule logic of its own, and a content security policy limits it to its own script, style and same-origin requests.
    • charts/flap/values-saraksh.yaml holds the saraksh deployment values with the open registry path and pull secret marked and defaulted, docs/deploy.md is the install, DNS and TLS, rollback and what-remains runbook for the live install, and scripts/verify-deploy.sh checks a deployment read-only for /healthz with a valid certificate chain, at least two ready replicas and identical /inspect windows across repeated calls.
    • Every pull request runs gofmt, go vet, go test -race, helm lint --strict, helm template, shellcheck scripts/*.sh and the changelog check in Forgejo Actions on ubuntu-latest.
    • Every push to main publishes the image sarak.sh/mikluko/flap as main-<sha>-<unix time>, built with ko for linux/amd64 and linux/arm64. A push whose newest CHANGELOG.md entry names an untagged version also pushes the image as that version and latest, pushes the chart to oci://sarak.sh/mikluko/charts/flap with the same version and appVersion, and creates the tag and the release. The workflow logs in to the registry with an OIDC token, so no registry secret is needed.
    • The README now covers running the service, its configuration, the endpoints, development commands and the release process, including the secrets to set and how to rehearse a release.
    • The saraksh values render an Ingress of class traefik for flap.sarak.sh with sarak.sh/dns: "true" (external-dns creates the DNS record), cert-manager.io/cluster-issuer: letsencrypt (cert-manager issues the certificate into the TLS Secret) and TLS for the host, and leave out the ingress-nginx timeout annotations that Traefik ignores. docs/deploy.md describes the cluster's ingress, DNS and certificate conventions, drops the manual DNS and TLS steps, and says where the proxy timeout for held /hang responses lives on Traefik, and scripts/check-chart.sh asserts the rendered Ingress.
    Downloads