Skip to content

test(config): make non-UTF-8 token fixture portable (octal, not hex printf) - #1

Merged
mattwilkinsonn merged 1 commit into
mainfrom
fix-non-utf8-token-test-portability
Aug 21, 2026
Merged

mattwilkinsonn merged 1 commit into
mainfrom
fix-non-utf8-token-test-portability

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

This PR is part of a stack containing 2 PRs:

  1. main
  2. "test(config): make non-UTF-8 token fixture portable (octal, not hex printf)" (this PR)
  3. fix: submit an explicitly-named bookmark regardless of author (RIG-2267) #2

The resolved_token_errors_on_non_utf8_output unit test generated its
invalid-UTF-8 bytes with sh -c "printf '\xff\xfe'". Hex \xHH escapes
are a bash / GNU-coreutils printf extension, not POSIX — a dash
/bin/sh (as on GitHub ubuntu-24.04) passes \xff through literally as
valid UTF-8, so String::from_utf8 succeeds and the test's expect_err
fails. POSIX-guaranteed octal \377\376 emits the same raw ff fe bytes
on every printf.

Test-only; the production non-UTF-8 rejection path is unchanged. This is
the fix that turns the fork's GitHub Actions CI green after the initial
seed.

…rintf)

`resolved_token_errors_on_non_utf8_output` generated its invalid-UTF-8
bytes with `sh -c "printf '\xff\xfe'"`. Hex `\xHH` escapes are a bash /
GNU-coreutils extension, not POSIX; a dash `/bin/sh` (GitHub ubuntu-24.04
runners) passes `\xff` through literally as valid UTF-8, so `from_utf8`
succeeds and the test's `expect_err` fails. POSIX-guaranteed octal
`\377\376` emits the same raw bytes on every printf.

Test-only; the production non-UTF-8 rejection is unchanged.
rigel-mintaka added a commit that referenced this pull request Aug 21, 2026
`jj-vine submit <bookmark>` silently no-ops — exit 0, "No bookmarks pushed" — when the bookmark's commit author differs from the configured jj `user.email`. The fleet's commit-author flip (`seal@sealedsecurity.com` → `mintaka@rigel.build`) left pre-flip commits authored under the old identity, so re-submitting one of those bookmarks quietly does nothing.

Root cause is a two-pass double-filter. `submit()` resolves the bookmark set from the revset (pass 1, verbatim), announces it, then re-resolves what to actually submit via `find_changes_to_submit` (pass 2). Pass 2 intersected the explicitly-named target with `mine()`, so a foreign-authored named bookmark resolved to the empty set — announced, then dropped, with a success exit.

Fix (both halves):

- **`find_changes_to_submit` (`src/submit.rs`)** — include an explicitly-named target *raw*; only the ancestry-walked companions stay narrowed by `mine()` (so a stacked submit still doesn't sweep in other people's bookmarks). Revset becomes `(({explicit}) | (({ancestry}) & mine() & bookmarks()) | ({pending})) ~ (::trunk())`.
- **`submit()` guard (`src/commands/submit.rs`)** — after pass 2, if pass 1 announced a non-empty bookmark set but pass 2 resolved nothing, fail loudly with an actionable message instead of exiting 0. The guard runs *before* `ForgeImpl::new`, so it fails before any token subprocess or HTTP-client construction.

Two red-green kill-tests: `find_changes_to_submit_includes_foreign_authored_named_target` (Option A — a bookmark authored under a different identity is still found) and `named_bookmark_in_trunk_errors_instead_of_silent_noop` (Option B — the guard fires). Both fail on the pre-fix code and pass after.

This fix originated in the orion `oss/forks/jj-vine/` subtree (RIG-2267) and moved here when the fork externalized to its own repo.

The `Test` CI job may show one pre-existing failure — `config::tests::resolved_token_errors_on_non_utf8_output`, a `printf '\xff\xfe'` fixture that only emits non-UTF-8 bytes under bash, not the dash `/bin/sh` on GitHub's ubuntu runners. That is unrelated to this change and is already fixed by PR #1 (`fix-non-utf8-token-test-portability`); it clears once that merges.

Spec-impact: none.

