Skip to content

feat: admissible-response hook with relay forwarding#855

Open
Lucifer0x17 wants to merge 12 commits intoimpr/admissiblefrom
feat/chance_and_router_conf
Open

feat: admissible-response hook with relay forwarding#855
Lucifer0x17 wants to merge 12 commits intoimpr/admissiblefrom
feat/chance_and_router_conf

Conversation

@Lucifer0x17
Copy link
Copy Markdown
Collaborator

@Lucifer0x17 Lucifer0x17 commented Apr 15, 2026

Summary

  • dev_cache:expected_response extracts http-reference from the admissible config and builds a forward body with reference, status-class, and event tags
  • Optional commit-hook-response flag in store config signs the forward body before relay
  • Fix parallel default in multinode_env test helper

Context

This enables the NASA route monitoring flow where gateway responses pass through admissibility checks and then get relayed to a monitor process with the http-reference (which node responded) and status-class for per-route scoring.

Config:

{
    "store": [
        {
            "ao-types": "store-module=atom,parallel=atom",
            "store-module": "hb_store_remote_node",
            "nodes": [
                {
                    "prefix": "https://node-b.arhub.asia",
                    "opts": {
                        "http-reference": "node-b"
                    }
                },
                {
                    "prefix": "https://node-a.arhub.asia",
                    "opts": {
                        "http-reference": "node-a"
                    }
                }
            ],
            "parallel": true,
            "commit-hook-response": true,
            "on": {
                "~cache@1.0": {
                    "admissible-response": [
                        {
                            "device": "relay@1.0",
                            "path": "call",
                            "method": "POST",
                            "peer": "http://localhost:9001",
                            "relay-path": "/XJywXqtCp8-50ljBShrBqGKMSPb8OAjBuPnl0KFMvRo/push"
                        }
                    ]
                }
            }
        }
    ]
}

@Lucifer0x17 Lucifer0x17 self-assigned this Apr 15, 2026
@Lucifer0x17 Lucifer0x17 added the enhancement New feature or request label Apr 15, 2026
Lightweight device that gates HTTP monitor invocations via 1-in-N probabilistic sampling. Reads `sample-rate` from the request message and rolls `rand:uniform(Rate) =:= 1`. If absent, all requests pass.
Add dev_chance.erl as a composable 1-in-N probabilistic gate using the 4-arity default handler pattern.
binary_to_integer/1 throws badarg on a non-integer path. Wrap in
try/catch and reject non-positive rates explicitly so callers get a
proper error tuple instead of a crash.
Merging of Opts happen inside `hb_http:request` which gets called after the the `multi` flow because of which the Node opts are never in Opts defaulting `http-ref` to be undefined.
Hence, Node is funnel down to `is_addmissible` to extract opts
- dev_cache:expected_response extracts `http-reference` from Base, builds a forward body with reference + status-class + event tags
- Optional commit_hook_response flag signs the forward body before relay
- Fix parallel default in multinode_env test helper
@Lucifer0x17 Lucifer0x17 force-pushed the feat/chance_and_router_conf branch from 9451fd3 to a11e66c Compare April 22, 2026 23:19
- Title-Case headers introduced over the wire because of HTTP\1
- Normalise at the transport boundary so every codec sees stable keys regardless of peer or proxy. Does not touch signed message content.
@Lucifer0x17 Lucifer0x17 force-pushed the feat/chance_and_router_conf branch from b9bfb96 to 5ce84c1 Compare April 24, 2026 03:29
SPAs served from manifests use absolute asset paths that 404 when the manifest is hit on the root domain. Redirect plain path requests for a manifest TX to its `<b32>.<host>` subdomain so the browser resolves assets correctly.
Decoder required exactly 3 colon-separated parts, crashing on real tags like `topic:`. Parse as first-colon/last-colon bounded instead.
@Lucifer0x17 Lucifer0x17 force-pushed the feat/chance_and_router_conf branch from 809a895 to 91d86c3 Compare May 4, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant