test(org-external): integration + e2e for !external resolver (PR-B + PR-C) #106

Merged
claude-ceo-assistant merged 1 commits from feature/external-ref-pr-bc-tests into staging 2026-05-08 12:33:45 +00:00

Summary

Follow-up tests for molecule-core PR #105's !external resolver. PR-B + PR-C from the design's phasing (internal#77 comment 1995). No production code changes.

PR-B (task #233): integration against local bare-git remote

org_external_integration_test.go — 3 tests using git's insteadOf URL rewrite (process-scoped via GIT_CONFIG_COUNT/KEY/VALUE env vars, no ~/.gitconfig pollution):

  • TestGitFetcher_RealClone_LocalRedirect — full resolver chain end-to-end with REAL git clone against a local bare-repo. Asserts cache population + content materialization + path rewrite + cache-hit on second invocation (marker file survives).
  • TestGitFetcher_RealClone_BadRefFails — nonexistent ref surfaces git's error cleanly through ls-remote.
  • TestGitFetcher_DirectFetch_CacheHitgitFetcher.Fetch direct (no resolver wrapping); verifies cache-hit returns same dir + same SHA, no clobber.

Production code untouched — insteadOf makes the gitFetcher think it's cloning from Gitea, but git rewrites at clone time to file://<barePath>. Tests the real shell-out + parsing without network.

PR-C (task #234): live-Gitea e2e against dev-department

local_e2e_dev_dept_test.go gains TestLocalE2E_ExternalDevDepartment — minimal parent template that uses !external against the LIVE molecule-ai/molecule-dev-department repo. No symlink, no /tmp/local-e2e-deploy/ fixture. Composition resolves over network at import time.

Asserts:

  • 28+ dev-tree workspaces resolve through the fetched cache (matches the count from TestLocalE2E_DevDepartmentExtraction's symlink path)
  • Q1: Documentation Specialist present (under app-lead)
  • Q2: Triage Operator present (under dev-lead)
  • Every workspace's files_dir is cache-prefixed (proves rewrite ran)
  • Every workspace's resolveInsideRoot + Stat succeeds (would fail provisioning if not)

Skipped if Gitea unreachable (TCP probe to git.moleculesai.app:443) or git binary absent.

Verified locally (2026-05-08)

--- PASS: TestGitFetcher_RealClone_LocalRedirect (0.26s)
--- PASS: TestGitFetcher_RealClone_BadRefFails    (0.15s)
--- PASS: TestGitFetcher_DirectFetch_CacheHit     (0.23s)
--- PASS: TestLocalE2E_ExternalDevDepartment      (0.55s)
workspaces resolved through !external: 28
Full ./internal/handlers/ test suite: ok (6.8s, no regressions)

Coverage layers post-merge

Layer Test What it proves
Unit (fakeFetcher) PR-A TestResolveExternalMapping_* Allowlist, validation, path rewrite, idempotence
Integration (real git, local bare-repo) PR-B TestGitFetcher_* Clone, ls-remote parsing, cache atomic-rename, cache-hit
E2E (real git, live Gitea, live dev-department) PR-C TestLocalE2E_ExternalDevDepartment Full chain works against production data

Refs

  • internal#77 — extraction RFC (Phase 3a phasing in comment 1995)
  • molecule-core#105 — PR-A (resolver implementation, merged)
  • task #233 (PR-B), task #234 (PR-C)
  • Hongming GO 2026-05-08 ("do PR-B/C/D")
## Summary Follow-up tests for [molecule-core PR #105](https://git.moleculesai.app/molecule-ai/molecule-core/pulls/105)'s `!external` resolver. PR-B + PR-C from the design's phasing (internal#77 comment 1995). No production code changes. ## PR-B (task #233): integration against local bare-git remote `org_external_integration_test.go` — 3 tests using git's `insteadOf` URL rewrite (process-scoped via `GIT_CONFIG_COUNT/KEY/VALUE` env vars, no `~/.gitconfig` pollution): - **TestGitFetcher_RealClone_LocalRedirect** — full resolver chain end-to-end with REAL `git clone` against a local bare-repo. Asserts cache population + content materialization + path rewrite + cache-hit on second invocation (marker file survives). - **TestGitFetcher_RealClone_BadRefFails** — nonexistent ref surfaces git's error cleanly through ls-remote. - **TestGitFetcher_DirectFetch_CacheHit** — `gitFetcher.Fetch` direct (no resolver wrapping); verifies cache-hit returns same dir + same SHA, no clobber. Production code untouched — `insteadOf` makes the gitFetcher think it's cloning from Gitea, but git rewrites at clone time to `file://<barePath>`. Tests the real shell-out + parsing without network. ## PR-C (task #234): live-Gitea e2e against dev-department `local_e2e_dev_dept_test.go` gains `TestLocalE2E_ExternalDevDepartment` — minimal parent template that uses `!external` against the LIVE `molecule-ai/molecule-dev-department` repo. No symlink, no `/tmp/local-e2e-deploy/` fixture. Composition resolves over network at import time. Asserts: - 28+ dev-tree workspaces resolve through the fetched cache (matches the count from `TestLocalE2E_DevDepartmentExtraction`'s symlink path) - Q1: `Documentation Specialist` present (under app-lead) - Q2: `Triage Operator` present (under dev-lead) - Every workspace's `files_dir` is cache-prefixed (proves rewrite ran) - Every workspace's `resolveInsideRoot` + `Stat` succeeds (would fail provisioning if not) Skipped if Gitea unreachable (TCP probe to `git.moleculesai.app:443`) or git binary absent. ## Verified locally (2026-05-08) ``` --- PASS: TestGitFetcher_RealClone_LocalRedirect (0.26s) --- PASS: TestGitFetcher_RealClone_BadRefFails (0.15s) --- PASS: TestGitFetcher_DirectFetch_CacheHit (0.23s) --- PASS: TestLocalE2E_ExternalDevDepartment (0.55s) workspaces resolved through !external: 28 Full ./internal/handlers/ test suite: ok (6.8s, no regressions) ``` ## Coverage layers post-merge | Layer | Test | What it proves | |---|---|---| | Unit (fakeFetcher) | PR-A `TestResolveExternalMapping_*` | Allowlist, validation, path rewrite, idempotence | | Integration (real git, local bare-repo) | PR-B `TestGitFetcher_*` | Clone, ls-remote parsing, cache atomic-rename, cache-hit | | E2E (real git, live Gitea, live dev-department) | PR-C `TestLocalE2E_ExternalDevDepartment` | Full chain works against production data | ## Refs - internal#77 — extraction RFC (Phase 3a phasing in comment 1995) - molecule-core#105 — PR-A (resolver implementation, merged) - task #233 (PR-B), task #234 (PR-C) - Hongming GO 2026-05-08 ("do PR-B/C/D")
claude-ceo-assistant added 1 commit 2026-05-08 12:30:33 +00:00
test(org-external): integration test against local bare-git + e2e against live Gitea (PR-B + PR-C)
All checks were successful
CodeQL / Analyze (${{ matrix.language }}) (javascript-typescript) (pull_request) Successful in 1s
CodeQL / Analyze (${{ matrix.language }}) (go) (pull_request) Successful in 1s
CodeQL / Analyze (${{ matrix.language }}) (python) (pull_request) Successful in 1s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 4s
E2E API Smoke Test / detect-changes (pull_request) Successful in 7s
CI / Detect changes (pull_request) Successful in 8s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 8s
Harness Replays / detect-changes (pull_request) Successful in 7s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 7s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 7s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 8s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 2s
CI / Python Lint & Test (pull_request) Successful in 3s
CI / Canvas (Next.js) (pull_request) Successful in 4s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 4s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 5s
Harness Replays / Harness Replays (pull_request) Successful in 58s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 1m45s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 1m51s
CI / Platform (Go) (pull_request) Successful in 2m49s
89c5567d79
PR-B (local bare-git integration, task #233):
  workspace-server/internal/handlers/org_external_integration_test.go
  Three tests using git's GIT_CONFIG_COUNT/KEY/VALUE env-var-injected
  insteadOf URL rewrite — process-scoped, no ~/.gitconfig pollution:

  - TestGitFetcher_RealClone_LocalRedirect: full resolver chain end-to-
    end with REAL git clone against a local bare-repo, asserts cache
    population + content materialization + path rewrite + cache-hit on
    second invocation.
  - TestGitFetcher_RealClone_BadRefFails: nonexistent ref surfaces
    git's error cleanly through the ls-remote step.
  - TestGitFetcher_DirectFetch_CacheHit: gitFetcher.Fetch direct
    invocation (no resolver wrapping); verifies cache-hit returns
    same dir + same SHA, no clobber.

  Production code untouched — insteadOf rewrite makes the production
  gitFetcher think it's cloning from Gitea, but git rewrites at clone
  time to file://<barePath>. Tests the real shell-out + parsing.

PR-C (live Gitea e2e, task #234):
  workspace-server/internal/handlers/local_e2e_dev_dept_test.go
  TestLocalE2E_ExternalDevDepartment — minimal parent template that
  uses !external against the LIVE molecule-ai/molecule-dev-department
  repo. No symlink, no /tmp/local-e2e-deploy fixture. Composition
  resolves over network at import time.

  Asserts:
    - 28+ dev-tree workspaces resolve through the fetched cache
      (matches the count from TestLocalE2E_DevDepartmentExtraction)
    - Q1 placement: 'Documentation Specialist' present (under app-lead)
    - Q2 placement: 'Triage Operator' present (under dev-lead)
    - Every workspace's files_dir is cache-prefixed (proves rewrite ran)
    - Every workspace's resolveInsideRoot+Stat succeeds
      (would fail provisioning if not)

  Skipped if Gitea unreachable (TCP probe to git.moleculesai.app:443)
  or git binary absent — won't false-fail offline runners.

VERIFIED LOCALLY 2026-05-08:
  --- PASS: TestGitFetcher_RealClone_LocalRedirect (0.26s)
  --- PASS: TestGitFetcher_RealClone_BadRefFails    (0.15s)
  --- PASS: TestGitFetcher_DirectFetch_CacheHit     (0.23s)
  --- PASS: TestLocalE2E_ExternalDevDepartment      (0.55s)
  workspaces resolved through !external: 28
  Full ./internal/handlers/ test suite: ok (no regressions)

Together with PR-A's unit tests (#105), the !external resolver is now
covered at three layers:
  - unit (fakeFetcher injection): allowlist, validation, path rewrite
  - integration (real git, local bare-repo): clone, cache, ls-remote
  - e2e (real git, live Gitea, live dev-department): full chain

Refs:
  internal#77 — extraction RFC (Phase 3a phasing in comment 1995)
  task #233 (PR-B), task #234 (PR-C)
  Hongming GO 2026-05-08 ('do PR-B/C/D')
Ghost approved these changes 2026-05-08 12:30:34 +00:00
Ghost left a comment
First-time contributor

LGTM. PR-B uses GIT_CONFIG_COUNT/KEY/VALUE for process-scoped insteadOf — clean and reusable pattern. PR-C runs against live Gitea, skipped if unreachable. Together with PR-A unit tests, the resolver has unit+integration+e2e coverage.

LGTM. PR-B uses GIT_CONFIG_COUNT/KEY/VALUE for process-scoped insteadOf — clean and reusable pattern. PR-C runs against live Gitea, skipped if unreachable. Together with PR-A unit tests, the resolver has unit+integration+e2e coverage.
claude-ceo-assistant merged commit d9056db5b4 into staging 2026-05-08 12:33:45 +00:00
claude-ceo-assistant deleted branch feature/external-ref-pr-bc-tests 2026-05-08 12:33:45 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#106
No description provided.