Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions internal/app/dependency_direction_test.go

This file was deleted.

1 change: 0 additions & 1 deletion internal/app/mcp_portfolio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func TestPullRequestPortfolioDerivesConflictAndPreservesUnknownCoverage(t *testi
if len(conciseJSON) >= len(detailedJSON) {
t.Fatalf("concise portfolio is not smaller: concise=%d detailed=%d", len(conciseJSON), len(detailedJSON))
}
t.Logf("portfolio response bytes: concise=%d detailed=%d", len(conciseJSON), len(detailedJSON))
}

func TestPullRequestPortfolioClassifiesClosedUnmerged(t *testing.T) {
Expand Down
10 changes: 0 additions & 10 deletions internal/app/mcp_stdio_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ func TestMCPStdioScalableResearchFlow(t *testing.T) {
if initialized == nil || initialized.ServerInfo == nil || initialized.ServerInfo.Name != "gitcontribute" {
t.Fatalf("initialize result = %+v", initialized)
}
for _, phrase := range []string{
"corpus.* tools are offline reads", "never refresh implicitly", "explicit bounded network reads",
"polling through jobs.get", "observations are unknown rather than negative evidence",
"Only advertised tools are available", "never mutates GitHub",
} {
if !strings.Contains(initialized.Instructions, phrase) {
t.Errorf("instructions missing %q: %s", phrase, initialized.Instructions)
}
}

tools := make(map[string]*mcp.Tool)
for tool, err := range session.Tools(ctx, nil) {
if err != nil {
Expand Down
9 changes: 0 additions & 9 deletions internal/app/runtime_contract.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app

import (
"context"
"errors"
"strings"

Expand All @@ -27,11 +26,3 @@ func NewRuntimeContract(version string) (*contracts.RuntimeContractResult, error
SupportedSchemaVersion: schema,
}, nil
}

// RuntimeContract reports immutable executable compatibility metadata.
func (s *Service) RuntimeContract(ctx context.Context) (*contracts.RuntimeContractResult, error) {
if err := ctx.Err(); err != nil {
return nil, err
}
return NewRuntimeContract(s.version)
}
3 changes: 0 additions & 3 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package cli

import (
Expand Down Expand Up @@ -77,7 +77,6 @@
Setup setupCmd `cmd:"" help:"Set up GitContribute for MCP, CLI, or both"`
Remove removeCmd `cmd:"" help:"Remove GitContribute coding-agent integrations"`
Upgrade upgradeCmd `cmd:"" help:"Check for or install the latest release"`
Contract contractCmd `cmd:"" name:"runtime-contract" help:"Print the executable runtime compatibility contract"`
Init initCmd `cmd:"" help:"Initialize the local corpus"`
Corpus corpusCmd `cmd:"" help:"Inspect, back up, or migrate the local corpus"`
Configure configureCmd `cmd:"" help:"Inspect or update typed configuration"`
Expand Down Expand Up @@ -154,8 +153,6 @@
JSON bool `name:"json" help:"Print the result as JSON"`
}

type contractCmd struct{}

type configureCmd struct {
Database *string `name:"database" help:"Corpus database path"`
TokenSource *string `name:"token-source" help:"GitHub token source (none, env, gh-cli, or keyring)"`
Expand Down
95 changes: 47 additions & 48 deletions internal/cli/dispatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,53 @@ import (
// group owns its own behavior.
func (c *CLI) dispatchCommand(ctx context.Context, cmd, command string, parsed *rootCmd) error {
handlers := map[string]func() error{
"setup": func() error { return c.runSetupCommand(ctx, &parsed.Setup) },
"remove": func() error { return c.runRemoveCommand(ctx, &parsed.Remove) },
"upgrade": func() error { return c.runUpgrade(ctx, &parsed.Upgrade) },
"runtime-contract": func() error { return c.runRuntimeContract(ctx) },
"init": func() error { return c.runInit(ctx, &parsed.Init) },
"corpus": func() error { return c.runCorpus(ctx, command, &parsed.Corpus) },
"configure": func() error { return c.runConfigure(ctx, &parsed.Configure) },
"metadata": func() error { return c.runMetadata(ctx, &parsed.Metadata) },
"status": func() error { return c.runStatus(ctx, &parsed.Status) },
"doctor": func() error { return c.runDoctor(ctx, &parsed.Doctor) },
"health": func() error { return c.runHealth(ctx, &parsed.Health) },
"radar": func() error { return c.runRadar(ctx, &parsed.Radar) },
"search": func() error { return c.runSearch(ctx, command, &parsed.Search) },
"dossier": func() error { return c.runDossier(ctx, command, &parsed.Dossier) },
"research": func() error { return c.runResearch(ctx, command, &parsed.Research) },
"seeds": func() error { return c.runSeeds(ctx, &parsed.Seeds) },
"index": func() error { return c.runIndex(ctx, &parsed.Index) },
"acquire": func() error { return c.runAcquire(ctx, &parsed.Acquire) },
"source": func() error { return c.runSource(ctx, command, &parsed.Source) },
"crawl": func() error { return c.runCrawl(ctx, &parsed.Crawl) },
"tail": func() error { return c.runTail(ctx, &parsed.Tail) },
"investigation": func() error { return c.runInvestigation(ctx, command, &parsed.Investigation) },
"hypothesis": func() error { return c.runHypothesis(ctx, command, &parsed.Hypothesis) },
"duplicates": func() error { return c.runCheck(ctx, command, "duplicates", &parsed.Duplicates) },
"collisions": func() error { return c.runCheck(ctx, command, "collisions", &parsed.Collisions) },
"opportunity": func() error { return c.runOpportunity(ctx, command, &parsed.Opportunity) },
"concern": func() error { return c.runConcern(ctx, command, &parsed.Concern) },
"workspace": func() error { return c.runWorkspace(ctx, command, &parsed.Workspace) },
"diff": func() error { return c.runDiff(ctx, &parsed.Diff) },
"validation": func() error { return c.runValidation(ctx, command, &parsed.Validation) },
"evidence": func() error { return c.runEvidence(ctx, command, &parsed.Evidence) },
"readiness": func() error { return c.runReadiness(ctx, command, &parsed.Readiness) },
"prepare": func() error { return c.runPrepare(ctx, command, &parsed.Prepare) },
"archive": func() error { return c.runArchive(ctx, command, &parsed.Archive) },
"coverage": func() error { return c.runCoverage(ctx, &parsed.Coverage) },
"runs": func() error { return c.runRuns(ctx, &parsed.Runs) },
"jobs": func() error { return c.runJobs(ctx, command, &parsed.Jobs) },
"neighbors": func() error { return c.runNeighbors(ctx, &parsed.Neighbors) },
"export": func() error { return c.runExport(ctx, command, &parsed.Export) },
"clusters": func() error { return c.runClusters(ctx, command, &parsed.Clusters) },
"cluster": func() error { return c.runCluster(ctx, command, &parsed.Cluster) },
"lens": func() error { return c.runLens(ctx, command, &parsed.Lens) },
"collection": func() error { return c.runCollection(ctx, command, &parsed.Collection) },
"triage": func() error { return c.runTriage(ctx, command, &parsed.Triage) },
"contribution": func() error { return c.runContribution(ctx, command, &parsed.Contribution) },
"tracking": func() error { return c.runTracking(ctx, command, &parsed.Tracking) },
"mcp": func() error { return c.runMCP(ctx, &parsed.MCP) },
"tui": func() error { return c.runTUI(ctx, &parsed.TUI) },
"setup": func() error { return c.runSetupCommand(ctx, &parsed.Setup) },
"remove": func() error { return c.runRemoveCommand(ctx, &parsed.Remove) },
"upgrade": func() error { return c.runUpgrade(ctx, &parsed.Upgrade) },
"init": func() error { return c.runInit(ctx, &parsed.Init) },
"corpus": func() error { return c.runCorpus(ctx, command, &parsed.Corpus) },
"configure": func() error { return c.runConfigure(ctx, &parsed.Configure) },
"metadata": func() error { return c.runMetadata(ctx, &parsed.Metadata) },
"status": func() error { return c.runStatus(ctx, &parsed.Status) },
"doctor": func() error { return c.runDoctor(ctx, &parsed.Doctor) },
"health": func() error { return c.runHealth(ctx, &parsed.Health) },
"radar": func() error { return c.runRadar(ctx, &parsed.Radar) },
"search": func() error { return c.runSearch(ctx, command, &parsed.Search) },
"dossier": func() error { return c.runDossier(ctx, command, &parsed.Dossier) },
"research": func() error { return c.runResearch(ctx, command, &parsed.Research) },
"seeds": func() error { return c.runSeeds(ctx, &parsed.Seeds) },
"index": func() error { return c.runIndex(ctx, &parsed.Index) },
"acquire": func() error { return c.runAcquire(ctx, &parsed.Acquire) },
"source": func() error { return c.runSource(ctx, command, &parsed.Source) },
"crawl": func() error { return c.runCrawl(ctx, &parsed.Crawl) },
"tail": func() error { return c.runTail(ctx, &parsed.Tail) },
"investigation": func() error { return c.runInvestigation(ctx, command, &parsed.Investigation) },
"hypothesis": func() error { return c.runHypothesis(ctx, command, &parsed.Hypothesis) },
"duplicates": func() error { return c.runCheck(ctx, command, "duplicates", &parsed.Duplicates) },
"collisions": func() error { return c.runCheck(ctx, command, "collisions", &parsed.Collisions) },
"opportunity": func() error { return c.runOpportunity(ctx, command, &parsed.Opportunity) },
"concern": func() error { return c.runConcern(ctx, command, &parsed.Concern) },
"workspace": func() error { return c.runWorkspace(ctx, command, &parsed.Workspace) },
"diff": func() error { return c.runDiff(ctx, &parsed.Diff) },
"validation": func() error { return c.runValidation(ctx, command, &parsed.Validation) },
"evidence": func() error { return c.runEvidence(ctx, command, &parsed.Evidence) },
"readiness": func() error { return c.runReadiness(ctx, command, &parsed.Readiness) },
"prepare": func() error { return c.runPrepare(ctx, command, &parsed.Prepare) },
"archive": func() error { return c.runArchive(ctx, command, &parsed.Archive) },
"coverage": func() error { return c.runCoverage(ctx, &parsed.Coverage) },
"runs": func() error { return c.runRuns(ctx, &parsed.Runs) },
"jobs": func() error { return c.runJobs(ctx, command, &parsed.Jobs) },
"neighbors": func() error { return c.runNeighbors(ctx, &parsed.Neighbors) },
"export": func() error { return c.runExport(ctx, command, &parsed.Export) },
"clusters": func() error { return c.runClusters(ctx, command, &parsed.Clusters) },
"cluster": func() error { return c.runCluster(ctx, command, &parsed.Cluster) },
"lens": func() error { return c.runLens(ctx, command, &parsed.Lens) },
"collection": func() error { return c.runCollection(ctx, command, &parsed.Collection) },
"triage": func() error { return c.runTriage(ctx, command, &parsed.Triage) },
"contribution": func() error { return c.runContribution(ctx, command, &parsed.Contribution) },
"tracking": func() error { return c.runTracking(ctx, command, &parsed.Tracking) },
"mcp": func() error { return c.runMCP(ctx, &parsed.MCP) },
"tui": func() error { return c.runTUI(ctx, &parsed.TUI) },
}
if handler, ok := handlers[cmd]; ok {
return handler()
Expand Down
21 changes: 0 additions & 21 deletions internal/cli/runtime_contract.go

This file was deleted.

29 changes: 0 additions & 29 deletions internal/cli/runtime_contract_test.go

This file was deleted.

6 changes: 0 additions & 6 deletions internal/contracts/workflow_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,6 @@ type ReadinessCheck struct {
EvaluatedAt string `json:"evaluated_at"`
}

// RuntimeContractService reports only immutable executable compatibility
// metadata. Implementations must not inspect configuration or the corpus.
type RuntimeContractService interface {
RuntimeContract(ctx context.Context) (*RuntimeContractResult, error)
}

// RuntimeContractResult is immutable executable compatibility metadata.
type RuntimeContractResult struct {
Name string `json:"name"`
Expand Down
19 changes: 0 additions & 19 deletions internal/corpus/corpus_fixture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,22 +81,3 @@ func copyTestDatabase(source, destination string) error {
}
return out.Close()
}

func TestTestCorpusTemplateIsCurrentAndStandalone(t *testing.T) {
t.Parallel()
c, path := openTestCorpus(t)
if _, err := os.Stat(testCorpusTemplate(t) + "-wal"); !errors.Is(err, os.ErrNotExist) {
t.Fatalf("template retained a WAL sidecar: %v", err)
}
_, target, err := c.SchemaVersions(context.Background())
if err != nil {
t.Fatalf("schema versions: %v", err)
}
current, exists, err := InspectSchemaVersion(context.Background(), path)
if err != nil {
t.Fatalf("inspect copied schema: %v", err)
}
if !exists || current != target {
t.Fatalf("copied schema version = %d (exists=%t), want current %d", current, exists, target)
}
}
47 changes: 0 additions & 47 deletions internal/corpus/dossiers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,53 +9,6 @@ import (
"github.com/morluto/gitcontribute/internal/domain"
)

func TestDossiersMigration(t *testing.T) {
t.Parallel()
ctx := context.Background()
c, _ := openTestCorpus(t)

rows, err := c.db.QueryContext(ctx, `SELECT name FROM sqlite_master WHERE type='table' AND name IN ('dossiers', 'dossier_sources') ORDER BY name`)
if err != nil {
t.Fatalf("query tables: %v", err)
}
defer func() { _ = rows.Close() }()

var names []string
for rows.Next() {
var name string
if err := rows.Scan(&name); err != nil {
t.Fatalf("scan table name: %v", err)
}
names = append(names, name)
}
if err := rows.Err(); err != nil {
t.Fatal(err)
}
if len(names) != 2 || names[0] != "dossier_sources" || names[1] != "dossiers" {
t.Fatalf("expected dossier tables, got %v", names)
}

for _, col := range []string{"id", "repository_id", "commit_sha", "as_of", "section_metadata", "snapshot", "generated_at", "created_at"} {
var found int
if err := c.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM pragma_table_info('dossiers') WHERE name=?`, col).Scan(&found); err != nil {
t.Fatalf("pragma dossiers %s: %v", col, err)
}
if found != 1 {
t.Fatalf("dossiers missing column %s", col)
}
}

for _, col := range []string{"id", "dossier_id", "source", "url", "commit_sha", "observed_at", "as_of"} {
var found int
if err := c.db.QueryRowContext(ctx, `SELECT COUNT(*) FROM pragma_table_info('dossier_sources') WHERE name=?`, col).Scan(&found); err != nil {
t.Fatalf("pragma dossier_sources %s: %v", col, err)
}
if found != 1 {
t.Fatalf("dossier_sources missing column %s", col)
}
}
}

func TestDossierSaveGetListAndRefresh(t *testing.T) {
t.Parallel()
ctx := context.Background()
Expand Down
Loading
Loading