mirror of
https://github.com/hanzoai/insights.git
synced 2026-10-30 16:15:31 +00:00
The tree was a debranded snapshot of upstream taken around 2026-02-20, and upstream has moved about five months since. This replaces it with upstream master, mechanically re-derived: bin/debrand does the rename, and the pipeline and squashed migrations are restored from the shipped tree. Not a merge. The previous import replaced the tree wholesale in a single commit, so there is no shared content history to merge against. Reproducing the rename on the new tree is what actually converges. What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints, compose files, LLM.md, and insights/migrations. The squashed initial migration is load-bearing — the live database records it by name, so upstream's ~918 individual migrations cannot come back. Nine products are dropped as unreferenced. Twenty-one more that we do not run are kept anyway because the core app still imports them; unpicking those is a refactor and does not belong in a rebase. This base does not build yet, and the reasons are not in the rename: upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against our 4.2, and the dependency manifests still name upstream packages that we republish under our own names. Those are decisions, not renames.
66 lines
2.8 KiB
TypeScript
66 lines
2.8 KiB
TypeScript
/**
|
|
* The agent-feedback handler enumerates schema fields by hand when it builds the
|
|
* `mcp feedback submitted` analytics payload, so a field added to
|
|
* `FeedbackSubmitSchema` can silently never reach the event downstream consumers
|
|
* aggregate on. This pins the scout-feedback fields (skill name / version /
|
|
* category) — the join keys for per-skill fleet-wide aggregation — to the
|
|
* `feedback_scout_*` event properties.
|
|
*/
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
import { FeedbackSubmitSchema } from '@/schema/tool-inputs'
|
|
import { submitFeedbackHandler } from '@/tools/feedback/submit'
|
|
import type { Context } from '@/tools/types'
|
|
|
|
describe('agent-feedback submit handler', () => {
|
|
it('forwards scout feedback fields into the analytics event', async () => {
|
|
const trackEvent = vi.fn().mockResolvedValue(undefined)
|
|
const context = { trackEvent } as unknown as Context
|
|
|
|
const result = await submitFeedbackHandler(context, {
|
|
summary: 'discriminator misfires on young projects',
|
|
feedback_type: 'scout',
|
|
sentiment: 'neutral',
|
|
scout_skill_name: 'signals-scout-web-analytics',
|
|
scout_skill_version: 7,
|
|
scout_category: 'discriminator_gap',
|
|
suggested_improvement: 'gate the baseline comparison on >=7 days of history',
|
|
})
|
|
|
|
expect(trackEvent).toHaveBeenCalledTimes(1)
|
|
expect(trackEvent).toHaveBeenCalledWith(
|
|
'mcp feedback submitted',
|
|
expect.objectContaining({
|
|
feedback_type: 'scout',
|
|
feedback_scout_skill_name: 'signals-scout-web-analytics',
|
|
feedback_scout_skill_version: 7,
|
|
feedback_scout_category: 'discriminator_gap',
|
|
})
|
|
)
|
|
expect(result.received).toBe(true)
|
|
})
|
|
|
|
it.each([
|
|
['scout_skill_name', { scout_skill_version: 7, scout_category: 'discriminator_gap' }],
|
|
['scout_skill_version', { scout_skill_name: 'signals-scout-web-analytics', scout_category: 'other' }],
|
|
['scout_category', { scout_skill_name: 'signals-scout-web-analytics', scout_skill_version: 7 }],
|
|
])('rejects scout feedback missing %s', (_missing, scoutFields) => {
|
|
const result = FeedbackSubmitSchema.safeParse({
|
|
summary: 'discriminator misfires on young projects',
|
|
feedback_type: 'scout',
|
|
sentiment: 'neutral',
|
|
...scoutFields,
|
|
})
|
|
expect(result.success).toBe(false)
|
|
})
|
|
|
|
it('accepts non-scout feedback without scout fields', () => {
|
|
const result = FeedbackSubmitSchema.safeParse({
|
|
summary: 'the SQL editor autocomplete is excellent',
|
|
feedback_type: 'product',
|
|
sentiment: 'positive',
|
|
})
|
|
expect(result.success).toBe(true)
|
|
})
|
|
})
|