-
Notifications
You must be signed in to change notification settings - Fork 0
Finalize foundation contracts epic #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
65d41fa
Finalize foundation contracts epic
KSemenenko 3faeddc
Mark foundation contracts epic plan complete
KSemenenko 5e38051
Fix PR #82 review follow-ups
KSemenenko 7213a37
Merge remote-tracking branch 'origin/main' into codex/epic-11-foundat…
KSemenenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
DotPilot.Tests/Features/ControlPlaneDomain/ControlPlaneIdentifierContractTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| namespace DotPilot.Tests.Features.ControlPlaneDomain; | ||
|
|
||
| public sealed class ControlPlaneIdentifierContractTests | ||
| { | ||
| [Test] | ||
| public void NewlyCreatedIdentifiersUseVersionSevenTokens() | ||
| { | ||
| IReadOnlyList<string> identifiers = | ||
| [ | ||
| WorkspaceId.New().ToString(), | ||
| AgentProfileId.New().ToString(), | ||
| SessionId.New().ToString(), | ||
| FleetId.New().ToString(), | ||
| ProviderId.New().ToString(), | ||
| ModelRuntimeId.New().ToString(), | ||
| ToolCapabilityId.New().ToString(), | ||
| ApprovalId.New().ToString(), | ||
| ArtifactId.New().ToString(), | ||
| TelemetryRecordId.New().ToString(), | ||
| EvaluationId.New().ToString(), | ||
| ]; | ||
|
|
||
| identifiers.Should().OnlyContain(identifier => identifier.Length == 32); | ||
| identifiers.Should().OnlyContain(identifier => identifier[12] == '7'); | ||
| } | ||
|
|
||
| [Test] | ||
| public void DefaultDescriptorsExposeSerializationSafeDefaults() | ||
| { | ||
| var workspace = new WorkspaceDescriptor(); | ||
| var agent = new AgentProfileDescriptor(); | ||
| var fleet = new FleetDescriptor(); | ||
| var tool = new ToolCapabilityDescriptor(); | ||
| var provider = new ProviderDescriptor(); | ||
| var runtime = new ModelRuntimeDescriptor(); | ||
| var session = new SessionDescriptor(); | ||
| var approval = new SessionApprovalRecord(); | ||
| var artifact = new ArtifactDescriptor(); | ||
| var telemetry = new TelemetryRecord(); | ||
| var evaluation = new EvaluationRecord(); | ||
|
|
||
| workspace.Name.Should().BeEmpty(); | ||
| workspace.RootPath.Should().BeEmpty(); | ||
| workspace.BranchName.Should().BeEmpty(); | ||
| agent.Name.Should().BeEmpty(); | ||
| agent.ToolCapabilityIds.Should().BeEmpty(); | ||
| agent.Tags.Should().BeEmpty(); | ||
| fleet.Name.Should().BeEmpty(); | ||
| fleet.AgentProfileIds.Should().BeEmpty(); | ||
| tool.Name.Should().BeEmpty(); | ||
| tool.DisplayName.Should().BeEmpty(); | ||
| tool.Tags.Should().BeEmpty(); | ||
| provider.DisplayName.Should().BeEmpty(); | ||
| provider.CommandName.Should().BeEmpty(); | ||
| provider.StatusSummary.Should().BeEmpty(); | ||
| provider.Status.Should().Be(ProviderConnectionStatus.Unavailable); | ||
| provider.SupportedToolIds.Should().BeEmpty(); | ||
| runtime.DisplayName.Should().BeEmpty(); | ||
| runtime.EngineName.Should().BeEmpty(); | ||
| runtime.Status.Should().Be(ProviderConnectionStatus.Unavailable); | ||
| runtime.SupportedModelFamilies.Should().BeEmpty(); | ||
| session.Title.Should().BeEmpty(); | ||
| session.Phase.Should().Be(SessionPhase.Plan); | ||
| session.ApprovalState.Should().Be(ApprovalState.NotRequired); | ||
| session.AgentProfileIds.Should().BeEmpty(); | ||
| approval.State.Should().Be(ApprovalState.Pending); | ||
| approval.RequestedAction.Should().BeEmpty(); | ||
| approval.RequestedBy.Should().BeEmpty(); | ||
| artifact.Name.Should().BeEmpty(); | ||
| artifact.RelativePath.Should().BeEmpty(); | ||
| telemetry.Name.Should().BeEmpty(); | ||
| telemetry.Summary.Should().BeEmpty(); | ||
| evaluation.Outcome.Should().Be(EvaluationOutcome.NeedsReview); | ||
| evaluation.Summary.Should().BeEmpty(); | ||
| } | ||
| } |
82 changes: 82 additions & 0 deletions
82
DotPilot.Tests/Features/RuntimeCommunication/DeterministicAgentRuntimeClientContractTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| namespace DotPilot.Tests.Features.RuntimeCommunication; | ||
|
|
||
| public sealed class DeterministicAgentRuntimeClientContractTests | ||
| { | ||
| private const string ApprovalPrompt = "Execute the local-first flow and request approval before changing files."; | ||
|
|
||
| [Test] | ||
| public async Task ExecuteAsyncReturnsSucceededResultWithoutProblemForPlanMode() | ||
| { | ||
| var client = new DeterministicAgentRuntimeClient(); | ||
|
|
||
| var result = await client.ExecuteAsync(CreateRequest("Plan the contract foundation rollout.", AgentExecutionMode.Plan), CancellationToken.None); | ||
|
|
||
| result.IsSuccess.Should().BeTrue(); | ||
| result.IsFailed.Should().BeFalse(); | ||
| result.HasProblem.Should().BeFalse(); | ||
| result.Value.Should().NotBeNull(); | ||
| result.Value!.NextPhase.Should().Be(SessionPhase.Plan); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task ExecuteAsyncTreatsApprovalPauseAsASuccessfulStateTransition() | ||
| { | ||
| var client = new DeterministicAgentRuntimeClient(); | ||
|
|
||
| var result = await client.ExecuteAsync(CreateRequest(ApprovalPrompt, AgentExecutionMode.Execute), CancellationToken.None); | ||
|
|
||
| result.IsSuccess.Should().BeTrue(); | ||
| result.HasProblem.Should().BeFalse(); | ||
| result.Value.Should().NotBeNull(); | ||
| result.Value!.NextPhase.Should().Be(SessionPhase.Paused); | ||
| result.Value.ApprovalState.Should().Be(ApprovalState.Pending); | ||
| } | ||
|
|
||
| [TestCase(ProviderConnectionStatus.Unavailable, RuntimeCommunicationProblemCode.ProviderUnavailable, 503)] | ||
| [TestCase(ProviderConnectionStatus.RequiresAuthentication, RuntimeCommunicationProblemCode.ProviderAuthenticationRequired, 401)] | ||
| [TestCase(ProviderConnectionStatus.Misconfigured, RuntimeCommunicationProblemCode.ProviderMisconfigured, 424)] | ||
| [TestCase(ProviderConnectionStatus.Outdated, RuntimeCommunicationProblemCode.ProviderOutdated, 412)] | ||
| public async Task ExecuteAsyncMapsProviderStatesToTypedProblems( | ||
| ProviderConnectionStatus providerStatus, | ||
| RuntimeCommunicationProblemCode expectedCode, | ||
| int expectedStatusCode) | ||
| { | ||
| var client = new DeterministicAgentRuntimeClient(); | ||
|
|
||
| var result = await client.ExecuteAsync( | ||
| CreateRequest("Run the provider-independent runtime flow.", AgentExecutionMode.Execute, providerStatus), | ||
| CancellationToken.None); | ||
|
|
||
| result.IsFailed.Should().BeTrue(); | ||
| result.HasProblem.Should().BeTrue(); | ||
| result.Value.Should().BeNull(); | ||
| result.Problem.Should().NotBeNull(); | ||
| result.Problem!.HasErrorCode(expectedCode).Should().BeTrue(); | ||
| result.Problem.StatusCode.Should().Be(expectedStatusCode); | ||
| } | ||
|
|
||
| [Test] | ||
| public async Task ExecuteAsyncReturnsOrchestrationProblemForUnsupportedExecutionModes() | ||
| { | ||
| var client = new DeterministicAgentRuntimeClient(); | ||
|
|
||
| var result = await client.ExecuteAsync( | ||
| CreateRequest("Use an invalid execution mode.", (AgentExecutionMode)999), | ||
| CancellationToken.None); | ||
|
|
||
| result.IsFailed.Should().BeTrue(); | ||
| result.HasProblem.Should().BeTrue(); | ||
| result.Value.Should().BeNull(); | ||
| result.Problem.Should().NotBeNull(); | ||
| result.Problem!.HasErrorCode(RuntimeCommunicationProblemCode.OrchestrationUnavailable).Should().BeTrue(); | ||
| result.Problem.StatusCode.Should().Be(503); | ||
| } | ||
|
|
||
| private static AgentTurnRequest CreateRequest( | ||
| string prompt, | ||
| AgentExecutionMode mode, | ||
| ProviderConnectionStatus providerStatus = ProviderConnectionStatus.Available) | ||
| { | ||
| return new AgentTurnRequest(SessionId.New(), AgentProfileId.New(), prompt, mode, providerStatus); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.