ktg-plugin-marketplace/plugins/voyage/tests/lib
Kjell Tore Guttormsen c412f72605 test(voyage): add annotation roundtrip + rollback + source_annotations integration — v4.2 Step 7
Implements SC2/SC3/SC5b/SC7 + additive-field invariant for the v4.2
annotation pipeline:

Fixtures (tests/fixtures/annotation/):
  - annotation-brief.md           — brief-validator-clean fixture
  - annotation-plan.md            — plan-validator-clean (2 steps)
  - annotation-review.md          — review-validator-clean
  - annotation-plan-large.md      — 51 steps (SC3 scale fixture)

Integration tests:
  - tests/integration/annotation-roundtrip.test.mjs — 7 cases:
    SC2 byte-identical empty round-trip across brief/plan/review,
    SC3 scale (51 steps + 100 anchors) round-trip,
    SC7 parseAnchors(stripAnchors(addAnchors(...))) === [] per target.
  - tests/integration/schema-rollback.test.mjs — 4 cases:
    SC5b validator-FAIL -> revisionGuard rolls back byte-identical
    (sha256 invariant) for brief/plan/review + cross-target sweep.
    .local.bak deleted on rollback path (validator-PASS path tested
    in lib/util/revision-guard tests).
  - tests/lib/source-annotations.test.mjs — 6 cases mirroring
    tests/lib/source-findings.test.mjs additive-field pattern: each
    validator (brief/plan/review) accepts source_annotations as
    additive-optional, parser extracts as array of dicts, entries
    conform to documented shape, baseline forward-compat (artifacts
    without source_annotations still validate).

Verify: node --test tests/integration/annotation-roundtrip.test.mjs
       tests/integration/schema-rollback.test.mjs
       tests/lib/source-annotations.test.mjs -> 17 pass / 0 fail.
Full npm test: 577 pass / 0 fail / 2 skipped (Docker).

Refs plan.md Step 7 + plan-critic M4 + plan-critic B4.
2026-05-09 15:13:27 +02:00
..
agent-frontmatter.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
arg-parser.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
atomic-write.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
autonomy-gate.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
bash-normalize.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
cleanup.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
doc-consistency.test.mjs feat(voyage): add commands/trekrevise.md — 7th pipeline command + settings.json scope — v4.2 Step 6 [skip-docs] 2026-05-09 15:09:01 +02:00
finding-id.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
frontmatter.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
gates-flag-coverage.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
jaccard.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
main-merge-gate.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
manifest-schema-extensions.test.mjs feat(voyage): add OPTIONAL_STRING_KEYS path to manifest-yaml — profile_used additive 2026-05-09 09:23:32 +02:00
manifest-yaml.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
markdown-write.test.mjs feat(voyage): add markdown-write.mjs + revision-guard.mjs + forward-compat policy comments — v4.2 Step 1 2026-05-09 12:48:40 +02:00
plan-review-dedup.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
plan-schema.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
profile-application.test.mjs feat(voyage): add lib/profiles/resolver.mjs — locked interface SC #5-#9 2026-05-09 09:29:01 +02:00
profile-flag-coverage.test.mjs feat(voyage): document --profile flag in all 6 commands — SC #4 + arv-policy 2026-05-09 09:38:36 +02:00
profile-stats-fields.test.mjs feat(voyage): add 5 additive profile fields to JSONL stats — SC #11 2026-05-09 09:40:21 +02:00
project-discovery.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
review-determinism.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
revision-guard.test.mjs feat(voyage): add markdown-write.mjs + revision-guard.mjs + forward-compat policy comments — v4.2 Step 1 2026-05-09 12:48:40 +02:00
rule-catalogue.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
source-annotations.test.mjs test(voyage): add annotation roundtrip + rollback + source_annotations integration — v4.2 Step 7 2026-05-09 15:13:27 +02:00
source-findings.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00
stats-event-emit.test.mjs feat(voyage)!: marketplace handoff — rename plugins/ultraplan-local to plugins/voyage [skip-docs] 2026-05-05 15:37:52 +02:00