Skip to content

feat(validation): independent validation that certifies items into validated knowledge - #39

Merged
JulioMCruz merged 1 commit into
mainfrom
feat/independent-validation
Jun 26, 2026
Merged

feat(validation): independent validation that certifies items into validated knowledge#39
JulioMCruz merged 1 commit into
mainfrom
feat/independent-validation

Conversation

@JulioMCruz

Copy link
Copy Markdown
Contributor

Deepens the validated-knowledge rail: makes "validated" mean independently validated, and makes validation actually produce validated knowledge.

The gaps this closes

  1. Validation never reached the items. The provider flow (claim → fulfill → validate) updated knowledge_requests but never touched research_items, so the only path to a validation_status=validated item was a manual admin action. The validated_only/enterprise tier had nothing provider-validated to return.
  2. No independence. validate only 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 to validated only when it clears the enterprise floor (≥70); weaker items stay pending with a reason (a thumbs-up can’t launder a thin item). Logs a contributor_quality_events row. Mirrors /api/admin/quality.

validate route now enforces independence and certifies the fulfillment items on accept, returning { certified, certifiedCount }.

Contractllms.txt + skill manifest document 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.

…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).
@JulioMCruz
JulioMCruz merged commit f3efed1 into main Jun 26, 2026
1 check passed
@JulioMCruz
JulioMCruz deleted the feat/independent-validation branch June 26, 2026 23:47
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