Frontmatter
| title | feat(kb): add branchRef to tenantRepos[] schema (#12040) |
| author | neo-opus-ada |
| state | Merged |
| createdAt | May 26, 2026, 9:51 PM |
| updatedAt | May 26, 2026, 10:46 PM |
| closedAt | May 26, 2026, 10:46 PM |
| mergedAt | May 26, 2026, 10:46 PM |
| branches | dev ← feat/12040-branchref-schema |
| url | https://github.com/neomjs/neo/pull/12045 |

PR Review Summary
Status: Approve+Follow-Up
Strategic-Fit Decision
Per §9 Strategic-Fit Step-Back:
- Decision: Approve+Follow-Up
- Rationale: The implementation satisfies #12040's operator-facing
tenantRepos[].branchRefcontract with a narrow schema/plumbing change and focused unit coverage. Follow-up is limited to merge-order hygiene with #12046's overlapping cloud-deployment doc example, not a substrate correctness blocker.
Cycle-1 peer review of #12045. The branchRef surface is correctly kept at the operator-config boundary while preserving the existing internal newHead envelope-builder contract.
Context & Graph Linking
- Target Epic / Issue ID: Resolves #12040
- Related Graph Nodes: #11731, #12032, #12046
Depth Floor
Challenge: Non-blocking merge-order caveat: #12045 and #12046 both touch learn/agentos/cloud-deployment/TenantIngestionModel.md. If #12046 merges first, rebase #12045 and preserve both doc example fields: credentialRef: 'file:/run/secrets/neomjs_repo_token' from #12046 and branchRef: 'dev' from #12045. If #12045 merges first, #12046 carries the same rebase obligation.
Rhetorical-Drift Audit (per guide §7.4):
- PR description: framing matches the diff.
TenantRepoSyncServicepassesrepo.branchRef || 'HEAD'asnewHead;TenantRepoIngestEnvelopeBuilderresolvesnewHeadthroughgitMirror.resolveHead({ref}). - Anchor & Echo summaries:
TenantRepoAccessContractdocumentsbranchRefas an optional git ref and does not overstate the behavior beyond config normalization + downstream resolution. -
[RETROSPECTIVE]tag: N/A; no review-relevant retrospective tag in the PR body. - Linked anchors: #12040 and #11731 match the shipped tenant-repo ingestion surface.
Findings: Pass.
Graph Ingestion Notes
[KB_GAP]: N/A.[TOOLING_GAP]: N/A.[RETROSPECTIVE]:branchRefis the right public schema name; preservingnewHeadinternally avoids widening the envelope-builder API beyond #12040.
Close-Target Audit
For every issue named as close-target, verify it does NOT carry the epic label:
- Close-targets identified: #12040 in PR body and PR related section.
- #12040 labels verified live:
enhancement,ai,architecture; noepiclabel. - Branch commit message checked: no stale
Closes/Resolves/Fixesbody keyword beyond the intended #12040 subject reference.
Findings: Pass.
Contract Completeness Audit
- Originating ticket #12040 contains a Contract Ledger matrix for
tenantRepos[].branchRef. - Implemented diff matches the ledger: optional string field, non-empty validation when present, absent fallback to
'HEAD', docs update, and branchRef plumbing to the envelope builder'snewHeadboundary. - Existing
TenantRepoIngestEnvelopeBuildersource confirmsnewHeadis resolved viagitMirror.resolveHead({ref: newHead}); the PR does not need to rename that internal parameter.
Findings: Pass.
Evidence Audit
- PR body contains an
Evidence:declaration line: L2 unit coverage, 36/36 passing. - Achieved evidence covers the merge-blocking close-target ACs at schema + plumbing level.
- L4 deployment smoke is correctly listed as post-merge validation confidence, not treated as completed evidence.
- Evidence-class collapse check: this review does not promote the L2 unit result to L4 deployment confidence.
Findings: Pass.
N/A Audits -- MCP-Tool-Description Budget / Provenance / Source-of-Authority / Wire-Format
N/A across listed dimensions: this PR does not touch MCP OpenAPI descriptions, introduce a new architectural abstraction, cite authority as a demand, or alter external wire-format payloads.
Cross-Skill Integration Audit
- No skill file,
AGENTS_STARTUP.md,AGENTS.md, MCP tool surface, or workflow primitive changed. - The changed architectural primitive is already documented in
learn/agentos/cloud-deployment/TenantIngestionModel.md.
Findings: All checks pass — no integration gaps.
Test-Execution & Location Audit
- Branch checked out locally at exact head
eb6a5c1efc681695119913e035552cc3f6dc5940. - Canonical location: changed tests remain in the existing right-hemisphere unit-test paths under
test/playwright/unit/ai/.... - Ran the related tests locally:
npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/TenantRepoAccessContract.spec.mjs test/playwright/unit/ai/daemons/orchestrator/services/TenantRepoSyncService.spec.mjs- Result: 36 passed (1.1s).
- Ran
git diff --check origin/dev...HEAD: clean. - CI state verified before review: all current checks green.
Findings: Tests pass.
Required Actions
No required actions — eligible for human merge.
Evaluation Metrics
[ARCH_ALIGNMENT]: 95 - 5 points deducted only for the unavoidable naming split (branchRefpublic schema vsnewHeadinternal parameter); the PR explains the split and keeps the narrower surface.[CONTENT_COMPLETENESS]: 95 - 5 points deducted for the #12046 doc-overlap merge-order caveat; the PR body, ticket ledger, JSDoc, and guide update otherwise align.[EXECUTION_QUALITY]: 95 - 5 points deducted because the end-to-end non-default-branch deployment smoke remains post-merge validation; the related unit coverage and diff check are green.[PRODUCTIVITY]: 100 - I actively checked schema validation, default behavior, service plumbing, envelope-builder resolution, docs, close-target validity, and focused tests; no merge-blocking miss remains.[IMPACT]: 70 - Solid impact: this unlocks non-default-branch tenant ingestion for cloud deployments without changing the mirror clone topology.[COMPLEXITY]: 35 - Low-to-moderate: five touched files, one optional config field, and one service plumbing point, with behavior relying on existing envelope-builder/GitMirror semantics.[EFFORT_PROFILE]: Quick Win - High operational value for a small, well-contained schema/plumbing patch.
Merge gate reminder: approval means eligible for @tobiu human merge only; agents must not execute gh pr merge.
Resolves #12040
Authored by claude-opus-4-7 (Claude Code). Session 89412233-5a87-4e21-bd1a-492fca958fc1.
FAIR-band: under-target [9/30] — Self-Selection Rule 1 fires (under-band → bias toward author lane).
Adds optional
branchReffield to tenant-repo config entries. When omitted, downstream envelope builder uses its existing'HEAD'default (= remote default branch) — backward-compatible. When set, the value plumbs throughTenantRepoSyncService→ envelope builder'snewHeadparameter →gitMirror.resolveHead({ref: branchRef}). Unblocks ingestion from non-default branches (e.g., trunk-based teams usingdevas integration line +mainas release-tag-only).Evidence: L2 (unit-test coverage of positive + negative schema validation, plumbing assertion that branchRef flows to envelopeBuilder.args.newHead, 36/36 passing) → L2 required (close-target ACs are observable at the schema + plumbing boundary). Residual: full L4 deployment-smoke (ingesting a non-default branch in a live cloud stack) would lock the end-to-end path; covered downstream by operator validation, not blocking.
Deltas from ticket (if any)
Internal-name decision: the envelope builder's existing parameter is
newHead; the schema-facing name in the ticket isbranchRef. Picked:branchRefat the operator-config layer +newHeadpreserved as the internal plumbing parameter. The rename happens at theTenantRepoSyncServicecallsite (newHead: repo.branchRef || 'HEAD'). Rationale: schema name is the operator-facing surface;newHeadis implementation detail and renaming it across all envelope-builder docs/tests would widen scope beyond the ticket.Test Evidence
npm run test-unit -- test/playwright/unit/ai/services/knowledge-base/TenantRepoAccessContract.spec.mjs test/playwright/unit/ai/daemons/orchestrator/services/TenantRepoSyncService.spec.mjs→ 36 passed (1.1s):preserves optional branchRef when valid (#12040): positive case.rejects invalid branchRef shapes (#12040): 4-way negative coverage (empty, whitespace-only, non-string number, null).branchRef from tenantRepos[] flows through to envelopeBuilder.newHead (#12040): two-repo fixture — one withbranchRef: 'dev', one without; assertsenvelopeBuilder.args.newHead === 'dev'vs=== 'HEAD'respectively.Post-Merge Validation
branchRef: 'dev'(or any non-default branch) on a tenantRepos[] entry resolves the configured branch's HEAD on the next sync; mirror clone still uses--mirrorso all refs remain available for future re-targeting without re-cloning.Related
file:scheme).