Define class-specific transport alert policy #103

Open
nsaspy wants to merge 10 commits from fix/61-alert-policy into fix/61-retry-routing-correlation
Owner

Tracks the alert-policy acceptance of #61 as a separate bounded slice, stacked on #89.

What changed

  • add a deterministic transport alert-policy map from typed error class/scope to action, severity, recovery grace, rate class/window, and notification allowance;
  • downstream/client disconnects map to log_only / info / no notification allowance and never become provider alerts;
  • account/gateway failures map to immediate warning-level alert decisions with a 900-second account_gateway rate window and model attribution remains absent;
  • transient provider/router failures map to alert_if_unrecovered with the existing 10-second retry-correlation grace and a 60-second rate window;
  • stream protocol/integrity failures get a distinct protocol_integrity rate class with a 300-second window;
  • correlated retry recovery emits explicit suppress_recovered evidence linked to the original failed event;
  • add serialized append-only alert-decisions.jsonl projections containing safe policy metadata only—no request SHA and no router-attempt provider details;
  • wire the live completed transport-error/recovery correlation path through AlertPolicyActor with policy failures swallowed so capture/routing/recovery/forwarding cannot be blocked;
  • record the verified policy and boundaries in Org-roam and the project Prolog KB.

Downstream client disconnects intentionally bypass the completed-request correlation path established in #88; their deterministic policy is log_only and the typed client error remains in errors.jsonl. No external notification transport exists in this slice.

RED evidence

API contract head 3c3bf00eac16655c9307d961fee00ef21ef581c3: 127 tests ran. Exactly six new alert-policy tests errored because llm_log.alert_policy did not yet exist; every inherited #86-#89 contract stayed green. This is an executed missing-module RED, not a behavioral RED.

Behavioral wiring head bfae8fb3e864c71e21aa5e7f063b6e77c7eff07e: 128 tests ran. All six policy API tests passed and exactly one new live test failed because alert-decisions.jsonl was not produced. The existing suite remained green, isolating live wiring from policy semantics.

GREEN evidence

Live wiring head a9a8134cff36e4322f0bbf99d26d6fffa14c16a2 passed both exact-head workflows:

  • Analytics API run 71: full Python regression + adversarial analytics success;
  • Quota telemetry run 76: full Python regression + delivered package build success.

Final exact head 935fc1954f1b85cff1ea4579a8886e66c1df3add passed after Prolog/Org knowledge promotion:

  • Analytics API run 77: success;
  • Quota telemetry exact-head run 82: success, including delivered package build.

Boundary

This is a policy/decision stream, not a notification dispatcher. It does not send email, Discord, webhook, pager, desktop, or other external notifications and it does not own persistent notification-rate counters. A future dispatcher may enforce the emitted grace/rate policy. Model/structured-output anomaly detection remains separate #58 work.

No merge is performed here.

Tracks the alert-policy acceptance of #61 as a separate bounded slice, stacked on #89. ## What changed - add a deterministic transport alert-policy map from typed error class/scope to action, severity, recovery grace, rate class/window, and notification allowance; - downstream/client disconnects map to `log_only` / `info` / no notification allowance and never become provider alerts; - account/gateway failures map to immediate warning-level `alert` decisions with a 900-second `account_gateway` rate window and model attribution remains absent; - transient provider/router failures map to `alert_if_unrecovered` with the existing 10-second retry-correlation grace and a 60-second rate window; - stream protocol/integrity failures get a distinct `protocol_integrity` rate class with a 300-second window; - correlated retry recovery emits explicit `suppress_recovered` evidence linked to the original failed event; - add serialized append-only `alert-decisions.jsonl` projections containing safe policy metadata only—no request SHA and no router-attempt provider details; - wire the live completed transport-error/recovery correlation path through `AlertPolicyActor` with policy failures swallowed so capture/routing/recovery/forwarding cannot be blocked; - record the verified policy and boundaries in Org-roam and the project Prolog KB. Downstream client disconnects intentionally bypass the completed-request correlation path established in #88; their deterministic policy is `log_only` and the typed client error remains in `errors.jsonl`. No external notification transport exists in this slice. ## RED evidence API contract head `3c3bf00eac16655c9307d961fee00ef21ef581c3`: 127 tests ran. Exactly six new alert-policy tests errored because `llm_log.alert_policy` did not yet exist; every inherited #86-#89 contract stayed green. This is an executed missing-module RED, not a behavioral RED. Behavioral wiring head `bfae8fb3e864c71e21aa5e7f063b6e77c7eff07e`: 128 tests ran. All six policy API tests passed and exactly one new live test failed because `alert-decisions.jsonl` was not produced. The existing suite remained green, isolating live wiring from policy semantics. ## GREEN evidence Live wiring head `a9a8134cff36e4322f0bbf99d26d6fffa14c16a2` passed both exact-head workflows: - Analytics API run 71: full Python regression + adversarial analytics success; - Quota telemetry run 76: full Python regression + delivered package build success. Final exact head `935fc1954f1b85cff1ea4579a8886e66c1df3add` passed after Prolog/Org knowledge promotion: - Analytics API run 77: success; - Quota telemetry exact-head run 82: success, including delivered package build. ## Boundary This is a policy/decision stream, not a notification dispatcher. It does not send email, Discord, webhook, pager, desktop, or other external notifications and it does not own persistent notification-rate counters. A future dispatcher may enforce the emitted grace/rate policy. Model/structured-output anomaly detection remains separate #58 work. No merge is performed here.
Some checks failed
Quota telemetry exact-head contract / quota-contracts (pull_request) Failing after 9s
Analytics API / test (pull_request) Failing after 17s
Analytics API / package (pull_request) Has been skipped
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/61-alert-policy:fix/61-alert-policy
git switch fix/61-alert-policy

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch fix/61-retry-routing-correlation
git merge --no-ff fix/61-alert-policy
git switch fix/61-alert-policy
git rebase fix/61-retry-routing-correlation
git switch fix/61-retry-routing-correlation
git merge --ff-only fix/61-alert-policy
git switch fix/61-alert-policy
git rebase fix/61-retry-routing-correlation
git switch fix/61-retry-routing-correlation
git merge --no-ff fix/61-alert-policy
git switch fix/61-retry-routing-correlation
git merge --squash fix/61-alert-policy
git switch fix/61-retry-routing-correlation
git merge --ff-only fix/61-alert-policy
git switch fix/61-retry-routing-correlation
git merge fix/61-alert-policy
git push origin fix/61-retry-routing-correlation
Sign in to join this conversation.
No description provided.