HarperFast / HarperFast/harper

Skip license enforcement for model-* metrics in dev mode (no installed license)

Open
#787 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

## Problem
PR #779 starts emitting `model-embed`, `model-embed-tokens`, `model-generate`, and `model-generate-tokens` into `hdb_raw_analytics` → `hdb_analytics`. Phases 2 + 3 will extend the central-manager Plan schema and signed license blob with embed/generate budgets and add `fabric-ai-level-1..3` SKUs that gate `embed()` calls on those budgets.

Once enforcement is in place, a developer running harper-pro locally without an installed license could see embed/generate calls 429'd against a default trial budget — which would be a terrible dev experience.

## Proposal
Treat dev mode the same way the existing reads/writes enforcement does:
- When `hm.devMode === true` OR when no license is installed, skip rate-limit checks for `model-*` metrics in the license reporting path
- Forensic rows still go to `hdb_model_calls` (audit/observability is not the issue)
- Aggregate metrics still emit to `hdb_raw_analytics` (no reason to muddy the data path)

## Verification
- [ ] Boot harper-pro in dev mode with no license. Call `scope.models.embed()` 10,000 times in a tight loop. Confirm no 429.
- [ ] Boot harper-pro with a paid `fabric-ai-level-1` license + budget of 1,000 embeds. Confirm the 1,001st call 429s.
- [ ] Confirm `hdb_model_calls` rows land in both cases.

## Why this is its own issue
Easy to forget when wiring up the enforcement in Phase 2. Tracking it separately so it doesn't get lost in the larger CM-side PR.

## Related
- PR #779 (Phase 1 model analytics emission)
- Pending: CM Plan.planLimits extension + signed license blob (Phase 2)
- Pending: fabric-ai-level-1..3 SKUs (Phase 3)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.