release: policy source-of-truth wire-up + cache invalidation webhook#38
Merged
Conversation
…hboard Policy table (ADR-005, task 1.2.1)
…ask 1.2.2 + 1.2.3)
…e (task 1.3.1, 1.3.2, 1.3.3)
…DR-005, task 1.4.3)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
DashboardPolicySQLAlchemy model — read-only mirror of dashboard'sPolicytable over shared Postgresapp/policy_source.py— TTL-cached per-org policy fetcher (60s default) with HMAC-gated invalidationevaluate_with_payload_policynow resolves the active policy viaorg_idwhen no payload policy is provided; YAML fallback preserved/api/v1/internal/policy/invalidateendpoint — HMAC-signed, dashboard fires on every Policy CRUD writeArchitectural decision
Documented in ADR-005 (meta-repo
knowledge/ADR/005-policy-source-of-truth.md): precheck reads directly from dashboard's PostgresPolicytable rather than embedding policy in requests or polling HTTP. Justified by: shared DB always present, lowest latency, write-through invalidation closes the staleness window to <500ms in practice.Test plan
pytest tests/test_policy_source.py tests/test_policy_invalidate_endpoint.py tests/test_policy_engine.py— 41 tests passscripts/sandbox-e2e-test.py—policy.distinct-decisions,policy.cache-invalidation,consistency.policy-mutation(30 prechecks during 3 policy flips),security.forged-hmac,security.missing-hmacall green