Closes RIG-2267

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@mattwilkinsonn
mattwilkinsonn merged commit 7b20f58 into main Aug 21, 2026
2 of 8 checks passed
@mattwilkinsonn
mattwilkinsonn deleted the fix-non-utf8-token-test-portability branch August 21, 2026 16:49
mattwilkinsonn added a commit that referenced this pull request Aug 21, 2026
…67) (#2)

* fix: submit an explicitly-named bookmark regardless of author (RIG-2267)

`jj-vine submit <bookmark>` silently no-ops — exit 0, "No bookmarks pushed" — when the bookmark's commit author differs from the configured jj `user.email`. The fleet's commit-author flip (`seal@sealedsecurity.com` → `mintaka@rigel.build`) left pre-flip commits authored under the old identity, so re-submitting one of those bookmarks quietly does nothing.

Root cause is a two-pass double-filter. `submit()` resolves the bookmark set from the revset (pass 1, verbatim), announces it, then re-resolves what to actually submit via `find_changes_to_submit` (pass 2). Pass 2 intersected the explicitly-named target with `mine()`, so a foreign-authored named bookmark resolved to the empty set — announced, then dropped, with a success exit.

Fix (both halves):

- **`find_changes_to_submit` (`src/submit.rs`)** — include an explicitly-named target *raw*; only the ancestry-walked companions stay narrowed by `mine()` (so a stacked submit still doesn't sweep in other people's bookmarks). Revset becomes `(({explicit}) | (({ancestry}) & mine() & bookmarks()) | ({pending})) ~ (::trunk())`.
- **`submit()` guard (`src/commands/submit.rs`)** — after pass 2, if pass 1 announced a non-empty bookmark set but pass 2 resolved nothing, fail loudly with an actionable message instead of exiting 0. The guard runs *before* `ForgeImpl::new`, so it fails before any token subprocess or HTTP-client construction.

Two red-green kill-tests: `find_changes_to_submit_includes_foreign_authored_named_target` (Option A — a bookmark authored under a different identity is still found) and `named_bookmark_in_trunk_errors_instead_of_silent_noop` (Option B — the guard fires). Both fail on the pre-fix code and pass after.

This fix originated in the orion `oss/forks/jj-vine/` subtree (RIG-2267) and moved here when the fork externalized to its own repo.

The `Test` CI job may show one pre-existing failure — `config::tests::resolved_token_errors_on_non_utf8_output`, a `printf '\xff\xfe'` fixture that only emits non-UTF-8 bytes under bash, not the dash `/bin/sh` on GitHub's ubuntu runners. That is unrelated to this change and is already fixed by PR #1 (`fix-non-utf8-token-test-portability`); it clears once that merges.

Spec-impact: none.

Closes RIG-2267

Co-authored-by: Matt Wilkinson <matt@rigel.build>

* fix(submit): cover ancestry mine()-narrowing and drop ANSI from guard error (RIG-2267)

Addresses the review of the RIG-2267 fix.

- Test (medium): the fix has a dual invariant — an explicitly-named target is taken raw, but ancestry-walked companions stay `& mine()` so a stacked submit does not sweep in other people's bookmarks. Only the first half was covered. Adds `find_changes_to_submit_excludes_foreign_authored_ancestry_companion`: a stack `a(mine) -> c(foreign) -> b(mine)` where submitting `b` must resolve to exactly `{a, b}` — `c` is excluded by `& mine()`. Proven red (resolves `["a","b","c"]`) if `& mine()` is dropped from the ancestry branch, green with the fix. The two-explicit-target assertion in the same test also exercises the multi-target `join(" | ")` on both the explicit and ancestry branches, previously only single-target.

- Guard message (low): the announce-then-empty backstop rendered bookmark names through `BookmarkOrPending`'s `Display`, which colorizes unconditionally (`.magenta()`), so the propagated error string carried raw ANSI escapes into non-tty stderr / CI logs. Switch to `JJName::raw_name()` for the uncolored name.

No production revset or control-flow change; `find_changes_to_submit` and the guard placement are unchanged.

Spec-impact: none. Refs RIG-2267

Co-authored-by: Matt Wilkinson <matt@rigel.build>

---------

Co-authored-by: Matt Wilkinson <matt@rigel.build>
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.

2 participants