fix: keep mise task headers as directives, and keep the suite off an inherited GIT_DIR - #68
Merged
Merged
Conversation
mise and its usage library read a file task's configuration from comments at the head of the script: `#` or `//`, optional whitespace, then `MISE` or `USAGE`, bare or in square brackets, matched case-sensitively on the raw line. These were read as prose, so `ocomment fix --tidy` under `wrap = "sentence"` joined a `#MISE` line and the `#USAGE flag` line under it into one `# MISE` line, and the task stopped declaring the flag. Both implementations now recognise the header in every language, from the raw bytes, and file it in the load-bearing tier: `#MISE depends=` and `dir=` decide what runs and `#USAGE flag` declares an argument, so removing one changes the task rather than a report about it. As a directive it also ends a paragraph, so the reflow no longer joins it or writes a space after its `#`. `# mise installs the runtime`, `# Usage: audit` and `#MISEish` stay prose. The spec lists both names under `load_bearing` and names them in no `[load_bearing_by_language]` entry, for the reason the cross-language tool markers are absent from `[protected_by_language]`. Three fixtures pin the removal protection in shell and JavaScript and the header a dotfiles repository wrote surviving a sentence wrap byte for byte.
…ames Git exports GIT_DIR and its neighbours to a hook, and the pre-push hook runs `cargo xtask preflight`. Every step inherited them, so from a linked worktree the CLI suite's `git init -q` in a temporary directory reinitialised the shared git directory and left the main checkout with `core.bare = true`. Run the same suite with GIT_DIR pointed anywhere and the ocomment binary it drives follows it too: `check --staged` asked that repository for its index and hung. The suite now builds every git and ocomment process through one helper, `tests/common::isolated`, which drops every inherited `GIT_*` variable. xtask also removes the names `git rev-parse --local-env-vars` lists from every preflight step, so a step that is not a test is kept off the pushed repository too. The binary itself is unchanged: it runs inside hooks and has to honour GIT_DIR. `a_repository_named_by_the_callers_environment_is_left_alone` reruns a repository-building test with GIT_DIR, GIT_WORK_TREE and GIT_INDEX_FILE pointed at a sentinel repository and requires the sentinel's config to be byte-identical afterwards. With the helper's filter disabled it fails; with it, it passes.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Two fixes, one for the tool and one for its test suite, found together.
mise file-task headers are directives
mise reads a file task's configuration from
#MISE …and#USAGE …comment lines (also//, and the[MISE]/[USAGE]spellings).ocomment read them as prose, so
fix --tidyunderwrap = "sentence"joined them —#MISE description=…and#USAGE flag "--fix-stale-hooks" …became one# MISE description=… USAGE flag …line, which mise parses as a single MISE header and the flag disappears.This happened to a real task in a dotfiles repository through the machine-wide pre-commit gate.
#or//, optional whitespace, thenMISE,[MISE],USAGEor[USAGE]at a word boundary.# mise installs …and// Usage: …stay prose.check_directives.pysamples and near-misses, generated docs, the fuzz pool, three fixtures and Rust tests.The test suite no longer follows an inherited GIT_DIR
Git exports GIT_DIR and its neighbours to hooks, and pre-push runs
cargo xtask preflight.Pushing this branch from a linked worktree let the CLI suite's
git init -qreinitialise the shared git directory, which left the main checkout withcore.bare = true.With GIT_DIR pointed at another repository,
ocomment check --stagedinside the suite followed it as well and hung.tests/common::isolatedbuilds every git and ocomment process the suites start, without any inheritedGIT_*variable.git rev-parse --local-env-varsnames from every preflight step as an outer layer.a_repository_named_by_the_callers_environment_is_left_alonereruns a repository-building test with GIT_DIR, GIT_WORK_TREE and GIT_INDEX_FILE aimed at a sentinel and requires its config to be byte-identical; it fails with the filter disabled.Verified
cargo xtask preflight: 30 of 30 steps, including the Rust/OCaml differential.ocommenttest suite with GIT_DIR aimed at a sentinel repository: passes in seconds, sentinel config unchanged (before: hung for over 20 minutes).check, andfix --tidyleaves it byte-identical.core.bare = false.Found, not fixed here
a_rewrite_moves_only_white_space(proptest) fails on////\x0bon main as well.fuzz_differential.py --seed 1reports Rust/OCaml divergences on@licenselegal markers and one C++ raw-string case, on main as well.