okl export writes stamps made on other branches into this branch's snapshot

Closed
#378 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

A pull request for this has already been merged.

  • #382 by @emeraldleaf — merged

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Read src/okl/drift.py, especially _on_this_branch() and drift.snapshot(), then trace how okl export and the refresh in okl verify build snapshots. Check the two branch cases in the issue: exporting on A should retain A’s committed entry for a lesson stamped on B, while exporting on B should include B’s stamp. Confirm A’s gate stays green and held back lessons are named.

Written by the indexing model from the issue text.

Description

Where it stands (main, 24784b4)

One store serves every branch of a checkout. drift.snapshot() (src/okl/drift.py:474) writes every file-governed lesson with its latest stamp, whichever branch that stamp was made on. In a consumer repo with stacked PRs (A ← B ← C), a lesson stamped on B's commit went into A's snapshot. Its governed file differs on A, so A's gate went red for a lesson A never touched. The agent rebuilt A's snapshot by hand: A's committed entries, plus the two it had changed.

drift._on_this_branch() (src/okl/drift.py:110) already tells whether a stamp's commit is reachable from HEAD, and okl drift uses it to report off-branch stamps (#126). okl export and the refresh that okl verify does do not use it.

Proposal

Export writes a lesson's stamp only when its commit is reachable from HEAD. For any other lesson it keeps the entry already committed in the snapshot, or leaves the lesson out when there is none. It names each lesson it held back.

Tests

  • A two-branch fixture: a lesson stamped on branch B, exported on branch A, keeps A's committed entry, and A's gate stays green.
  • Exported on B, it carries B's stamp.

Related

  • On branch A, okl reverify reported "check FAILED (exit 4)" for two lessons whose test files exist only on later branches. Not stamping them was right, but "the check's files are not on this branch" would say what happened.
  • #242 (a merge driver for the snapshot) and #239.

🤖 Generated with Claude Code

Dominant language
Python
Stars
1
Forks
1
Avg merge
5h 50m
Merged PRs (30d)
125

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from emeraldleaf/okl

All issues in emeraldleaf/okl

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.