Skip to content

Add resolver connection policy layer and comprehensive test suite#618

Draft
fractlrao wants to merge 5 commits intomainfrom
resolver-updates
Draft

Add resolver connection policy layer and comprehensive test suite#618
fractlrao wants to merge 5 commits intomainfrom
resolver-updates

Conversation

@fractlrao
Copy link
Contributor

@fractlrao fractlrao commented Feb 18, 2026

Summary

  • Add a connection policy layer for resolvers with configurable timeout, retry (exponential/linear/constant backoff), and circuit breaker (closed/open/half-open state machine) policies
  • Policies are declared via @meta on resolver definitions in .al files and enforced transparently as a decorator wrapping resolver CRUD operations
  • Policies are persisted to a core module entity and refreshed from DB on a configurable timer (default 300s), so runtime policy updates take effect without restart
  • Policy defaults are configurable via config.al under resolver.connectionPolicy
  • Add comprehensive resolver test suite with 63+ tests covering GenericResolver, registry, method delegation, subscriptions, error handling, auth info, policy enforcement, and circuit breaker state transitions

Test plan

  • npm run build compiles without errors
  • npm run test — all existing and new tests pass
  • Verify resolver with @meta connection policy applies timeout/retry/circuit breaker at runtime
  • Verify policy refresh timer loads updated policies from DB

Add 63 tests across 5 test files covering custom/user-defined resolvers
(GenericResolver), resolver registry, method delegation, subscriptions,
error handling, auth info, and multi-resolver scenarios. Also add
resetResolverRegistry() for test isolation and shared test utilities.
… breaker

- Extend grammar to support @meta on resolver definitions
- Add ConnectionPolicy model, parser, enforcement engine, and PolicyResolver
  decorator that transparently wraps resolver CRUD operations
- Persist policies to a dedicated core module (agentlang.policy entity)
- Timer-based refresh loads policies from DB on a configurable interval
  (default 300s), so DB-side policy updates take effect at runtime
- Resolver factory reads policy cache dynamically on each call
- Policy defaults are configurable via config.al under resolver.connectionPolicy
- Export normalizeMetaValue from module.ts for reuse in loader
@fractlrao fractlrao marked this pull request as draft February 19, 2026 04:58
@fractlrao fractlrao marked this pull request as draft February 19, 2026 04:58
Resolver subscriptions previously ran @after workflows as the hardcoded
admin user. This introduces a SubscriptionEnvelope that wraps subscription
data with tenantId and userId, so @after workflows execute in the correct
user context. The envelope is backward compatible — raw results work as before.
Read GMAIL_TENANT_ID and GMAIL_USER_ID from env and wrap subscription
data in createSubscriptionEnvelope so @after workflows execute in the
correct user/tenant context instead of the hardcoded admin user.
Remove unused catch variables, unused `inst` declaration in queryEmail,
unused imports (vi, CircuitBreakerState, InstanceAttributes), and prefix
unused parameter with underscore.
@fractlrao fractlrao self-assigned this Feb 19, 2026
@fractlrao fractlrao marked this pull request as ready for review February 19, 2026 05:58
@fractlrao fractlrao marked this pull request as draft February 24, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant