Skip to content

lisa/fix-prompt-to-use-fewer-labels#422

Open
ccf-lisa[bot] wants to merge 4 commits into
mainfrom
lisa/fix-prompt-to-use-fewer-labels
Open

lisa/fix-prompt-to-use-fewer-labels#422
ccf-lisa[bot] wants to merge 4 commits into
mainfrom
lisa/fix-prompt-to-use-fewer-labels

Conversation

@ccf-lisa

@ccf-lisa ccf-lisa Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

automated implementation by lisa.

@gusfcarvalho gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Findings inline. Build + unit tests pass locally, gofmt clean, CI green (unit/lint/check-diff). The proposed-filter-subset design is sound and well-tested on the main path; two issues to address before merge.

Inline:

  • Mediumdashboard_suggestions filter-labels unique index is dropped + recreated (non-CONCURRENTLY) on every boot, unlike its idempotent sibling. Exclusive lock + uniqueness gap each startup. (migrator.go + test-migrator mirror.)
  • Medium — empty-model proposed_filter_labels fallback degenerates to {_policy} only, never reaching the documented {_policy, provider, type} default; uncovered by tests. (+ a minor double-counted metric.)

Out-of-scope observation (Low, no change requested): the pre-existing idx_dashboard_suggestions_unique_pending (keyed on label_set_hash) is untouched and now coexists with the new subset-keyed index. Two pending suggestions for the same control + same evidence label-set but different proposed subsets would be silently rejected by the old index (OnConflict DoNothing → counted Excluded), dropping the lower-confidence one. Rare since evidence→subset is deterministic, but worth a conscious decision on whether the old index should stay.

Comment thread internal/service/migrator.go Outdated
Comment thread internal/tests/migrate.go Outdated
Comment thread internal/service/relational/suggestions/validation.go

@gusfcarvalho gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All pass-1 findings addressed in b0ffab5 and verified:

  • Medium (idempotent index): DROP removed; both internal/service/migrator.go and internal/tests/migrate.go now use CREATE UNIQUE INDEX IF NOT EXISTS — no more every-boot rebuild / uniqueness gap.
  • Medium (fallback subset): validateProposedFilterLabels now seeds the empty-model case from defaultFilterLabelSubset(evidence) before re-injecting _policy, so it yields {_policy, provider, type} instead of {_policy} only; the double-counted fallback_filter_labels metric is gone. New test TestValidateMappingsEmptyFilterLabelsUseDefaultSubset locks in both behaviors.

Local go build ./..., package unit tests, and gofmt clean; CI check-diff/lint/unit-tests green (integration still running, as in round 1). The out-of-scope Low (old label_set_hash index coexisting with the new subset index) was a non-blocking observation. LGTM.

@ccf-lisa

ccf-lisa Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

PR approved. Marking as ready for e2e.

@gusfcarvalho gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocker found in runtime testing: the new proposed_filter_labels output schema uses a schema-valued additionalProperties (open-ended map), which Anthropic's strict structured-output mode rejects with a 400 — every cell fails, so the feature produces zero suggestions. Inline comment has the error and a concrete array-of-{key,value} fix. This needs to land before merge.

Comment thread internal/service/relational/suggestions/prompt.go Outdated
@ccf-lisa ccf-lisa Bot removed the ready-for-e2e label Jun 16, 2026

@gusfcarvalho gusfcarvalho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocker fixed and verified in cf3f8db. proposed_filter_labels is now a strict array of {key, value} objects (additionalProperties: false, required: [key, value]), so Anthropic structured-output no longer 400s. RawMapping.ProposedFilterLabels is a ProposedFilterLabels named map with a custom UnmarshalJSON accepting both the pair-array and legacy object form, leaving validateProposedFilterLabels semantics untouched; prompt prose + golden updated. Good new tests: recursive strict-schema guard (every object has additionalProperties:false), array-vs-legacy equivalence, and duplicate-key-last-wins.

Verified: go build ./..., package unit tests, and gofmt clean; CI check-diff/lint/unit-tests green (integration running, as in prior rounds). All prior findings (two round-1 Mediums + this Blocker) addressed. LGTM.

@ccf-lisa

ccf-lisa Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

PR approved. Marking as ready for e2e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant