Skip to content

feat(enterprise): add api key management#67

Closed
Gracker wants to merge 1 commit intofeature/enterprise-multi-tenant-oidc-onboardingfrom
feature/enterprise-multi-tenant-api-key-management
Closed

feat(enterprise): add api key management#67
Gracker wants to merge 1 commit intofeature/enterprise-multi-tenant-oidc-onboardingfrom
feature/enterprise-multi-tenant-api-key-management

Conversation

@Gracker
Copy link
Copy Markdown
Owner

@Gracker Gracker commented May 8, 2026

Summary

  • add api_keys enterprise schema migration with scoped lookup/expiry indexes
  • add managed API key service and /api/auth/api-keys create/list/revoke endpoints
  • authenticate managed API keys via bearer or x-api-key, enforcing revocation, expiry, and stored scopes
  • share enterprise audit helpers and record API key create/revoke audit events
  • mark README §0.2.3 complete

Scope note

  • API key creation is limited to the authenticated RequestContext workspace, or tenant-wide with workspaceId: null.
  • Full RBAC matrix and cross-workspace/org-admin policy expansion remains §0.2.4.

Verification

  • cd backend && npx jest src/services/__tests__/enterpriseSchema.test.ts src/routes/__tests__/enterpriseApiKeyRoutes.test.ts src/services/__tests__/enterpriseOidcClient.test.ts src/routes/__tests__/enterpriseAuthRoutes.test.ts src/middleware/__tests__/auth.test.ts src/routes/__tests__/requestContextRouteCoverage.test.ts src/routes/__tests__/ownerGuardRoutes.test.ts src/services/__tests__/sessionPersistenceService.test.ts --runInBand
  • cd backend && npm run typecheck
  • cd backend && npm run test:scene-trace-regression
  • npm run verify:pr

mr-torto pushed a commit to mr-torto/SmartPerfetto that referenced this pull request May 8, 2026
…racker#63, Gracker#67, Gracker#76, Gracker#87, Gracker#99)

DomainSkillEvalContract is the gate for every domain Skill change.
Five facets bound together:
- SkillEvalCase[] mapping caseId -> trace path + skill under test
- assertions: Record<caseId, SkillEvalAssertion[]> using JSONPath-style
  paths into the Skill output (Spark Gracker#99)
- SubAgentSpec[] for domain expert sub-agent expansion (Spark Gracker#87)
- SkillEvalRunResult[] capturing pass/fail/flaky/skipped status with
  per-assertion failure traces
- importers[] with required flag for atrace, simpleperf, bpftrace,
  macrobenchmark hooks (Spark Gracker#61, Gracker#63, Gracker#67, Gracker#76)

The harness runner (npm run test:scene-trace-regression) will become
contract-driven in a follow-up so the canonical six traces and their
assertions live in a single source of truth.

Plan: docs/superpowers/spark/plans/18-domain-skill-eval-harness.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mr-torto pushed a commit to mr-torto/SmartPerfetto that referenced this pull request May 8, 2026
Land Plan 50 (Spark Gracker#34, Gracker#67, Gracker#105, #150, #176, #177, #178) — durable
App/Device/Build/CUJ baseline store with diff and CI regression gate.

Reuse boundary: `TraceSummaryBaselineRef` (Plan 02) and
`TraceSummaryMetric.metricId` namespace already exist. Plan 50 does not
re-define those — `BaselineRecord extends TraceSummaryBaselineRef` so
consumers see one shape, and metric ids stay in the same namespace.
Plan 50's contribution is durable persistence + cross-baseline diff +
CI gate semantics on top of Plan 02.

Types added to `backend/src/types/sparkContracts.ts`:

- `BaselineMetric` — per-metric aggregate (median/p95/p99/max +
  sampleCount). Carries `unsupportedReason` so devices that cannot
  collect a metric (e.g. GPU render stages on certain SoCs) don't
  silently zero-fill.
- `BaselineRecord` — extends SparkProvenance + TraceSummaryBaselineRef.
  Adds `key` (PerfBaselineKey), `status` (CurationStatus), and
  `redactionState` ('raw'|'partial'|'redacted'). Service layer
  enforces sampleCount >= 3 for status='published'; the schema does
  not so older snapshots remain readable.
- `BaselineDiffDelta` — per-metric delta with optional numeric fields
  + `severity: ... | 'unsupported'`. `unsupportedReason` is required
  when severity is 'unsupported' (missing on baseline, sample below 3,
  divide-by-zero, etc.).
- `BaselineDiffArtifact` — diff between two baselines or
  trace-vs-baseline.
- `RegressionGateResult` — CI gate output. `diff` is **optional** when
  status is 'skipped'; the gate must instead record `skipReason` so
  triagers can audit why the gate did not run.
- `BaselineStoreContract` — service surface with `baselines[]` and
  optional `matrix[]` for SoC/OEM cross-baseline comparison.

Seven new test cases in `__tests__/sparkContracts.test.ts` cover the
reuse boundary (BaselineRecord populates inherited fields), the
unsupported-data paths (metric and delta both), and the skipped-gate
contract. Test count: 50 (was 43).

Test tier: contract / type-only. `npx tsc --noEmit` clean,
sparkContracts.test.ts passes 50/50. Trace regression intentionally
not run per the tiered policy in commit d8529e1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Gracker
Copy link
Copy Markdown
Owner Author

Gracker commented May 9, 2026

已通过 commit 67856ec (merge) + 023a84a (frontend rebuild) 合入 main,关闭此 PR。

@Gracker Gracker closed this May 9, 2026
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