Skip to content

test(#6169): suite uses unified Driver for repo allocate/deallocate/finalize - #6260

Merged
ifireball merged 3 commits into
mainfrom
agent/6169-unified-driver-suite
Aug 16, 2026
Merged

test(#6169): suite uses unified Driver for repo allocate/deallocate/finalize#6260
ifireball merged 3 commits into
mainfrom
agent/6169-unified-driver-suite

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

Summary

Refactors the behaviour test suite to use a unified install.Driver (AllocateRepo/DeallocateRepo/Finalize/Capacity) instead of manually composing RepoEnsurer + RepoPool + MintDriver. The suite now takes a single Factory/Driver and does not construct or thread those components itself.

Related Issue

Implements #6169 (child of #6135).

Changes

  • install.Driver renamed to install.MintDriver to free the Driver name for the unified interface (transitional until test(behaviour): fold RepoPool and RepoEnsurer into environment install drivers #6170)
  • Added install.Factory type and unified install.Driver interface with AllocateRepo/DeallocateRepo/Finalize/Capacity per the contract defined in test(behaviour): consolidate install driver, RepoEnsurer, and RepoPool behind one driver interface #6135
  • Added composedDriver (internal helper) that wraps MintDriver + RepoEnsurer + channel-based pool into a unified Driver
  • Added cfmint.NewFactory that closes over PEM/pool config, deploys the preview mint, creates the ensurer, and returns the composed Driver
  • Simplified suite_test.go — uses factory instead of ad-hoc composition; no direct RepoPool, RepoEnsurer, or mint URL threading
  • Changed suite.InitScenario signature from (sc, template, pool) to (sc, template) — pool is internal to the driver
  • Replaced world.Ensurer with world.Driver (unified driver field)
  • Updated givenEnrolledTestRepository to call Driver.AllocateRepo with double-allocation guard
  • After hook calls Driver.DeallocateRepo instead of pool.Release
  • Concurrency > Capacity is an advisory t.Logf warning, not a fatal (per test(behaviour): consolidate install driver, RepoEnsurer, and RepoPool behind one driver interface #6135)
  • Finalize uses errors.Join for leak + mint teardown errors
  • Updated docs in behaviour-drivers.md and behaviour-testing.md for Factory/Driver, API changes

Testing

  • All existing pkg/behaviourtest/... unit tests pass with -race
  • New composed_test.go covers: allocate/deallocate, double-dealloc guard, unknown name guard, blocking when at capacity, ensure error returns slot to pool, finalize with/without outstanding leases, errors.Join behavior, concurrent allocate/deallocate under -race
  • Updated suite/init_test.go tests for new Before/After hooks with unified driver
  • go vet passes for all changed packages (including -tags behaviour)
  • Secret scan clean

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Tests added/updated for new or modified logic

Closes #6169

Post-script verification

  • Branch is not main/master (agent/6169-unified-driver-suite)
  • Secret scan passed (gitleaks — 53456d472dcba81bcea79f8d715e9d6159cefa5c..HEAD)
  • PR body secret scan passed (gitleaks — no-git)

…inalize

Refactor the behaviour test suite to speak only to a unified
install.Driver surface (AllocateRepo/DeallocateRepo/Finalize/
Capacity) instead of manually composing RepoEnsurer + RepoPool +
MintDriver.

Key changes:
- Rename install.Driver → install.MintDriver to free the name
  for the unified interface.
- Add install.Factory type and install.Driver interface per #6135.
- Add composedDriver (internal) that wraps MintDriver + RepoEnsurer
  + channel-based pool into a unified Driver.
- Add cfmint.NewFactory that closes over PEM/pool config, deploys
  the mint, creates the ensurer, and returns the composed Driver.
- Update suite_test.go to use the factory — no ad-hoc composition
  of RepoEnsurer, RepoPool, or mint URL threading.
- Update suite.InitScenario signature from (sc, template, pool)
  to (sc, template) — pool is internal to the driver.
- Replace world.Ensurer with world.Driver (unified driver).
- Update givenEnrolledTestRepository to call Driver.AllocateRepo
  with double-allocation guard.
- After hook calls Driver.DeallocateRepo instead of pool.Release.
- Concurrency > Capacity is an advisory t.Logf, not a fatal.
- Finalize uses errors.Join for leak + mint teardown errors.
- Update behaviour-drivers.md and behaviour-testing.md docs.

Closes #6169
@fullsend-ai-coder
fullsend-ai-coder Bot requested a review from a team as a code owner August 16, 2026 13:50
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Agent PR ready for human review label Aug 16, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Review · ⚠️ Cancelled · Started 1:51 PM UTC · Ended 2:04 PM UTC

Commit: 8ecf8d8 · View workflow run →

@github-actions

github-actions Bot commented Aug 16, 2026

Copy link
Copy Markdown

Site preview

Preview: https://ba3016eb-site.fullsend-ai.workers.dev

Commit: d5382c788f498b81bea5777e1830fae7d5c9a404

@ifireball

Copy link
Copy Markdown
Member

/fs-fix CI test failed on make lint-alllint-md-links.

Stale fragment #lazy-createinstall-repoensurer is linked from:

  • docs/guides/dev/e2e-testing.md (~line 81)
  • docs/guides/infrastructure/mint-administration.md (~line 79)

The behaviour-testing heading was renamed away from RepoEnsurer, so that anchor no longer exists.

Update both links (and any nearby prose) to the current heading slug for the AllocateRepo / unified-driver lazy create+install section in docs/guides/dev/behaviour-testing.md. Run/fix until lint-md-links is clean.

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 1:57 PM UTC · Completed 2:04 PM UTC

Commit: 8ecf8d8 · View workflow run →

Update two markdown links from #lazy-createinstall-repoensurer (removed
heading) to #repo-allocation-via-unified-driver (current heading) and
align nearby prose with the unified install.Driver terminology introduced
in this PR.

Addresses review feedback on #6260
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 1 (human-triggered)

Fixed 2 stale markdown fragment links in e2e-testing.md and mint-administration.md that pointed to the removed #lazy-createinstall-repoensurer heading. Updated both to #repo-allocation-via-unified-driver and aligned nearby prose with the unified Driver terminology. lint-md-links now passes cleanly.

Fixed (2):

  1. stale fragment #lazy-createinstall-repoensurer in e2e-testing.md (docs/guides/dev/e2e-testing.md): Updated link anchor from #lazy-createinstall-repoensurer to #repo-allocation-via-unified-driver and aligned prose to reference the unified install.Driver instead of RepoPool/RepoEnsurer
  2. stale fragment #lazy-createinstall-repoensurer in mint-administration.md (docs/guides/infrastructure/mint-administration.md): Updated link anchor from #lazy-createinstall-repoensurer to #repo-allocation-via-unified-driver and aligned prose to reference the unified install.Driver instead of RepoEnsurer

Tests: passed

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:05 PM UTC · Completed 2:23 PM UTC

Commit: 93c1ef9 · View workflow run →

@codecov

codecov Bot commented Aug 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.86364% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/behaviourtest/drivers/install/cfmint/driver.go 96.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 16, 2026

Copy link
Copy Markdown

Review

Findings

Medium

  • [interface-rename-collision] pkg/behaviourtest/drivers/install/driver.go — The existing install.Driver interface is renamed to install.MintDriver while a new install.Driver with a different contract (AllocateRepo/DeallocateRepo/Finalize/Capacity) is introduced. This is intentional per test(behaviour): suite uses one install Driver for repo allocate/deallocate/finalize #6169/test(behaviour): consolidate install driver, RepoEnsurer, and RepoPool behind one driver interface #6135, and migration guidance is provided in behaviour-testing.md, but the PR title should carry the ! suffix per COMMITS.md since this breaks exported API surface consumed by external repos (e.g., fullsend-ai/agents).
    Remediation: update PR title to test(#6169)!: suite uses unified Driver for repo allocate/deallocate/finalize

  • [function-signature-change] pkg/behaviourtest/suite/init.gosuite.InitScenario signature changed from (sc, template, pool) to (sc, template), removing the *world.RepoPool parameter. External behaviour test suites calling this function with three arguments will fail to compile. Migration guidance is provided in behaviour-testing.md.

  • [struct-field-removed] pkg/behaviourtest/world/world.goworld.World.Ensurer (type install.RepoEnsurer) is replaced with world.World.Driver (type install.Driver). External code referencing w.Ensurer will fail to compile. Migration documented in behaviour-testing.md.

Low

  • [naming-consistency] pkg/behaviourtest/drivers/install/cfmint/driver_test.go — The test helper type testMintDriver uses a different naming convention from fakeMintDriver in composed_test.go. The author notes these are in different packages (cfmint vs install), but the inconsistency may cause confusion when reading cross-package test code.

  • [resource-leak] pkg/behaviourtest/drivers/install/cfmint/driver.go — In buildFromMint, if mintDriver.Install succeeds but NewComposedDriver fails (e.g., poolSize <= 0), the deployed mint worker is leaked because no driver is returned to call Finalize on. Practical risk is low since the only failure path is a programming error (invalid capacity).

  • [dead-code] pkg/behaviourtest/world/pool.goworld.RepoPool is now dead code after this PR. No callers of NewRepoPool, Acquire, or Release remain. Transitional until test(behaviour): fold RepoPool and RepoEnsurer into environment install drivers #6170.

Previous run

Review

Findings

Medium

  • [interface-rename-collision] pkg/behaviourtest/drivers/install/driver.go — The existing install.Driver interface is renamed to install.MintDriver while a new install.Driver with a different contract (AllocateRepo/DeallocateRepo/Finalize/Capacity) is introduced. This is intentional per test(behaviour): suite uses one install Driver for repo allocate/deallocate/finalize #6169/test(behaviour): consolidate install driver, RepoEnsurer, and RepoPool behind one driver interface #6135, and migration guidance is provided in behaviour-testing.md, but the PR title should carry the ! suffix per COMMITS.md since this breaks exported API surface consumed by external repos (e.g., fullsend-ai/agents).
    Remediation: update PR title to test(#6169)!: suite uses unified Driver for repo allocate/deallocate/finalize

  • [function-signature-change] pkg/behaviourtest/suite/init.gosuite.InitScenario signature changed from (sc, template, pool) to (sc, template), removing the *world.RepoPool parameter. External behaviour test suites calling this function with three arguments will fail to compile. Migration guidance is provided in behaviour-testing.md.

  • [struct-field-removed] pkg/behaviourtest/world/world.goworld.World.Ensurer (type install.RepoEnsurer) is replaced with world.World.Driver (type install.Driver). External code referencing w.Ensurer will fail to compile. Migration documented in behaviour-testing.md.

Low

  • [dead-code] pkg/behaviourtest/world/pool.goworld.RepoPool is now dead code after this PR. No callers of NewRepoPool, Acquire, or Release remain. Transitional until test(behaviour): fold RepoPool and RepoEnsurer into environment install drivers #6170.

  • [edge-case] pkg/behaviourtest/drivers/install/composed.go:108 — In Finalize, outstanding lease names are reclaimed via channel sends while holding d.mu. Safe in practice (Finalize runs after godog finishes), but if called concurrently with AllocateRepo's error-recovery path, a blocking send under the lock is theoretically possible.

  • [new-required-interface] pkg/behaviourtest/drivers/install/driver.go — The new install.Factory type is the recommended way to construct unified Driver instances. External repos adopting the unified driver flow will need to migrate to the factory pattern. Migration guidance in behaviour-testing.md.


Labels: PR modifies e2e behaviour test infrastructure (pkg/behaviourtest/, e2e/behaviour/) and introduces new install.Driver unified interface

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-review fullsend-ai-review Bot added requires-manual-review Review requires human judgment component/e2e End-to-end tests labels Aug 16, 2026
@ifireball

Copy link
Copy Markdown
Member

/fs-fix get code coverage to 80% or above

@fullsend-ai-coder

fullsend-ai-coder Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 2:41 PM UTC · Completed 2:54 PM UTC

Commit: 93c1ef9 · View workflow run →

Extract the deploy-and-compose path from NewFactory into a package-
internal buildFromMint helper so it can be tested with a fake
MintDriver (NewFactory hard-codes NewDriver, which needs real PEM
files and an external binary).

New tests cover:
- NewFactory returns a non-nil factory
- NewFactory error path (invalid config → NewDriver fails)
- buildFromMint happy path with MintURLProvider state
- buildFromMint install failure
- buildFromMint with state that lacks MintURLProvider
- buildFromMint with invalid pool size

Coverage for cfmint/driver.go NewFactory: 0% → 80%.
Package cfmint overall: 76.3% → 93.5%.

Addresses review feedback on #6260
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 Fix agent — iteration 2 (human-triggered)

Addressed coverage gap in cfmint/driver.go by extracting buildFromMint helper and adding 7 tests. NewFactory coverage 0% → 80%, package cfmint 76.3% → 93.5%. All changed files are well above the 80% patch coverage threshold.

Fixed (1):

  1. get code coverage to 80% or above (pkg/behaviourtest/drivers/install/cfmint/driver.go): Extracted post-NewDriver logic from NewFactory into a package-internal buildFromMint helper to make the deploy-and-compose path testable with a fake MintDriver. Added 7 tests covering happy path, error paths, and edge cases. NewFactory coverage: 0% → 80%. Package cfmint overall: 76.3% → 93.5%.

Tests: passed

Decision points
  • Chose to extract buildFromMint helper rather than testing NewFactory end-to-end (alternatives: Test NewFactory with real PEM files and mock binary, Inject MintDriver via functional option on NewFactory; rationale: NewFactory hard-codes NewDriver (which needs PEMs) and the created driver's cliRunner (which calls e2etest.TryRunCLI). Extracting the composition logic into buildFromMint keeps the public API unchanged while making the deploy+compose path testable with a fake MintDriver.)

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 2:55 PM UTC · Completed 3:12 PM UTC

Commit: d5382c7 · View workflow run →

@ifireball
ifireball added this pull request to the merge queue Aug 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 16, 2026
@ifireball
ifireball added this pull request to the merge queue Aug 16, 2026
Merged via the queue into main with commit dc87d7d Aug 16, 2026
16 checks passed
@ifireball
ifireball deleted the agent/6169-unified-driver-suite branch August 16, 2026 15:39
@fullsend-ai-retro

fullsend-ai-retro Bot commented Aug 16, 2026

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 3:41 PM UTC · Completed 3:53 PM UTC

Commit: d5382c7 · View workflow run →

@fullsend-ai-retro

Copy link
Copy Markdown

Retro: PR #6260 — unified Driver for behaviour test suite

Outcome: Merged after 2 fix iterations (6 agent runs on this PR). However, this was the second attempt — the predecessor PR #6172 was abandoned after 15 agent runs over 3 days due to a gitleaks scan-range bug after rebase. Total cost across both PRs: 21 agent runs for an issue that should have required ~6.

What went well

What could go better

Review quality — 3/3 medium findings were false positives. The review agent flagged interface-rename-collision, function-signature-change, and struct-field-removed at medium severity, claiming these break "exported API surface consumed by external repos." GitHub code search confirms zero external importers of pkg/behaviourtest/ — these packages are internal test infrastructure. The human reviewer (ifireball) was correct to approve without addressing them. See Proposal 1 below.

Evidence for existing open issues

Proposals filed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/e2e End-to-end tests ready-for-review Agent PR ready for human review requires-manual-review Review requires human judgment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(behaviour): suite uses one install Driver for repo allocate/deallocate/finalize

1 participant