Skip to content

test(docs): verify branch-analysis and scoreability examples against real schemas - #3065

Merged
loopover-orb[bot] merged 1 commit into
mainfrom
feat/docs-drift-schema-examples
Jul 4, 2026
Merged

test(docs): verify branch-analysis and scoreability examples against real schemas#3065
loopover-orb[bot] merged 1 commit into
mainfrom
feat/docs-drift-schema-examples

Conversation

@JSONbored

@JSONbored JSONbored commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • docs.branch-analysis.tsx and docs.scoreability.tsx each embed a hand-typed JSON example that's supposed to mirror a real backing schema/type (localBranchAnalysisSchema in src/api/routes.ts, ScorePreviewResult in src/scoring/preview.ts). Both drifted before and were only caught by a manual audit (PR docs(gittensory-ui): fix stale website docs and add a CI docs-drift check #3059), with nothing stopping it happening again.
  • Exports localBranchAnalysisSchema from src/api/routes.ts (one-line export addition, no logic change) and adds test/unit/docs-examples-schema.test.ts, which reads the live docs page source at test time, extracts the embedded JSON example via brace-depth counting, and validates it against the real schema/type. A future hand-edit that drifts either example now fails a test immediately.
  • Fixes feat(ci): verify docs JSON examples against their real Zod schemas #3045.

Notes on scope

This PR originally also fixed both docs pages' examples directly, since when I first branched, they hadn't been fixed yet. Sibling PR #3059 (fixes #3047) independently fixed the same two pages as part of its own broader docs audit and merged first — I rebased this branch on top of it, and the docs-page changes became a clean no-op (main's content already satisfies this test). The diff is now exactly two files: the export keyword and the new test.

Scope

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage — full unsharded run, 8471 passed / 7 skipped across 420 files, exit 0 (via npm run test:ci)
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check — no diff
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate — 0 vulnerabilities
  • New/changed behavior has tests: test/unit/docs-examples-schema.test.ts's two cases are the new coverage — a full schema parse for branch-analysis, and top-level-key/enum-membership checks for the deliberately-trimmed scoreability example.

Safety

  • No secrets, wallets, hotkeys, trust scores, or private maintainer evidence.
  • N/A — no auth/cookie/CORS/session changes.
  • N/A — no OpenAPI/MCP behavior change; export only changes what's importable, confirmed via ui:openapi:check producing no diff.
  • N/A — no UI component/state changes.
  • N/A — docs content itself already correct on main via docs(gittensory-ui): fix stale website docs and add a CI docs-drift check #3059; this PR only adds the regression test.

UI Evidence

N/A — test-only change plus a one-line export keyword in a backend file. No visual delta.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gittensory-ui 62b746d Commit Preview URL

Branch Preview URL
Jul 04 2026, 11:20 AM

@superagent-security

Copy link
Copy Markdown
Contributor

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

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 4, 2026
@loopover-orb

loopover-orb Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Tip

🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩

✅ Gittensory review result - approve/merge recommended

Review updated: 2026-07-04 11:47:51 UTC

2 files · 1 AI reviewer · no blockers · readiness 100/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
The AI review returned non-blocking notes for this change but did not include a separate narrative summary. Review the nits below before deciding this PR.

Nits — 5 non-blocking
  • nit: `test/unit/docs-examples-schema.test.ts:18` keeps `SCORE_PREVIEW_RESULT_TOP_LEVEL_KEYS` as an untyped hand-maintained set, so a future `ScorePreviewResult` rename/removal can leave this test green while the guard is stale.
  • nit: `test/unit/docs-examples-schema.test.ts:136` only requires `scenarioPreviews.length > 0`, but the docs text says the response computes exactly seven named scenarios, so this misses the six-vs-seven regression called out in the PR description.
  • nit: `test/unit/docs-examples-schema.test.ts:139` validates scenario names but not uniqueness, so a duplicated valid scenario name could still pass while one required scenario is absent.
  • At `test/unit/docs-examples-schema.test.ts:136`, assert the sorted scenario names equal the full `SCORE_SCENARIO_PREVIEW_NAMES` set so the test catches missing or duplicate scenarios, not just invalid names.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #3045
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 59 registered-repo PR(s), 50 merged, 454 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 59 PR(s), 454 issue(s).
Gate result ✅ Passing No configured blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 59 PR(s), 454 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • No action.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

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

  • Re-run Gittensory review

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.08%. Comparing base (8674297) to head (6fc0898).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3065   +/-   ##
=======================================
  Coverage   96.08%   96.08%           
=======================================
  Files         264      264           
  Lines       29036    29036           
  Branches    10576    10576           
=======================================
  Hits        27899    27899           
  Misses        493      493           
  Partials      644      644           
Files with missing lines Coverage Δ
src/api/routes.ts 94.70% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…real schemas

Export localBranchAnalysisSchema from src/api/routes.ts and add a test that
reads the live docs.branch-analysis.tsx and docs.scoreability.tsx source at
test time, extracts their embedded JSON examples via brace-depth counting,
and validates them against the real backing schema/type. Also corrects both
docs examples, which still had the pre-fix drifted shapes (nested repo/refs
object, linked_issues snake_case, and a fabricated risk_adjusted_priority
field) against the current strict Zod schema and ScorePreviewResult type.
@JSONbored
JSONbored force-pushed the feat/docs-drift-schema-examples branch from 62b746d to 6fc0898 Compare July 4, 2026 11:43

@loopover-orb loopover-orb Bot 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.

Gittensory approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit cc71c47 into main Jul 4, 2026
10 checks passed
@loopover-orb
loopover-orb Bot deleted the feat/docs-drift-schema-examples branch July 4, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

1 participant