-
Notifications
You must be signed in to change notification settings - Fork 0
Surface alignment, memory persistence, progressive delivery #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3ed4e99
docs: update CLAUDE.md for Surface, progressive delivery, and persist…
yairfalse 0d0961f
fix: record outcome on manual promote/rollback, clarify pipeline diagram
yairfalse 0e6bf08
fix: replace bare raise with error tuple in Occurrence.build/2
yairfalse 3295665
feat: create SYKLI TargetBehaviour with callback specs
yairfalse 15a605f
feat: add MCP lifecycle handling and fix CLI serve SIGTERM
yairfalse bc1c81c
docs: add cluster config keys to runtime.exs and CLAUDE.md
yairfalse c1c7af2
feat: add HTTP API authentication plug
yairfalse 4509bcb
feat: start DistributedSupervisor when clustering is enabled
yairfalse db891c6
fix: wire up dead Prometheus metrics with telemetry emissions
yairfalse ca42ee5
fix: cache applied manifests so drift detection can find last-applied…
yairfalse 2398736
refactor: extract Strategy.Canary and Strategy.BlueGreen from inline …
yairfalse 5ef1ed4
refactor: replace Process.sleep in tests with proper synchronization
yairfalse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| defmodule Nopea.API.AuthPlug do | ||
| @moduledoc """ | ||
| Plug that authenticates API requests using an `x-api-key` header. | ||
|
|
||
| ## Behaviour | ||
|
|
||
| - If no API key is configured (nil), all requests pass through (dev mode). | ||
| - If a key is configured, requests must include a matching `x-api-key` header. | ||
| - `/health` and `/ready` paths are always allowed without authentication. | ||
| - Returns 401 Unauthorized for missing or invalid keys. | ||
| """ | ||
|
|
||
| @behaviour Plug | ||
|
|
||
| import Plug.Conn | ||
|
|
||
| @skip_paths ["/health", "/ready"] | ||
|
|
||
| @impl true | ||
| @spec init(keyword()) :: keyword() | ||
| def init(opts), do: opts | ||
|
|
||
| @impl true | ||
| @spec call(Plug.Conn.t(), keyword()) :: Plug.Conn.t() | ||
| def call(conn, _opts) do | ||
| if skip_auth?(conn) do | ||
| conn | ||
| else | ||
| case configured_key() do | ||
| nil -> | ||
| conn | ||
|
|
||
| expected_key -> | ||
| verify_key(conn, expected_key) | ||
| end | ||
| end | ||
| end | ||
|
|
||
| defp skip_auth?(conn) do | ||
| conn.request_path in @skip_paths | ||
| end | ||
|
|
||
| defp configured_key do | ||
| Application.get_env(:nopea, :api_key) | ||
| end | ||
|
|
||
| defp verify_key(conn, expected_key) do | ||
| case get_req_header(conn, "x-api-key") do | ||
| [^expected_key] -> | ||
| conn | ||
|
|
||
| _ -> | ||
| conn | ||
| |> put_resp_content_type("application/json") | ||
| |> send_resp(401, Jason.encode!(%{error: "unauthorized"})) | ||
| |> halt() | ||
| end | ||
| end | ||
| end |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section says terminal phases mean the Monitor “stops and records outcome”. In
Nopea.Progressive.Monitor,record_outcome/1runs on the polling path and timeout, but not on the manualpromote/rollbackcall paths (they stop without recording). Either adjust the docs to reflect the current behavior or update the implementation so manual promote/rollback also records the outcome before stopping.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch — fixed in 0d0961f. Added
record_outcome(rollout)to both the promote and rollbackhandle_callpaths before stopping. Memory and Cache now get updated on manual intervention, same as the poll/timeout paths.