Scope rules

Write the ordered rules that decide which repositories are in, preview them, and see why each repository is in or out.

Each connection has an ordered list of scope rules. They are evaluated on every sync, so a new repository that matches comes in by itself and one that stops matching goes out. Synaxis indexes the default branch of each repository in scope, and the branches and tags an include rule adds (More branches and tags).

How a repository's scope is decided

Synaxis decides each repository's scope in this order, and records the step that decided it as its reason:

  1. Reachability and limits. A repository the connection cannot reach is out, and one over a size limit is held. A manual choice cannot override either.
  2. Manual choice. A repository you included by hand is in; one you excluded is out (Repositories).
  3. Project. An Azure DevOps repository whose project is not chosen is out (Azure DevOps).
  4. Rules. The rules apply in order and the last rule that matches decides. A repository no rule matches is out.

A repository that leaves scope leaves search at once. Its index data is purged within the hour, and its mirror is kept for the out-of-scope retention period (7 days by default), so including it again fetches only what changed.

To edit the rules

  1. Open Connections and select Scope for the connection.

  2. Under Rules, each row is one rule. The last row is empty, for a new rule:

    Column Means
    Effect Include or Exclude the repositories the rule matches
    Names Name patterns that match, comma separated, with * as a wildcard: contoso/* on GitHub, Products/* (project and repository) on Azure DevOps. Empty matches every name
    Except Name patterns the rule never matches, such as *-archive
    Visibility Only these visibilities (public, private, internal), or empty for any
    Archived Any, No (active only) or Yes (archived only)
    Topics Only repositories with one of these topics, or empty for any
    Pushed within days Only repositories pushed to within this many days, or empty for any
    Size up to MB Only repositories up to this size, as GitHub or Azure DevOps reports it, or empty for any. A repository whose size is not reported matches
    Branches An include rule only: branch name patterns indexed besides the default branch, such as release/*
    Tag pattern, Latest tags An include rule only: index the newest tags matching the pattern (every tag when empty), this many of them
    Remove Check to delete the rule when you save
  3. Select Preview. The table under "Preview: n of m in" lists every repository with its Scope and Reason, without saving anything.

  4. Select Save. The console answers The rules are saved and syncing., and the sync brings repositories in and queues purges for those that went out.

Tip: Start broad and narrow down: an Include rule for contoso/*, then Exclude rules for what you never want (*-sandbox, archived repositories). Because the last match wins, put exceptions after the rules they refine.

Examples

Goal Rules, in order
Every active repository of one organization Include contoso/*, Archived No
The same, without forks of samples then Exclude contoso/sample-*
Only what was worked on in the last year Include contoso/*, Pushed within days 365
Private and internal repositories only Include contoso/*, Visibility private, internal
Leave out very large repositories Include contoso/*, Size up to MB 2048

In the configuration file, the same rules are the connection's scope list (include, exclude, visibility, archived, topics, activeWithinDays, maxSizeMb, refs, and effect for an exclude rule).

More branches and tags

An include rule can index more refs of the repositories it takes in, so people and agents can search and read a release branch or a released version:

  • Branches: patterns on branch names, such as release/* or hotfix. * stays within one folder of the name; ** crosses folders.
  • Tags: the latest tags matching Tag pattern (such as v*), as many as Latest tags. Newest means in version order of their names, so v1.10 comes after v1.9.

The last rule that matches a repository gives its refs; a repository you included by hand, which no rule matches, has its default branch only. When you save the rules, every repository in scope is fetched again: new refs are indexed and a branch or tag that no longer qualifies (or was deleted upstream) leaves the index at once. After that, pushes and the nightly reconcile pick up new branches and tags.

Search and read the default branch unless you ask for a ref: org_search and org_read take ref, such as release/1.0, v2.0 or refs/tags/v2.0. Repo cards, summaries, symbols, API contracts and links to work describe the default branch only.

Note: Each ref is indexed in full, so the index grows with every ref. Embedding costs only what differs from the other refs, because identical code is not embedded again. The limit on refs per repository (Limits) caps it.

scope:
  - include: "contoso/*"
    refs: { branches: ["release/*"], tags: { pattern: "v*", latest: 3 } }

Limits

Over a limit, Synaxis holds the work with the reason shown and indexes nothing of it, never part of it:

Limit Default Effect
Repository size (as the upstream reports it) 4,096 MB The repository is held, with the reason limit:size
Files selected in one ref 200,000 The ref's indexing job is held, with the reason limit:files
File size 512 KB The file is skipped, not the repository
Refs per repository, the default branch included 10 The refs a rule adds over it are held, with the reason limit:refs; the default branch first, then branches by name, then the newest tags

Change them in the limits section of the configuration file (repoMirrorMb, maxFiles, maxFileKb, maxRefs).

Which files are indexed

Synaxis indexes the files CodeWrightAI indexes on the desktop: source files by extension (C#, F#, TypeScript and JavaScript, Python, Java, Kotlin, Go, Rust, C and C++, Swift, Ruby, PHP, SQL, scripts, Markdown, JSON, YAML, TOML, XML and project files), never build output, dot folders, lock files, binaries or files that hold secrets by name. To change the list or leave more out, set extensions (such as [.cs, .md]) and excludeFiles (glob patterns such as legacy/**) in the limits section. A change applies at each repository's next index, which also drops what is no longer selected.

See also