Repository navigation
plugin: index leaves incidental languages out of a build that names no --lang (#1835) - #1962
Open
swapnilpaliwal-sd wants to merge 1 commit into
Open
swapnilpaliwal-sd wants to merge 1 commit into
swapnilpaliwal-sd wants to merge 1 commit into
Conversation
swapnilpaliwal-sd
requested review from
JaredHLZhang and
suyashpaliwal26
as code owners
October 14, 2026 21:52
…o --lang `axiomcode index` with no --lang built a graph for every language it found and chose the main one by file count. One .py file beside three trivial .js files became a JavaScript repository with a Python graph beside it. A Python backend with a few .js build scripts got a second graph, a second section in every answer, and a cold JavaScript engine compile. The choice now lives in ax_fresh.py (`choose`), which axiomcode-build reads in place of `count`: - The main language is the one with the most code: non-blank lines, with each file counted up to 1,000 lines so that a vendored blob cannot decide it. Web is the main language only when no other language has a file, as before. - Any other language is incidental, and is not built, when it has fewer than 20 source files AND either under 5% of the repository's code or under 100 lines in all. A share means nothing in a repository of four files, which is why the line floor exists. - What is left out is named at the end of every index, together with the --lang that includes it. An explicit --lang always wins. Web (HTML/CSS) follows the same rule. How N=20 and X=5% were chosen: I measured the language mix of 42 corpus repositories, 14 each of Python, Java and C#. 35 of them have a second language, 79 second languages in all. 41 of those have fewer than 20 files, and they split with a gap: 33 are at 3.8% of the code or less (stray scripts, a docs theme, a sample, a vendored widget), and the other 8 are at 6.0% or more (a small frontend, a site's pages). 5% sits in that gap. Every second language with 20 or more files is still built. Under the rule, 26 of the 42 repositories still get more than one graph. Weighting the main language by code changes it in 2 of the 42, both Python projects that file count had called TypeScript and JavaScript. Every reader of the main language takes it from the built graph (the run.language row: ax_langs, context, the hooks through _where, MCP through the verbs), so queries, hooks and MCP agree with the build without changes of their own. A file in a skipped language is outside every indexed language, so editing it does not make the graph stale. README Get Started now shows `axiomcode index --lang <language>` and gives the rule in one sentence. Tests: tests/incidental_languages.py covers the rule on the numbers, plus real builds. 1 py + 3 js gives python only, with the note. 40 py + 3 js build scripts gives python only. A balanced TypeScript + Python repository gives both graphs (control). --lang javascript gives javascript (control). On the base, the first two shapes build two graphs and both controls hold. Fixture changes, and why: the multi_language.py and publish_order.py fixtures were 5-16 lines per language, which makes them incidental under the new rule. Each now carries a filler module of 100+ lines per language that no check asks about. The maven-web check in multi_language.py now expects its single 6-line Java class to be named as incidental instead of built. Its path check reads the verb's own answer (AXIOMCODE_RAW), which names the callee's file. Refs #1835
Open
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1972
Part of #1835.
What
With no
--lang,axiomcode indexbuilt a graph for every language it found and chose the main language by file count. One.pyfile beside three trivial.jsfiles became a JavaScript repository with a Python graph beside it. A Python backend with a few.jsbuild scripts got a second graph, a second section in every answer, and a cold JavaScript engine compile.The rule (
ax_fresh.py choose, read byaxiomcode-build)--langthat includes it, for example:--langalways wins. Web (HTML/CSS) follows the same rule.How 20 files and 5% were chosen
Consistency
Every reader of the main language (queries,
context, the hooks, MCP) takes it from the built graph'srun.language, so they agree with the build without changes of their own.Docs
README Get Started shows
axiomcode index --lang <language>and states the rule in one sentence.Tests
tests/incidental_languages.py, 18 checks, all pass:--lang javascriptgives javascript only.--lang python,javascriptbuilds both.tests/run.py --lang python: 445/445.tests/engine_choice.pypasses.tests/multi_language.py: 4 failures, all of which also fail on the base (6 failures there).tests/publish_order.py: the same 5 failures as on the base, by name.multi_language.pyandpublish_order.pyfixtures had 5-16 lines per language, which makes them incidental under the new rule. Each gets a filler module of 100+ lines per language that no check reads.