Skip to content

fix(push): offer a doc edited in the docs mirror - #1875

Merged
SaulMoro merged 1 commit into
Tencent:mainfrom
Walternater:fix/docs-mirror-push
Nov 15, 2026
Merged

SaulMoro merged 1 commit into
Tencent:mainfrom
Walternater:fix/docs-mirror-push

Conversation

@Walternater

@Walternater Walternater commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

teamai status and teamai push now offer an edit a member made to a delivered doc in the docs mirror (sharing.docs.localDir), at the doc's team path docs/<rel>. Before, only an edit in the team clone's checkout was scanned — and pull keeps that checkout clean, so the edit the member could actually make was invisible while teamai doctor skipped the mirror file as a copy of a team version (for #1851).

A mirror file that matches any version of that doc in the team's history is a copy, not an edit, so a stale copy never proposes to overwrite the team's newer file, and an edit in the checkout still wins for the same path (both name the same team file). Only docs the team already has are considered: the user-scope mirror is machine-wide and can hold other teams' docs, so a file for a doc the team does not have stays where it is.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Test Plan

  • npx vitest run src/__tests__/docs.test.ts — 34 tests pass, including 6 new ones for this scan: an edited delivered doc is offered as modified at docs/team.md with sourcePath in the mirror; the team's current version and an older delivered version are not offered; a mirror file for a doc the team does not have is not offered; a clone edit of the same path wins and the path appears once; a linked mirror root is not read; the scan leaves self mode alone.
  • src/__tests__/push-env.test.ts, push-team-config.test.ts, push-all-resources-namespaces.test.ts — pass (the scan also runs for every push, including configs built without the schema defaults).
  • npx tsc --noEmit clean; npm run lint passes.
  • Full suite locally: 24035 passed, 25 failed, 32 skipped. The 7 failing files (gitlab-*, git-discovery, git-stalled-remote, workflow-pr-providers, model-switch) fail the same way on main in this sandbox (23 failures, same tests: GitLab URL/token parsing, symlink teardown, stalled-ssh timing), so they are environmental, not from this change. docs and every push-* suite pass.
  • On the merged base (b04409d9, after fix(doctor): guide users to publish kept docs mirror edits #1862/fix(status): show kept docs mirror edits separately #1871) a real CLI world (20261115T032950-e270e5) shows the edit once: status → [docs] 1 new (no separate "kept mirror edits" section), --dry-run push → [docs] team.md (modified), and doctor says plain push offers the edit instead of saying it does not scan the mirror.
  • Real CLI pair, plain filesystem setup (teamai init --provider git, fake team repo at file://…/team.git):
    • FAILED in world 20261115T012357-b7af55, built from main: after teamai pull delivered docs/team.md into knowledge-base/ and I appended a line there, teamai status ended with Local resources not yet pushed: / (none), and teamai --dry-run push said ℹ No new or modified resources to push.
    • VERIFIED in world 20261115T021503-4b0608, built from this branch: same setup and edit gives [docs] 1 new in status and 1. [docs] team.md (modified) / from: …/project/knowledge-base/team.md in push. teamai push then printed ✔ Pushed branch teamai/push/TeamAI-World/20261115-101515; git show <branch>:docs/team.md on the team repo is Team doc + Member line, so the mirror edit landed at the team path. (Creating a PR then fails with Automatic pull/merge request creation is not supported for generic Git hosts — expected for --provider git.)

Notes

@github-actions

Copy link
Copy Markdown

No confident findings in the specified diff.

The PR description provides sufficient testing: focused unit tests, type checking, lint, and a representative real-CLI world run confirming the mirror edit is pushed to docs/team.md. No additional tool × provider matrix is required.

Review was read-only; no PR code was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Requesting changes at dcbf097. The scan itself works. The problem is that the branch starts from 17238b7, before #1862 and #1871 landed, and both of those tell members that plain push does not see mirror edits. Once this PR merges, that is no longer true.

[P1 blocking] After merging into main, status and doctor say the opposite of what push does

I merged this head into main (1bc2ce1) locally and ran the real CLI in a verify world. The setup was a git team repo with docs/team.md, then teamai pull, then a line appended to .teamai/docs/team.md:

$ teamai status
ℹ Local resources not yet pushed:
  [docs] 1 new

ℹ Kept docs mirror edits (not scanned by plain push):
  …/project/.teamai/docs/team.md (team path: docs/team.md)
  To propose one edit, use `teamai push --file "<mirror-file>" --path "<team-path>"`.

$ teamai --dry-run push
    1. [docs] team.md (modified)
       from: …/project/.teamai/docs/team.md

$ teamai doctor
    → Kept …/.teamai/docs/team.md: … Plain `teamai push` does not scan this mirror. To propose a kept edit …

Status shows the same file twice, once as pending and once under a heading that says plain push does not scan it, and doctor says the same. Both come from main:

  • src/status.ts:244, the "Kept docs mirror edits (not scanned by plain push)" section from #1871;
  • src/doctor-delivery.ts:2771, the "Plain teamai push does not scan this mirror" sentence from #1862.

Once push offers the edit, the status section only repeats what "Local resources not yet pushed" already lists. The doctor sentence becomes false. Please rebase onto main and, in this PR:

  • remove the status section;
  • drop the doctor sentence. Doctor's "Kept …" note can stay as it is, or say that teamai push offers the edit.
  • update the cases that pin the old text: git-exclude-delivered-915.test.ts:1447/:1459 and doctor-delivery.test.ts:491.

Without this, the three commands disagree about the same file.

What I checked

  • Red on main, green here. With 17238b7's src/resources/docs.ts, 1 of the new docs.test.ts cases fails, and the other 5 already pass because they guard what must stay out. With this head, all 34 pass, including after the local merge into main.
  • Push offers the edit. On the merged build, teamai --dry-run push lists team.md (modified) from the mirror, which matches your VERIFIED record.
  • Namespaces. Namespace docs live under docs/<ns>/ with no overlay, so a mirror path maps 1:1 to docs/<rel>, and inactive namespace directories are withdrawn from the mirror by pull. Copies of older versions are skipped through isTeamaiCopy's history check.

Hidden scope

  • A plain teamai push now proposes edited mirror docs that it used to ignore (src/resources/docs.ts:742-785). That is what #1851 asks for, and the CHANGELOG lists it. I'm noting it because a member who kept local notes in a delivered doc will now see them proposed.

[P3 nit]

  • Status counts the edit as [docs] 1 new while push says (modified). You flagged it already; fine to leave.
  • In user scope, the mirror is shared by every team on the machine. Another team's file at the same docs/<rel> as one of this team's docs would be offered as an edit. Unlikely, and the tracked filter already narrows it.

CI review. No findings. We disagree on one point: the conflict with #1862 and #1871 only shows up against current main, so it was missed by a review that read the diff alone.

Merge risk. Medium as it stands, because members would get contradictory guidance. Low once the two hints are reconciled: the scan runs only where push scans already run (status, push, remove).

`status` and `push` only scanned the team clone's checkout, which `pull`
keeps clean, so an edit a member made in the docs mirror
(`sharing.docs.localDir`) was invisible while `doctor` skipped those files
as copies (Tencent#1851). Scan the mirror too, at team paths `docs/<rel>`, and
only for docs the team already has: the user-scope mirror is machine-wide,
so a file for a doc the team does not have stays where it is. A mirror
file matching a version in the team history is a copy, not an edit, so a
stale copy never proposes to overwrite the team's newer file. An edit in
the checkout still wins for the same path.

Since plain `push` now offers the edit, drop the `status` section and the
`doctor` sentence from Tencent#1871/Tencent#1862 that said it does not: they would tell
a member the opposite of what `push` does.
@Walternater

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (b04409d9, which carries #1862 and #1871) and reconciled both hints at f15b6db4.

  • status: the Kept docs mirror edits (not scanned by plain push) section is gone — the edit now appears only once, under Local resources not yet pushed: as [docs] 1 new. src/status.ts no longer imports lstat, isLinkedDocsRoot, membersDocs, resolveDocsDestination or resolveDocsForDirectory.
  • doctor: the sentence now reads Plain `teamai push` offers an edited delivered doc. To propose just one, use `teamai push --file "<mirror-file>" --path "docs/<relative-path>"` …. The Kept … note itself is untouched, and the --file hint stays for proposing one edit.
  • tests: git-exclude-delivered-915.test.ts now asserts the single listing ([docs] 1 new) and that the old heading is gone, instead of pinning the section text; doctor-delivery.test.ts still passes unchanged since the --file hint it looks for is still there.

Re-verified on the merged base with a real CLI world (20261115T032950-e270e5): after pull delivered docs/team.md and I appended a line to the mirror,

$ teamai status
ℹ Local resources not yet pushed:
  [docs] 1 new

$ teamai --dry-run push
    1. [docs] team.md (modified)
       from: …/project/knowledge-base/team.md

and teamai doctor's docs check ends with the new "offers an edited delivered doc" sentence, no "does not scan this mirror". Focused suites green: docs 34, push-env / push-team-config / push-all-resources-namespaces 57, doctor-delivery 70, and the status e2e file 55 (vitest.e2e.config.ts, with build). Full suite still shows only the pre-existing environment failures listed in the body.

On the hidden scope you noted: agreed, a plain push now proposes edited mirror docs; the CHANGELOG calls that out and I left status's count wording as is per your P3.

@github-actions

Copy link
Copy Markdown

No confident findings in the specified diff under the base version’s Code Review Rules. The earlier pass reported no findings, so none require resolution.

The PR description documents sufficient testing, including a representative real-CLI world run confirming the mirror edit reaches docs/team.md. No additional tool × provider matrix is required.

Review was read-only; no PR code was run, built, or installed.

@SaulMoro SaulMoro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was generated by AI during triage.

Approving at f15b6db. The [P1 blocking] from my last review is resolved.

What changed since dcbf097

  • Rebased onto b04409d, which carries #1862 and #1871.
  • Status. The "Kept docs mirror edits (not scanned by plain push)" section is removed from src/status.ts, along with its imports. An edited mirror doc now shows once, under "Local resources not yet pushed".
  • Doctor. src/doctor-delivery.ts:2771 now says plain push offers the edit, and keeps the --file hint for proposing just one. It is still gated by canPropose, so read-only HTTP teams don't get it.
  • Scan unchanged. src/resources/docs.ts and docs.test.ts are identical to the previous head.

What I checked

  • Tests on this head:
    • docs.test.ts and doctor-delivery.test.ts: 104 pass.
    • git-exclude-delivered-915.test.ts through test:e2e, with this head built: 55 pass.
    • Typecheck passes.
  • The rewritten E2E case still guards the member's own files. [docs] 1 new means only guide.md counts, so mine.md, dir-doc.md and deep.md are still excluded, and the edited bytes stay put.
  • Real CLI. I did not rerun it on this head, because the scan code is identical. Your world record on the merged base matches what I saw before the rebase: push offered team.md (modified), and with this change status and doctor now agree with it.

Still open, unchanged

  • [P3 nit] Status says [docs] 1 new where push says (modified).
  • [P3 nit] In user scope, the shared mirror could hold another team's file at the same docs/<rel>.

Both are optional.

CI review. No findings on this head. We agree.

Merge risk. Low. Push gains the mirror scan, and status and doctor now say the same thing about it.

@SaulMoro
SaulMoro merged commit cb3066b into Tencent:main Nov 15, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants