Skip to content

TODO #2

Description

@rogeralsing

User report of this issue


Last updated: 2026-01-22

Bugs

Docs

Features

Tests


Investigation

Delivery strictness: full - the complete outcome crosses CLI control flow, build-time release metadata, strategy-specific persisted filenames, documentation, and regression tests, and the repository's canonical quality-evidence producer is currently unavailable.

Current Evidence

  • The clean task worktree is at c700991 (origin/main, tag v0.6.0).
  • go run ./cmd/quickdup -h shows the already-correct -top wording (blended rank) and the replacement -min-rank wording (score + complexity); there is no remaining -min-score flag to repair.
  • go run ./cmd/quickdup --version exits with flag provided but not defined: -version. No version symbol/resolver exists in the current cmd/quickdup package.
  • .goreleaser.yaml currently uses only -s -w; it does not inject a release tag into main.version.
  • Runtime paths are strategy-specific: <strategy>-results.json in cmd/quickdup/main.go, <strategy>-ignore.json in pkg/quickdup/filter.go, and <strategy>-cache.gob in pkg/quickdup/cache.go. Cache load/save deliberately supports only word-indent. README still names generic results.json, cache.gob, and ignore.json in its explanatory sections and does not explain the exact score formula.
  • Current tests contain only limited score assertions and no focused ignore parsing or cache/ignore filename coverage. Historical implementation commits exist on unmerged branches, but they target the pre-pkg/quickdup layout and must be ported rather than cherry-picked.
  • Semantic source evidence confirms cmd/quickdup.main calls pkg/quickdup.LoadIgnoredHashes, and both indent strategies reach the shared scoreIndentShape implementation.

Blast Radius

  • cmd/quickdup/main.go - preserve the corrected rank help, add early --version handling, and make -no-cache help explicit about the word-indent scope.
  • cmd/quickdup/version.go - new main-package version value and deterministic resolution for release, module-build, VCS-revision, and development builds.
  • cmd/quickdup/version_test.go - focused version-resolution regression coverage.
  • .goreleaser.yaml - inject the release tag into the exact main.version symbol while preserving strip flags.
  • README.md - align score/rank semantics, strategy-specific result/cache/ignore filenames, and cache scope with current source.
  • pkg/quickdup/filter.go - make ignore-hash parsing explicit and testable if needed to preserve documented raw, bracketed CLI, and 0x forms and a safe empty result for missing/invalid files.
  • pkg/quickdup/filter_test.go - new ignore file creation, filename, valid-variant, and invalid-input coverage.
  • pkg/quickdup/strategy_score_test.go - new focused scoring coverage adapted to the shared strategy implementations.
  • pkg/quickdup/cache_test.go - new strategy-specific filename and word-indent-only cache coverage carried forward from the issue comment.

Dependencies

  • fk1 - repository canonical quality evidence is unavailable because .faktorial/main-verify.json and declared producers are missing; implementation can be prepared, but the required final run-quality gate cannot complete until that machine-owned repair lands.

User Stories

Story 1: As a QuickDup CLI operator, I want accurate help, version output, and documented output-state paths, so that I can invoke the tool and manage its generated files without guessing.

Story 2: As a QuickDup release maintainer, I want GoReleaser binaries to report their release tag and the behavior contract to be regression-tested, so that published artifacts are identifiable and completed maintenance work does not silently regress.

Approach

  1. Keep the current -min-rank and -top behavior; do not reintroduce obsolete -min-score. Add a version flag that returns before scan setup or timeout behavior. Put resolution in a small cmd/quickdup/version.go surface with dev as the source default, optional Go build-info/VCS fallback, and an ldflags-overridable main.version.
  2. Update GoReleaser ldflags to retain -s -w and add -X main.version={{.Tag}}. Exercise the resolver independently so local/development and injected release identities remain deterministic.
  3. Treat current production code as the documentation source of truth. Document the indent-strategy score as the effective unique-word count after imbalance penalty, multiplied by max(2*similarity-1, 0)^3, plus the integer pattern-length bonus; state separately that rank adds positive indentation complexity. Document <strategy>-results.json, <strategy>-ignore.json, and that only word-indent reads/writes <strategy>-cache.gob.
  4. Port the intended tests into the current package boundaries. Cover word-only, word-indent, normalized-indent, and inlineable scoring; missing/invalid and raw/bracketed/0x ignore hashes; strategy-specific ignore/cache paths; and the non-cacheable strategies. Avoid copying old concrete entry layouts that were removed by the library split.
  5. After fk1 restores repository-owned quality evidence, commit the coherent change and request Faktorial's canonical run-quality verification. Do not substitute agent-run unit tests for that gate.

Risks

  • The historical branches modify the old monolithic cmd/quickdup package; cherry-picking them would undo or conflict with the current library extraction.
  • GoReleaser injection silently fails if the symbol path or variable name differs from main.version; version tests alone do not prove the release YAML wiring.
  • The default strategy is normalized-indent, while caching currently exists only for word-indent; broad cache wording would remain misleading even if the filename were corrected.
  • Score tests can become implementation snapshots. Assert the documented behavior at meaningful boundary cases while preserving strategy-specific semantics.
  • Tests touching package globals such as ActiveStrategy, CommentPrefix, or build-info hooks must restore state and must not use unsafe parallel execution.

Additional quality gates

  • Canonical quality evidence - Do not advance to review until fk1 restores declared repository producers and Faktorial accepts complete build/test evidence from run-quality.
Requested behavior Risk lane Lane evidence Required proof or judgment Buyer consequence if missing Stop or downgrade trigger
Restore the complete issue #2 CLI, release, docs, and regression contract full Current main rejects --version, release ldflags omit the version, documentation contradicts persisted paths, and canonical evidence configuration is missing Accepted repository run-quality evidence after fk1, plus source/config review of the version injection and documentation contract Users can receive unidentifiable releases, misleading file guidance, or silently regressed parsing/scoring behavior Stop before review while fk1 is unresolved or evidence is missing/invalid; return to build on any behavior, test, or config mismatch

Recommended Labels

  • bug
  • documentation
  • enhancement

Acceptance Criteria (Refined)

  • AC-1: CLI help continues to describe -top as ranking by blended rank and -min-rank as the score-plus-complexity threshold; the obsolete -min-score flag is not reintroduced.
  • AC-2: quickdup --version prints exactly one quickdup <identity> line and exits successfully before scanning, creating .quickdup state, or starting timeout work.
  • AC-3: Development/module builds have a deterministic non-empty fallback identity, and a build with -X main.version=vX.Y.Z reports that injected identity.
  • AC-4: GoReleaser preserves its existing stripping flags and injects {{.Tag}} into the same main.version symbol consumed by the CLI.
  • AC-5: README accurately describes the current scoring curve and imbalance/length terms, distinguishes score from blended rank, and matches the current 0.75 similarity default.
  • AC-6: README and CLI help identify <strategy>-results.json, <strategy>-ignore.json, and word-indent-cache.gob behavior accurately, without implying that the default normalized-indent strategy is cached.
  • AC-7: Focused tests cover scoring for all current strategies and ignore parsing/file creation for raw, bracketed, 0x, invalid, and missing inputs using the current pkg/quickdup APIs.
  • AC-8: Focused tests cover strategy-specific cache/ignore filenames and prove that cache persistence is skipped for non-word-indent strategies.
  • AC-9: After fk1 completes, the committed change receives accepted canonical run-quality build/test evidence before review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions