Skip to content

Test filter fails on no match; relative lock paths; remove; init --lib - #142

Merged
rendro merged 13 commits into
w1/syntax-hintsfrom
w1/cli-packages
Oct 23, 2026
Merged

rendro merged 13 commits into
w1/syntax-hintsfrom
w1/cli-packages

Conversation

@rendro

@rendro rendro commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Wave 1, lane L, step 3 (stacked on #138): CLI and packages, decided by the owner on 2026-10-22.

  • silt test --filter X that matches no test prints no test matches --filter 'X' on stderr and exits 1 (it said "no matching test files found" and exited 0).
  • silt.lock stores a path dependency relative to silt.toml (absolute only where no relative form exists).
  • silt remove <name>.
  • silt init --lib creates src/lib.silt.

Verified by an independent verifier; its findings are fixed. The owner approved every new message text on 2026-10-23.

`silt test --filter X` where no test's name contains X wrote "no
matching test files found" to stdout and exited 0, so a typo in the
filter passed as a green run. It now writes, on stderr,

  no test matches --filter 'X'

and exits with status 1 (owner's wave-1 L3). A run without --filter
that finds no test file is unchanged.

Docs: testing.md. Tests: cli/test/cli__filter_empty_result_exits_zero
becomes cli__filter_that_selects_nothing_fails (exact stdout/stderr,
exit 1); lang/tooling wave1_tooling__filter_does_not_take_comment
_for_test and wave1_tooling__guard_filter_no_such_test expect the new
text and exit 1.
A path dependency's entry in silt.lock was its absolute, canonical
path, so moving a package with its dependencies, or checking it out
in another place, rewrote the lockfile. It is now the path relative to
the directory of the silt.toml the lockfile belongs to, with `/`
between its parts on every system (owner's wave-1 L3):

  source = { path = "../calc" }

A dependency of a dependency is written relative to the same
directory; a path with no relative form (another drive) stays
absolute. A lockfile with the old absolute form is pins-different
and is rewritten on the next run; nothing reads the old form
specially. The checksum and tamper checks are unchanged.

One helper for the relative form: `lockfile::relative_path`, used by
the resolver for the lock and by `silt add` for silt.toml (the bin's
`paths::relative_from` and `add::manifest_relative` are gone). It also
refuses two paths on different drives, which the old helper turned
into a broken `..\C:\...`.

Docs: getting-started.md. Tests: tests/cli/lockfile_tests.rs gets
three (the relative paths of a direct, a transitive and an inner
dependency; a moved workspace keeps its lockfile byte for byte; an
absolute lock is rewritten relative), each failing on the base; a unit
test of relative_path; stage5_package_graph_tests'
a_lock_entry_for_another_source_is_stale_and_rewritten expects
`path = "good"`.
@rendro
rendro added this pull request to stack #139 October 23, 2026 08:23
rendro added 11 commits October 23, 2026 08:35
A new subcommand (owner's wave-1 L3): `silt remove calc` drops the
dependency `calc` from the current package's silt.toml, keeping the
rest of the file as it is (comments, order, formatting: toml_edit, as
`silt add` does), and regenerates silt.lock, which loses `calc` and
whatever only `calc` needed. On success it prints

  Removed dependency 'calc'

If the package graph does not resolve without it, silt.toml gets its
old text back (as with `silt add`). Refused, with nothing changed:

  error: silt remove: no dependency 'x' in silt.toml
  error: silt remove takes the name of one dependency: silt remove <name>
         Run 'silt remove --help' for usage.
  error: silt remove must be run inside a silt package

Wired into main.rs's dispatch and SUBCOMMANDS (the "did you mean"
list), `silt --help` (one more row) and `silt remove --help`. Docs:
README.md and getting-started.md (command lists), modules.md.
Tests: tests/cli/cli_remove_tests.rs (five), and the help-row count in
cli_round26_tests goes from 12 to 13.
`silt init --lib` creates silt.toml and src/lib.silt instead of
src/main.silt (owner's wave-1 L3):

  pub fn hello() -> String {
    "hello, silt!"
  }

and says

  created silt package `shapes`:
    .../silt.toml
    .../src/lib.silt

    check: silt check
    test:  silt test

(a library has nothing to run). It refuses an existing src/lib.silt
as plain `silt init` refuses an existing src/main.silt; plain `silt
init` is unchanged. `silt init --help` and the `silt --help` row name
the flag.

Docs: README.md, getting-started.md, modules.md. Tests:
tests/cli/cli_init_tests.rs gets two (the library checks and another
package imports it; an existing src/lib.silt is not overwritten).
examples_check locks the phrases of the top-level help that src/main.rs
lists against the real help text, README.md and getting-started.md: the
init row now names --lib, and the new remove row joins the list.
…hout follow-on errors (PR #138)

Fix round 1 (llv G3, G4). The help that a closure on the next line is
not passed to the call above now also fires when the closure is the
last statement of its block (a function's last line, a closure's
body). And when it fires, the errors that only follow from the
closure standing alone are dropped with its unused-value error: that
the types its parameters need cannot be inferred ("cannot infer the
type this needs to implement trait 'Number'"), that it is a mistyped
block value (the type mismatch at the closure), and, when the closure
is the last statement, that the call above it is unused. What is left
is one error per mistake, the call's, with the help.

An error elsewhere that follows from a block whose value became a
function (`println(f())` of such a block: Fn has no Display) stays: it
is at another place, about another expression.

New case: typecheck/diagnostics/trailing_closure__its_follow_on_errors
_go_too (exact stderr).
Fix round 1 (llv N1). With `import list as l` and a local `l`, the help
said "hides the module `l`", but the module is `list`. It now says

  `l` here is the local from line 10, which hides the module `list`
  (imported as `l`); rename the local

The resolver records the module's own name (the one after `import`)
with the name of the local. New case: typecheck/diagnostics/hidden
_module__an_alias_names_the_module_too (exact stderr).
Fix round 1 (llv G1, N5, G2).

G1: a lockfile written before the relative form (a path entry that is
the dependency's absolute path) made every command that never writes
the lock (disasm, the language server, watch's reading of the graph)
fail with "silt.lock is out of date for dependency `calc`: it pins
another source than this one", though it pins the same directory. A
path entry is now compared by the directory it names from the
project's directory (`LockedSource::same_place`); a writer still
rewrites the lock in the relative form.

N5: that rewrite said "Updating silt.lock for new dependencies in
silt.toml", but nothing in silt.toml is new. A rewrite with the same
pins (`Lockfile::same_places`, `LockChange::Rewritten`) now says only

  Updating silt.lock

G2: tests/lsp/rename_sweep/pkg2/silt.lock, the one tracked lockfile
with an absolute path (of a worktree that no longer exists), is
written relative (`path = "mathutil"`); `silt check main.silt` in a
copy leaves it as it is.

Test: lockfile_tests' test_lockfile_with_an_absolute_path_is_rewritten
_relative now also runs disasm on the old lock (accepted, not written)
and expects the run's stderr to be exactly "Updating silt.lock".
…fix (PR #142)

Fix round 1 (llv B1, N3).

B1: when the package graph did not resolve without the dependency,
the manifest got its old text back, but the diagnostics pointed at
lines of the text without the dependency: an error two lines below
the removed entry was reported one line too high. The graph is now
resolved once more on the restored file, and its diagnostics, with
the restored lines, are the ones reported.

N3: every error of the command starts "error: silt remove: ", as most
of the add command's do:

  error: silt remove: no dependency 'x' in silt.toml
  error: silt remove: expected the name of one dependency: silt remove <name>
  error: silt remove: must be run inside a silt package

Test: cli_remove_tests gets the restore case (the error at the line
of the restored file, the note, silt.toml unchanged); the usage and
outside-a-package cases expect the new texts.
Fix round 1 (llv N4). The body of the init command's --help said it
writes src/main.silt; it now says what --lib writes instead:

  Writes silt.toml and src/main.silt, a program, or with --lib
  src/lib.silt, a library for other packages to import; the
  package name is derived from the directory name.

Test: cli_init_tests test_init_help_tells_of_lib.
#134)

Fix round 1 (llv N6). The reference page and the golden cases of
list.sort_with compared by subtraction (`{ a, b -> a - b }`), which
overflows for Ints far apart, and the docs should not teach it. They
use `a.compare(b)` now (today's call form; lane T's script rewrites it
with the rest). Outputs unchanged.
…s separator

On Windows the created-package listing prints src\lib.silt; the test
looked for src/lib.silt and failed there (Test Windows rest3).
@rendro
rendro marked this pull request as ready for review October 23, 2026 14:56
@rendro
rendro merged commit fc55fc2 into main Oct 23, 2026
23 checks passed
@rendro
rendro deleted the w1/cli-packages branch October 23, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant