Skip to content

feat: match history by manifest name field instead of filename for sparkline trends #320

@decko

Description

@decko

Problem

Sparkline trend indicators in the HTML report match history entries by manifest filename (manifest_file.name — the path basename). This means:

  • raki run -m /tmp/soda-trend.yaml writes history under soda-trend.yaml
  • raki run -m ~/dev/soda/raki-eval.yaml writes history under raki-eval.yaml
  • Even if both manifests have name: soda-development, they don't share history

Real-world usage evaluates multiple projects (raki sessions, soda sessions, alcove sessions), each with their own manifest file in different locations. The current filename matching prevents trend accumulation across runs of the same logical evaluation.

Proposed fix

Match history entries by the manifest's name: field (from the YAML content) instead of the filename.

Changes needed

  1. HistoryEntry — already has a manifest field. Change append_history_entry() to store manifest.name (the YAML name: field) instead of manifest_file.name (the filename).

  2. build_sparkline_data() — already accepts manifest: str. No change needed — callers pass the value.

  3. CLI (cli.py) — change the sparkline call from:

    manifest=manifest_file.name,  # filename

    to:

    manifest=manifest.name,  # YAML name field
  4. Backward compatibility — old history entries store filenames. The match will miss them, causing a one-time loss of trend data after upgrade. Document this in the changelog.

  5. load_run_ids() and duplicate detection — also uses manifest field. Update find_last_matching_entry() to match by manifest name instead of filename for consistency.

Acceptance criteria

  • append_history_entry() stores manifest.name (YAML name field) in HistoryEntry.manifest
  • Sparkline build_sparkline_data() called with manifest=manifest.name in CLI
  • Duplicate-run detection uses manifest.name for matching
  • Old history entries (filename-based) silently don't match — no error, just no trend data until next run
  • Two runs with different manifest filenames but same name: field share trend history
  • Tests cover: same name different files → shared history; different names → separate history
  • Towncrier fragment (changes/320.feature)

Supersedes

This replaces the original "fallback to unfiltered history" approach. Matching by name is cleaner than falling back — it groups evaluations by intent (what project am I evaluating?) rather than by file path.

Plan

  1. In cli.py, change sparkline call from manifest=manifest_file.name to manifest=manifest.name
  2. In history.py, change append_history_entry() to store manifest.name (YAML name field) instead of manifest_file.name
  3. Update find_last_matching_entry() to match by manifest name for consistency
  4. Tests: two runs with different filenames but same name: field share trend history
  5. Tests: different name: fields produce separate histories
  6. Towncrier fragment (changes/320.feature)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions