Repository navigation
Add mini.test suite, Nix dev shells, and CI - #84
Merged
Merged
Conversation
config.normalize shared the nested default tables with the result, so apply_filter_fn wrote the filter_fn into the module-level formats. Every later config, such as a second source instance, then used that filter.
vim.fn.getenv returns vim.NIL for an unset variable, and the command passed it as the string "vim.NIL". glab prefers GITLAB_TOKEN over the credentials from `glab auth login`, so it sent an invalid token.
The curl fallback requested <owner>/<repo>/<members> without the repos/ prefix, so it got a 404 and no mentions.
The header has had literal quotes since the first version, but curl runs without a shell. curl sent a header named "'Accept", so GitHub ignored it.
os.time read the UTC fields as local time, so every age was off by the local UTC offset. West of UTC, items updated in the last few hours got negative ages and sorted in reverse order. parse_gitlab_date also added the UTC offset for both signs, and a missing or unknown date raised an error in the sort function, for example with GitHub fields that leave out updatedAt. Such a date now gives 0, so the item sorts last.
The overlay CI builds checks.<system>.neovim and pushes only that output to nix-community.cachix.org. It uses the nixpkgs of the overlay's dev partition, so packages.<system>.default is a different build, and the nightly shell built Neovim from source.
The overlay updates each day at 00:00 UTC, and its CI pushes the build to nix-community.cachix.org later. The job used the overlay HEAD, so a run before that build finished built Neovim from source. scripts/nightly-cache.sh latest finds the newest of the last 10 overlay commits whose build is in the cache. It reads the store path from the nightly shell, so it checks the same build that nix develop uses.
Dependabot and nix flake update can lock an overlay commit whose build is not in nix-community.cachix.org yet. Then nix develop .#nightly builds Neovim from source. The Nightly cache job runs scripts/nightly-cache.sh check, which fails when the cache has no build of the locked overlay for a system of the flake.
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.
Adds a mini.test suite, Nix dev shells, a GitHub Actions workflow, Dependabot, and a contributing guide. This PR adds no release automation.
Changes
default(locked nixpkgs Neovim, 0.12.6 today),nvim-0_12_0(nixpkgs-multiverse fast path), andnightly(neovim-nightly-overlay). Each shell has StyLua, Selene, LuaLS, make, and git..envrcrunsuse flake.tests/run.luanow live in one file for each module. The suite has 101 cases. TheMakefileclones mini.nvimv0.18.0intodeps/.tests/helpers.luaisolates each case:vim.notify, so the run prints no log lines.utils,sort,format, both adapters (gh/glab versus curl, enterprise URLs, tokens, no-color env, state, limit, and filter args, mention preflight and pagination), and repository detection against temporary git repos.trigger_charparameters are now_trigger_char.make lintno longer passes--allow-warnings..luarc.jsonandmake typecheckuse LuaLS with$VIMRUNTIME/lua. All 151 warnings are fixed. Thelua/changes in this commit are annotations and inline casts only.Quality,Neovim stable,Neovim 0.12.0, andNightly cacheblock.Neovim nightlyuses the newest overlay commit that is in the cache and does not block. A weekly schedule runs only the nightly job. The actions are pinned by SHA.checks.<system>.neovimto nix-community.cachix.org. It uses the older nixpkgs of the overlay's dev partition (GCC 15.2.0, not 16.2.0), sopackages.<system>.defaultwas never in the cache, and the nightly shell built Neovim from source.d2f8677: thenightlyshell useschecks.<system>.neovim.6be4304:scripts/nightly-cache.sh latestfinds the newest of the last 10 overlay commits whose build is in the cache, and the nightly job uses that commit. The overlay updates at 00:00 UTC, and the build arrives in the cache later.eeb5cb2: theNightly cachejob runsscripts/nightly-cache.sh check. It fails when the cache has no build of the locked overlay for a system of the flake, for example on a DependabotnixPR that locks a commit before its build is in the cache.CONTRIBUTING.mddescribes what to do then.passthru.neovim), so they check the same build thatnix developuses.github-actionsandnix.Bug fixes found by the new tests
Each fix is a separate commit with regression tests.
17c929f fix: keep filter_fn out of the default formats:config.normalizeshared the nested default tables, soapply_filter_fnwrote a user'sfilter_fninto the module-level formats. Every later config, such as a second source, then used that filter. A regression test is intest_config.lua.098f690 fix: detect the repository from inside the .git directory:d9efd00(async commands) read only the first line ofgit rev-parse --is-inside-work-tree --is-inside-git-dir. That brought Bug: not completing at all & two cmp-git sources listed #47 back.is_git_repo_inside_git_dircovers it.0345598 fix: pass provider tokens to gh and glab only when they are set: whenGITLAB_TOKENwas unset,glabgotGITLAB_TOKEN=vim.NIL, becausevim.fn.getenvreturnsvim.NILand the command passed it as a string. glab prefers this variable over the credentials fromglab auth login, so it sent an invalid token.GITHUB_API_TOKENhad the same problem, butghdoes not read it. The adapters now usevim.env. The adapter tests run a real process with the adapter env and check that the variable is unset.f050252 fix: request GitHub mentions from the repos API path with curl: the curl fallback requestedhttps://api.github.com/<owner>/<repo>/<members>withoutrepos/, so it got a 404 and no mentions. The test asserts the full URL for github.com and for an enterprise host.f5f2a70 fix: send the GitHub Accept header without literal quotes: curl runs without a shell, so it sent a header named'Accept, and GitHub ignored it. The quotes were there since the first version.9dd025a fix: parse GitHub and GitLab dates as UTC timestamps:os.timeread the UTC fields as local time, so every age was off by the local UTC offset. West of UTC, items updated in the last few hours got negative ages and sorted in reverse order.parse_gitlab_dateadded the offset for both+and-.54d3fb6removed theor 0defaults from20b7b8e. Such a date now gives 0, so the item sorts last.Z,+05:30,-05:30, milliseconds, a leap day, a non-UTCTZ, and missing dates.Plan deviations
git_commit_edit_range_is_preservedtotest_core.lua,custom_trigger_actions_remove_trailersandinvalid_trigger_action_pattern_is_skippedtotest_core.lua, andtrailer_gatingandtrailer_capabilities_with_gittotest_trailers.lua.timeout-minutes. The Dependabot commit messages use theciandbuildprefixes.Validation (local)
make ciexits 0 indefault,nvim-0_12_0, andnightly.make testpasses on every commit fromtest: switch to mini.testonward.make testexit 2.make lintexit 2. A type error makesmake typecheckexit 2.make testprints no stray log lines.insteadOfrule) fails a repository test when isolation is off. It passes when isolation is on.GITHUB_API_TOKENandGITLAB_TOKENin the environment do not change the results.scripts/nightly-cache.sh checkfails for all three systems when the shell usespackages.<system>.default. Both modes fail with a clear message when a build is missing, and when the cache cannot be reached. shellcheck passes.make testpasses withTZ=XYZ+05and withTZ=XYZ-11.nix flake show --all-systemsevaluates.Validation (CI, before merge)
Quality,Neovim stable,Neovim 0.12.0, andNightly cachepass oneeb5cb2(29s, 24s, 28s, and 53s, run 39748376784).Neovim nightlylog shows that Neovim comes fromnix-community.cachix.organd is not built from source. Oneeb5cb2, the job picked overlay620aaa5and copied2lr6d3w…-neovim-unwrapped-1cfebe9from the cache. The job took 54s. Before the fix, it took 7m18s.workflow_dispatchrun from the branch passes (run 39742358311).Old test name checklist (52)
handle_response→tests/test_response.luaparse_remote_url→tests/repository/test_remote_url.luamissing_executable→tests/test_command.luafallback→tests/test_command.luacommand_fallback_cancels_active_job→tests/test_command.luacommand_build_cancel_suppresses_callback→tests/test_command.luabuild_job→tests/test_command.lualogger→tests/test_log.luatrigger_action_fallback_for_hash→tests/test_source.luatrigger_action_ordering_for_at→tests/test_source.luatrigger_action_first_handled_wins→tests/test_source.luapreferred_trigger_action_names→tests/test_source.lualegacy_trigger_action_aliases→tests/test_source.lualegacy_trigger_action_arguments→tests/test_source.luaconfig_normalize_fills_defaults_and_hosts→tests/test_config.luaconfig_normalize_nested_filter_and_sort_overrides→tests/test_config.luaconfig_normalize_provider_filter_alias→tests/test_config.luaconfig_normalize_provider_filter_alias_overrides_nested_filter→tests/test_config.luaconfig_normalize_does_not_leak_hosts_between_instances→tests/test_config.luasource_new_uses_normalized_config→tests/test_source.luaissue_capability_uses_cache_and_runner→tests/provider/capabilities/test_issues.luamention_capability_preflight_and_pagination→tests/provider/capabilities/test_mentions.luachange_request_capability_returns_job→tests/provider/capabilities/test_change_requests.luacommit_capability_parse_nul_records→tests/provider/capabilities/test_commits.luacommit_capability_parse_marker_collision_and_malformed_records→tests/provider/capabilities/test_commits.luacommit_capability_maps_items_without_cmp_params→tests/provider/capabilities/test_commits.luacommit_capability_uses_parsed_cache_and_runner→tests/provider/capabilities/test_commits.luagit_commit_edit_range_is_preserved→tests/test_core.luacore_text_edit_ranges_for_all_triggers→tests/test_core.luablink_adapter_api_and_cancellation→tests/test_blink.luablink_adapter_suppresses_stale_callbacks_after_cancel→tests/test_blink.luagithub_instance_state_isolation→tests/sources/test_github.luagitlab_instance_state_isolation→tests/sources/test_gitlab.luagit_instance_state_isolation→tests/sources/test_git.luaconfig_trailer_defaults→tests/test_config.luacustom_trigger_actions_remove_trailers→tests/test_core.luainvalid_trigger_action_pattern_is_skipped→tests/test_core.luaconfig_git_filter_alias_skips_trailers→tests/test_config.luacore_keyword_pattern_offsets→tests/test_core.luatrailer_routing→tests/test_core.luatrailer_gating→tests/provider/capabilities/test_trailers.luacore_pre_route_skips_repository→tests/test_core.luatrailer_text_edits→tests/test_core.luatrailer_keys_parse_and_sort→tests/provider/capabilities/test_trailers.luatrailer_identities_request→tests/provider/capabilities/test_trailers.luatrailer_identities_parse→tests/provider/capabilities/test_trailers.luatrailer_capabilities_use_cache_and_runner→tests/provider/capabilities/test_trailers.luatrailer_identities_job_cancel→tests/provider/capabilities/test_trailers.luablink_adapter_matches_text_before_cursor→tests/test_blink.luatrailer_capabilities_with_git→tests/provider/capabilities/test_trailers.luatrailer_values_request_and_parse→tests/provider/capabilities/test_trailers.luatrailer_values_cache_and_fall_through→tests/provider/capabilities/test_trailers.lua