Skip to content

test: cover the copy arm's descriptor pin with a swap after the pin (#1162 follow-up) #1176

Open

Description

@chappie-daemon

The copy arm's pin has no test that swaps the target after it

nostream-cli migrate pg-to-lmdb now opens its target through a descriptor held by
TargetPin (#1162, PR pending). Two of its three arms have a test that swaps the target
after the pin and fails if the arm opens the bare path:
the_verify_arm_reads_the_store_its_pin_names_rather_than_the_replacement and
the_completed_manifest_arm_reads_the_store_its_pin_names_rather_than_the_replacement
(both in crates/nostream-cli/src/commands/migrate.rs).

The copy arm — the one the issue was filed about — has none. Its wiring
(crates/nostream-cli/src/commands/migrate.rs, run_with's copy arm: create_target →
pin.root() → open_target(&root, …) → pin.verify(&options.target) → migrate_with(…, &root, …))
is guarded by the acceptance criteria's greps and by the compiler (both open_target and
migrate_with take the root), and by nothing else. Reverting that arm to
open_target(&options.target, …) would fail no test.

Why it cannot be written today

run probes the source before it creates the target
(PostgresBackend::probe_master_from_env), so without a reachable Postgres the pin is never
reached; crates/nostream-cli/tests/migration_pg.rs is #[ignore]d and needs a database, and
the factory member that built this has none.

What would close it

Either of:

  • give run_with an injectable source the way it already takes an injectable after_pin
    closure, and drive run_over_a_swap's harness with a stub MigrationSource; or
  • run run over the same harness inside the CI job that has Postgres, so the copy arm's pin
    and open are exercised under a swap end to end.

The harness (run_over_a_swap, prepared_migration, copy_store) already exists and would
need one more line: a store behind the stub source, and the stub target's migrate_with call.

Evidence

  • build.md § Round 1a (job 031-held-descriptor): the copy arm's pin is unreachable without
    Postgres; recorded as the one arm with no test.
  • Round-2 code review, Note 10: the gap is bounded by pin.verify sitting between the open and
    the first write, so nothing is wrong today — this is missing coverage, not a known defect.

Activity

  1. added
    test
    rewrite
    rust
    factory
    on Nov 19, 2026
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

    factoryrewriterusttest

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions