Skip to content

feat(settings): define focus-manifest policy schema#339

Merged
JSONbored merged 2 commits into
JSONbored:mainfrom
Lobster-0429:feat/focus-manifest-policy-schema
Jun 3, 2026
Merged

feat(settings): define focus-manifest policy schema#339
JSONbored merged 2 commits into
JSONbored:mainfrom
Lobster-0429:feat/focus-manifest-policy-schema

Conversation

@Lobster-0429

@Lobster-0429 Lobster-0429 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Implements feat(settings): define focus-manifest policy schema #296: defines the normalized policy schema produced from repo focus manifests before wiring downstream owner or maintainer workflows
  • Adds FocusManifestPolicy type and compileFocusManifestPolicy() to src/signals/focus-manifest.ts
  • Schema separates publicSafe fields (contributor-facing) from authenticated fields (owner/maintainer-only) — callers route each subset to the correct surface without manual filtering

Closes: #296

Scope

  • 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 — clean
  • npm run test:coverage locally — 785 pass (1 skipped); pre-existing Windows failures confirmed on main before this branch; coverage stays above 97%
  • 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

If any required check was skipped, explain why:

  • UI/MCP/worker checks not applicable — this PR touches only src/signals/focus-manifest.ts and its test file; no public API or MCP surface changed

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.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. (not applicable)
  • API/OpenAPI/MCP behavior is updated and tested where needed. (not applicable)
  • Visible UI changes include screenshots or a short recording. (not applicable)
  • Public docs/changelogs are updated where needed. (not applicable)

Notes

Schema structure:

FocusManifestPolicy {
present, source,
publicSafe: {
contributionLanes: { directPrLane, issueDiscoveryLane, preferredEntryPaths }
discouragedWork: { blockedEntryPaths, issueDiscoveryDiscouraged }
labelExpectations: { preferredLabels, linkedIssuePolicy }
validationExpectations: { testExpectations, linkedIssueRequired, linkedIssuePreferred }
entryGuidance: string[] ← isFocusManifestPublicSafe filtered
summary: string ← isFocusManifestPublicSafe guaranteed
},
authenticated: {
readinessWarnings: string[] ← owner/maintainer advisory
parseWarnings: string[] ← forwarded from manifest.warnings
maintainerContext: string[] ← manifest.maintainerNotes, never in publicSafe
}
}

Lane derivation logic:

Condition directPrLane issueDiscoveryLane
issueDiscoveryPolicy: "encouraged" "discouraged" "preferred"
wantedPaths.length > 0 "preferred" per policy
issueDiscoveryPolicy: "discouraged" neutral/preferred "discouraged"
default "neutral" "neutral"

Test coverage (14 new tests): minimal/absent, malformed JSON, typical full fixture, three missing-field partials, two readiness-warning branches, maintainerContext isolation, forbidden-language injection via publicNotes/testExpectations, source preservation, 400-iteration property-based sanitizer.

Adds FocusManifestPolicy and compileFocusManifestPolicy() to produce
a normalized, machine-readable schema from a repo focus manifest before
wiring downstream owner or maintainer workflows.

- src/signals/focus-manifest.ts:
  - New FocusManifestLanePreference type ("preferred"|"neutral"|"discouraged")
  - New sub-types: FocusManifestPolicyContributionLanes,
    FocusManifestPolicyDiscouragedWork, FocusManifestPolicyLabelExpectations,
    FocusManifestPolicyValidationExpectations
  - New FocusManifestPolicy type with explicit publicSafe / authenticated
    field split — publicSafe is contributor-facing; authenticated is for
    repo owner/maintainer surfaces only
  - New compileFocusManifestPolicy(manifest) function — deterministic,
    same manifest always produces the same policy
  - Private helpers: policyDirectPrLane, policyIssueDiscoveryLane,
    policyEntryGuidance, policyReadinessWarnings, policyPublicSummary

- test/unit/focus-manifest.test.ts (14 new tests):
  - Minimal: absent manifest → neutral defaults, unconstrained summary
  - Malformed: parse warnings forwarded to authenticated.parseWarnings
  - Typical: fully specified manifest covers all schema fields end-to-end
  - Missing-field: linkedIssuePolicy only, issueDiscoveryPolicy only,
    blockedPaths only — each branch verified independently
  - Readiness warnings: discouraged-ID-no-paths, required-link-no-guidance
  - Public/private separation: maintainerContext absent from publicSafe,
    forbidden publicNotes/testExpectations filtered before publicSafe
  - Source preservation across repo_file / api_record / none
  - Property-based sanitizer (400 iterations, seeded LCG): all publicSafe
    text fields pass isFocusManifestPublicSafe across random inputs

@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.

@web-dev0521 this is the right baseline PR for the focus-manifest lane.

A few notes:

  • The schema addition is focused and tested.
  • This should land before the derived contribution-lane work so the later PR can rebase onto the final policy shape.
  • The PR body has the expected issue and validation evidence.

No code changes requested.

Validation expected:

  • Keep the settings/unit suite green through merge.

@dosubot dosubot Bot added the lgtm label Jun 3, 2026
@JSONbored
JSONbored merged commit f6edb0a into JSONbored:main Jun 3, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jun 3, 2026
@github-actions github-actions Bot mentioned this pull request Jun 3, 2026
12 tasks
@JSONbored JSONbored added gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. and removed feature 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(settings): define focus-manifest policy schema

2 participants