Repository navigation
test(relations): cover a learning that lives in the learnings worktree - #1729
Conversation
Closing Tencent#1552 left one follow-up: several relation paths are enforced in code with no test of their own, and the first is a link whose *source* learning lives in the `teamai-learnings` worktree rather than under `repo.localPath`. The case writes a learning there, declares `REFERENCES: rules/payments.md`, and asks recall for the rule: the rule's hit answers `←` for it, which is only true if the source resolved against the worktree checkout. The fixture builds that worktree the way `teamai init` does — an orphan branch, then a worktree beside the clone — and the commit is tolerant of a retry that finds its learning already on the branch. Refs Tencent#1552 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
No findings in the specified diff. This is a tests-only change. The PR description records six passing E2E cases, typecheck, and lint; no additional real-CLI verification record is required. I only read the diff and trusted base review rules. I did not run, build, or install anything from the PR. |
SaulMoro
left a comment
There was a problem hiding this comment.
This was generated by AI during triage.
Approving at 8ccb12e6. This covers the first #1552 follow-up row: a relation whose source learning lives in the teamai-learnings worktree. The assertion checks the right thing. The ← REFERENCES on the rule's hit only appears if recall read the learning from the worktree, not from repo.localPath. The fixture builds the worktree the way init does, as an orphan branch beside the clone, and the commit helper tolerates a retry that finds the learning already committed. Since this changes tests only, no real-CLI record is needed.
CI review. It reported no findings. I agree.
[P3 nit] 'learnings-wt' is spelled out in the test. Importing LEARNINGS_WORKTREE_DIRNAME from src/types.ts would keep it pointed at the directory teamai actually uses if that name ever changes. This is optional.
I'll merge once CI is green at this head.
What
Adds the first of the follow-ups #1552 left when it closed: a relation whose source learning lives in the
teamai-learningsworktree, rather than underrepo.localPath.One case in
relations-e2e.test.ts, plus the fixture that builds the worktree.Why
SaulMoro's closing comment on #1552 listed several paths enforced in code with no test of their own:
This is the first row. It is the one with the most machinery behind it: learnings publish to an orphan
teamai-learningsbranch checked out in a worktree beside the team clone, so a relation declared there resolves against a checkout that is not the onerepo.localPathnames.The case
The test writes
learnings/alpha/ledger-timeout.mdinto that worktree, declaringREFERENCES: rules/payments.md, and asks recall forpayments ledger:The
←on the rule's own hit is what proves the source resolved: the relation started from a learning in the worktree, and the other end answered for it. Without the worktree being read, nothing points back.Verification
vitest run --config vitest.e2e.config.ts src/__tests__/relations-e2e.test.ts— 6 passed (the 5 existing cases plus this one).npm run typecheckandnpm run lintpass.The fixture builds the worktree the way
teamai initdoes — an orphan branch with no team files, thengit worktree addbeside the clone — and returns early whenpullalready made one, which it does for a non-HTTP team. The commit tolerates a retry that finds its learning already on the branch, so the case is re-runnable.Limitations
learnings/shape check,importcells) are still untested.pull, and a learning added to the branch afterwards is not in it until the index is rebuilt. That is a separate behaviour, not part of this row.teamai contribute, so it tests the relation resolution and not the publish path.Refs #1552
🤖 Generated with Claude Code