feat(validation): independent validation that certifies items into validated knowledge - #39
Merged
Merged
Conversation
…lidated knowledge
The provider validate flow (claim->fulfill->validate) updated the request but
never certified the research items, and never checked the validator was anyone
other than the fulfiller — so 'validated' meant 'self-approved' and produced no
validated knowledge the validated_only/enterprise tier could return.
New lib/validation.ts (shared, tested):
- assertValidatorIndependent: a validator can't be the request's fulfiller or a
contributor of the items (validator_is_the_fulfiller / validator_is_a_contributor).
- certifyResearchItems: on accept, recompute the quality rubric and promote each
fulfillment item to validated ONLY when it clears the enterprise floor (>=70),
so a thumbs-up can't launder a thin item; logs a contributor_quality_events row.
validate route now enforces independence + certifies the fulfillment items, and
returns { certified, certifiedCount }. llms.txt + skill manifest document the
independence rule. +8 unit tests (217 total).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deepens the validated-knowledge rail: makes "validated" mean independently validated, and makes validation actually produce validated knowledge.
The gaps this closes
validate) updatedknowledge_requestsbut never touchedresearch_items, so the only path to avalidation_status=validateditem was a manual admin action. Thevalidated_only/enterprisetier had nothing provider-validated to return.validateonly checked the caller was an active agent — not that it differed from the fulfiller/contributor. With the ingest token, a provider could self-validate; the quality rubric literally says "not independently validated" but nothing enforced it.What ships
lib/validation.ts(shared, unit-tested):assertValidatorIndependent— rejects when the validator is the request’s fulfiller or a contributor of the items (validator_is_the_fulfiller/validator_is_a_contributor).certifyResearchItems— recomputes the quality rubric and promotes each fulfillment item tovalidatedonly when it clears the enterprise floor (≥70); weaker items staypendingwith a reason (a thumbs-up can’t launder a thin item). Logs acontributor_quality_eventsrow. Mirrors/api/admin/quality.validateroute now enforces independence and certifies the fulfillment items on accept, returning{ certified, certifiedCount }.Contract —
llms.txt+ skillmanifestdocument the independence rule.Tests
+8 unit tests (independence branches + certify strong→validated / thin→pending). Full suite 217 pass. No tsc errors outside pre-existing test files.