Skip to content

Lab: gndx emmylua test runs cargo fmt --check; dirty-tree lint says "commit, then re-lint" #5

Closed

Description

@mareklangiewicz

Lab issue (neospector lua/myemmylab*.lua).

Problem

  • A formatting slip shows up only at lint, after the tests have passed. Running cargo fmt --check (it's cheap) at test catches it earlier.
  • lint on a dirty tree checks the tree but can't record a verdict for HEAD. Its output doesn't say that, so it reads like a pass that install then refuses.

Want

  • test runs cargo fmt --check first and reports it, but doesn't block.
  • lint on a dirty tree ends with "uncommitted changes: verdict not recorded; commit, then re-lint".

Activity

  1. added
    ready-for-agent
    enhancement
    and removed
    needs-triage
    on Nov 17, 2026
  2. mareklangiewicz commented on Nov 17, 2026

    @mareklangiewicz
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: enhancement
    Summary: gndx emmylua test reports cargo fmt --check up front (it never blocks), and gndx emmylua lint on uncommitted changes ends with a verdict line that says it was not recorded and what to do next

    Where: the gndx emmylua lab in neospector (myvi). The commands test and lint are in myemmylabcli, the pure parts and LINT_STEPS are in myemmylab, and the ONest tests are in myemmylabtree.

    Current behavior:

    • test runs only cargo test in the capped unit. A formatting slip surfaces later, at lint, after the tests have passed.
    • lint on a worktree with uncommitted changes runs LINT_STEPS (fmt, clippy) and prints lint: NOT recorded: the verdict is about uncommitted changes, not a commit, but its last line is still lint: PASSES or lint: FAILS. That last line is what a reader (or a | tail) sees. It reads like a pass that builds emmylua install then refuses.

    Desired behavior:

    • test runs the fmt step from myemmylab.LINT_STEPS (the same arguments; one source of truth, not a copy) before cargo test, and prints fmt: PASS or fmt: FAIL (run cargo fmt --all; lint will refuse) with the files that would change. The exit code of test never depends on fmt. If fmt itself can't run, say so and continue.
    • lint, on uncommitted changes, ends with one verdict line that carries all three facts: the result, that it was not recorded, and the next step. For example lint: PASSES on uncommitted changes, NOT recorded: commit, then run gndx emmylua lint <wt> again, and the same shape for FAILS. On a clean HEAD the output is unchanged.
    • Exit codes of lint don't change.

    Key interfaces:

    • myemmylab.LINT_STEPS: read by name (fmt). Don't duplicate its args.
    • A small pure function in myemmylab that builds the final lint verdict line from (pass, dirty, worktree), so it can be tested without cargo.

    Acceptance criteria:

    • An ONest case pins the verdict line: clean+pass and clean+fail keep today's text, and dirty+pass and dirty+fail say "NOT recorded" and "commit, then run … lint … again". The case fails before the change.
    • An ONest case pins that the fmt arguments test uses are exactly LINT_STEPS's fmt args.
    • By hand, on a scratch emmylua worktree with a deliberately misformatted file (revert afterwards): gndx emmylua test <wt> --filter <one test> prints fmt: FAIL … and still exits 0 when the test passes; gndx emmylua lint <wt> ends with the dirty verdict line. Record both outputs in the issue.
    • gndx spector tree passes, and gndx spector check emmylua is clean.

    Out of scope:

    • Running clippy in test (it's slow; it stays in lint).
    • Auto-formatting anything.
    • Changing what lint records in the ledger, or install's refusal rules.
  3. mareklangiewicz commented on Nov 17, 2026

    @mareklangiewicz
    OwnerAuthor

    Done in myvi 1f015ab (not pushed yet).

    • lab.lint_step(name): test gets fmt's args from LINT_STEPS through it (lab.TEST_PRE_STEP = 'fmt'). fmt runs via plain exec (it builds nothing), outside the capped unit, so a busy unit can't stop test over it.
    • lab.fmt_report(ok, out): fmt: PASS / fmt: FAIL (run cargo fmt --all; lint will refuse) plus each file once (both Diff in F:N: and Diff in F at line N:) / fmt: NOT CHECKED (<first line>) when it failed with no diff.
    • lab.lint_verdict(pass, dirty, wt): clean HEAD unchanged; dirty → one last line. The separate earlier NOT recorded line is gone.
    • ONest: 6 new cases, all red first. gndx spector tree 1096/1096, gndx spector check emmylua CLEAN.

    By hand on the bisect scratch worktree (b5281dea, lib.rs misformatted, reverted after):

    $ gndx emmylua test …/bisect --filter test_primitives_and_consts    # exit 0
    fmt: FAIL (run cargo fmt --all; lint will refuse)
      …/bisect/crates/emmylua_code_analysis/src/lib.rs
      …/bisect/crates/emmylua_code_analysis/src/semantic_model/infer/vm.rs
    test: 1 test(s) of emmylua_code_analysis passed in …/bisect
    
    $ gndx emmylua lint …/bisect                                         # exit 1
    FAIL fmt
    PASS clippy
    lint: FAILS on uncommitted changes, NOT recorded: commit, then run gndx emmylua lint …/bisect again
    

    vm.rs was not part of the probe: b5281dea itself is misformatted there, which the new check catches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions