Skip to content

feat(agent): add decision snapshot provenance fields - #474

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
Crystora:feat/282-decision-snapshot-provenance
Jun 8, 2026
Merged

feat(agent): add decision snapshot provenance fields#474
JSONbored merged 2 commits into
JSONbored:mainfrom
Crystora:feat/282-decision-snapshot-provenance

Conversation

@Crystora

@Crystora Crystora commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add public-safe provenance to the recommendation snapshot envelope: confidence, freshness, public-safe source identifiers, scoring-model and repo-signal snapshot ids, plus explicit evidence gaps.
  • Derive it from the action's existing private recommendationEvidence and the durable context snapshot, so every decision-run and local-branch recommendation path carries provenance without new routes, schema, or storage.
  • Represent missing/stale evidence explicitly via evidenceGaps / evidenceComplete, and fail closed (low confidence, unknown freshness, recorded gap) on absent or malformed evidence.
  • Keep the public/private boundary structural: raw evidence summaries, warnings, and assumptions stay in the action payload and are never copied into the public envelope.

Closes #282

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked an issue, or this is small enough that the summary explains why an issue is not needed.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally; global coverage stays at or above 97% for lines, statements, functions, and branches (aim for 98%+ branch coverage locally so CI variance does not fail near the threshold)
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

npm run test:ci passes end to end. Coverage from npm run test:coverage: statements 99.08%, branches 97.01%, functions 98.5%, lines 99.7% (all ≥ 97%); the changed src/services/recommendation-snapshots.ts is 100% statements and 100% branches (41/41, 47/47). npm audit reports 0 vulnerabilities. New tests cover fresh, stale, missing, malformed, and public/private serialization cases.

If any required check was skipped, explain why:

  • None. The full npm run test:ci gate was run locally and passed.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics. Provenance exposes only structured identifiers/enums; a test asserts the serialized envelope excludes raw evidence summaries, warnings, and assumptions.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. N/A — no auth/cookie/CORS/GitHub App/Cloudflare/session changes.
  • API/OpenAPI/MCP behavior is updated and tested where needed. N/A — provenance rides the existing freeform action payload; no contract change (ui:openapi:check is clean).
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks. N/A — no UI changes.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository. N/A — no visible UI, frontend, docs, or extension changes.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs. N/A — no docs/changelog changes.

UI Evidence

Not applicable — this change has no visible UI, frontend, docs, or extension surface. It adds public-safe provenance metadata to the recommendation snapshot envelope (backend service only).

Notes

  • No database migration: provenance is derived at envelope-build time from data already present on the action's evidence and the durable context snapshot.
  • Wired through the real runtime recommendation paths via attachRecommendationSnapshots (decision runs and local-branch runs in agent-orchestrator.ts), not a test-only helper.
  • Private/authenticated provenance distinction is preserved structurally: the raw recommendationEvidence remains in the action payload and is never serialized into the public envelope.
  • Files changed: src/services/recommendation-snapshots.ts, test/unit/recommendation-snapshots.test.ts (+295 / −2).

@Crystora
Crystora requested a review from JSONbored as a code owner June 8, 2026 11:13
@dosubot dosubot Bot added the size:L label Jun 8, 2026
@github-actions github-actions Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 8, 2026
@ghost

ghost commented Jun 8, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #474 is no longer open. No action.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 8, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@bittoby this is ready from my side.

A few notes:

  • The provenance fields are wired into the existing recommendation snapshot envelope rather than living as a test-only helper.
  • Missing/stale evidence fails closed into explicit provenance gaps, which is the right public/private boundary for this surface.
  • The tests cover fresh, stale, missing, malformed, and serialization-safety cases.

No code changes requested.

@JSONbored
JSONbored merged commit d69ec98 into JSONbored:main Jun 8, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 8, 2026
@JSONbored JSONbored added gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. and removed gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

feat(agent): add decision snapshot provenance fields

2 participants