feat: emit <no-hash> for zero-match entries instead of failing#21
Merged
feat: emit <no-hash> for zero-match entries instead of failing#21
Conversation
Monorepo configs often glob files that aren't always present (unreleased features, feature-flagged directories, packages that don't have tests yet). A single zero-match entry shouldn't abort the entire invocation. Return a <no-hash> sentinel and keep going. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
📖 Docs preview: https://maastrich.github.io/hashup/branches/pr-21/ |
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.
Summary
When a config entry's glob matches zero files,
hashupnow emits the sentinel<no-hash>for that entry and continues processing the rest instead of aborting the whole run.In
--jsonmode:{ "hash": "<no-hash>", "files": [] }. The sentinel is also exported asNO_HASHfromsrc/cli/run-config-mode.tsfor programmatic callers.Motivation
Monorepo configs regularly glob files that aren't always present — a package that doesn't have visual tests yet, a feature-flagged directory, a generated dir that hasn't been seeded. Previously a single zero-match entry aborted the invocation; now it's a local, addressable signal downstream tooling can detect without gate-keeping the whole run.
Test plan
tests/cli/run-modes.test.ts:{ none: "src/*.missing", real: "src/a.ts" }) succeeds;noneemits<no-hash>,realemits a real digest--json+--filesfor a zero-match entry emits{ hash: "<no-hash>", files: [] }vp test— 121/121 passingvp checkcleanDocs
docs/guide/cli.md— replaced the "zero-match is an error" paragraph with the new sentinel behavior and a sample output block.🤖 Generated with Claude Code