omnisignalcache

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package omnisignalcache implements omnisignal.Provider over aha-studio's local SQLite cache (*sync.DB), registered as "aha-studio" -- distinct from aha-studio/omnisignal's live-API "aha" provider. Mirrors the same live/cached split already established by aha-go/omniroadmap ("aha") vs. aha-studio/omniroadmap ("aha-studio"), for the same reason: reading from the cache needs no Aha API traffic, so it can afford per-idea enrichment (voter/customer-org resolution) that would be an unacceptable N+1 cost against the live API.

Fidelity caveats vs. the live "aha" provider:

  • Only id/reference_num/name/status/description/votes/created_at/ updated_at are cached per idea today (see sync/sync.go's ideaToMap) -- no categories, workflow status detail, or linked feature, so Status is always signal.StatusNew, Domain is always the flat "product" default, and Entities is always empty. Closing this gap is tracked separately, not part of this provider.
  • Voter/customer-org tiering requires idea_organizations to have been synced with SyncOptions.Detailed=true (only the single-GET response carries email_domains) -- see sync/sync.go's syncIdeaOrganizations. Without it, signal.MetaCustomers is empty and aha_voter_org_count is 0.
  • No raw voter names/emails ever land in Signal.Metadata -- only resolved typed refs and aggregates (aha_voter_domain_histogram).

Index

Constants

View Source
const (
	// OptDBPath is the path to the aha-studio SQLite cache, used by the
	// omnisignal.Register factory (NewProviderFromConfig). Not needed when
	// constructing directly via NewProvider with an already-open *sync.DB.
	OptDBPath = "db_path"
)

Config option keys.

Variables

This section is empty.

Functions

func NewProviderFromConfig

func NewProviderFromConfig(cfg omnisignal.Config) (omnisignal.Provider, error)

NewProviderFromConfig adapts NewProvider to omnisignal's func(Config) (Provider, error) registration signature (unlike omniroadmap-core's registry, which accepts an opaque `config any` and so can take a *sync.DB directly, omnisignal.Register requires a Config-shaped factory). Opens its own *sync.DB from cfg.Options[OptDBPath]. The caller owns the returned Provider's Close(), which closes the DB this function opened.

Types

type Option

type Option func(*Provider)

Option configures a Provider.

func WithCustomerMappings

func WithCustomerMappings(m map[string]string) Option

WithCustomerMappings sets an override/fallback org-name -> customer-ref mapping, consulted when a voter's email domain doesn't resolve against any synced IdeaOrganization.email_domains. Same resolution shape the competitive provider already uses (provider/competitive/competitive.go), keyed by organization name here instead of account name.

func WithProduct

func WithProduct(product string) Option

WithProduct scopes Fetch to a single Aha product (workspace) reference. Required -- unlike omniroadmap's cache-backed provider, GetIdeas needs a product to scope its query.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements omnisignal.Provider over aha-studio's cache DB.

func NewProvider

func NewProvider(db *studiosync.DB, opts ...Option) *Provider

NewProvider wraps an opened cache DB as an omnisignal.Provider. Callers typically open the DB via sync.Open(sync.DefaultDBPath()).

func (*Provider) Capabilities

func (p *Provider) Capabilities() omnisignal.Capabilities

Capabilities returns what this provider supports. Unlike the live "aha" provider, RateLimitPerMinute doesn't apply -- there are no live API calls; the cost was already paid by whatever sync populated the cache.

func (*Provider) Close

func (p *Provider) Close() error

Close closes the underlying cache DB. If the DB was passed in via NewProvider (not opened by NewProviderFromConfig), the caller may still own its lifecycle -- Close is safe to call once either way.

func (*Provider) Fetch

func (p *Provider) Fetch(ctx context.Context, opts omnisignal.FetchOptions) ([]signal.Signal, error)

Fetch retrieves ideas from the cache as signals, enriched with voter/customer-org tiering resolved from cached idea_endorsements and idea_organizations.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider identifier.

func (*Provider) Subscribe

func (p *Provider) Subscribe(ctx context.Context, opts omnisignal.SubscribeOptions) (<-chan signal.Signal, error)

Subscribe is not supported.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL