Validate edits for all held Astra chat writes (#980) - #670
Merged
Merged
Conversation
There was a problem hiding this comment.
Important
Two high-priority issues need correction: deletion-code revisions bypass the challenge attempt budget, and valid bulk checklist/reminder edits are rejected.
Reviewed changes Reviewed all changed files across the three commits, tracing revision validation, tool execution, ownership checks, and domain guards.
- Held-write validation: Tools now provide read-only argument checks using their execution parsers, existing validators, and entity guards.
- Preview and schema rules: Revisions validate bulk item schemas, retain server preview IDs, and restrict edits to consumed arguments.
- Shared domain behavior: Habit command builders and goal/habit guards are reused between checking and execution.
- Regression coverage: The focused revision/preview suite passes all 173 tests; isolated reproductions confirm both inline findings despite that coverage.
openai/gpt-6.1-sol | 𝕏
There was a problem hiding this comment.
No new issues found.
Reviewed changes Reviewed 36a43541 since the prior Pullfrog review, checked both resolved discussions against the current code, and read the full PR diff for context.
- Restored shared lockout: Incorrect revision code checks now consume the same failed-attempt budget as ordinary confirmation, while correct checks leave the code available for execution.
- Corrected nested schemas: Bulk checklist and scheduled-reminder edits now declare their supported fields without bypassing recursive schema validation.
- Added regression coverage: Tests assert mixed-path lockout, correct-code preservation, exact executed list values, and malformed-edit rejection. The focused held-write, preview, and challenge suite passed all 214 tests.
openai/gpt-6.1-sol | 𝕏
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Held Astra writes now accept edits only after the parameter schema and the write tool's own argument check accept the complete revised arguments. Accepted edits remain in the hold and reach the ordinary execute parser; rejected edits return
invalid_revisionwithout replacing the held arguments.The checks live in
src/Orbit.Application/Chat/Tools/Implementations/. MediatR tools reuse their execute parser and send a read-onlyCheckChatCommandQuery, which runs the existing FluentValidation validators and checks referenced owners and domain guards. Habit command builders and theHabitandGoalguards are shared with execution. Account deletion checks inspect the challenge without consuming its code or recording failed attempts.AgentArgumentSchema,PendingOperationRevisionServiceand the preview builders keep schema validation first, validate bulk item edits through the tool, preserve server preview IDs across repeated edits, and keep ignored action arguments fixed. Regression coverage lives inHeldWriteRevisionTests,HeldWriteArgumentCheckTests, their shared context, and the existing preview tests.Client compatibility: the existing
PendingOperationChange.IsEditablecontract carries the edit control, as it already does forcreate_habitandupdate_habit. Consumed fields backed by the new checks now emit that flag. No client contract change is required. Browser verification was excluded by the work order.Refs thomasluizon/orbit-tickets#980
Test evidence
env -u LANG dotnet test tests/Orbit.Application.Tests --no-build --filter 'FullyQualifiedName~TagToolTests|FullyQualifiedName~ProfileNotificationCalendarToolTests|FullyQualifiedName~BulkCreateHabitsToolTests'passed all 77 unchanged tests.env -u LANG dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~HeldWriteRevisionTests'initially failed five cases: the blank bulk-create child inInvalidValue_ReturnsInvalidRevisionAndPreservesHold, bothDuplicateTagName_ReturnsInvalidRevisioncases,DeleteSelectedNotifications_ChecksEveryOwnerWithoutDeleting, and the ignored suggestion argument inIgnoredArgument_RemainsFixed. These failures were observed before the fixes. The revised tests use real tool parsers, command validators, repository predicates and domain entities.env -u LANG dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~HeldWriteRevisionTests.InvalidValue'additionally failed the empty goal unit case before its check stopped accepting the tool's fallback value.IArgumentCheckTooldeclarations temporarily removed and their exact source restored afterward,env -u LANG dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~HeldWriteRevisionTests.ValidEdit_ExecutesStoredRevisedValue'failed all 35 cases. After restoration, the expanded tests accept edits, execute the stored values, and reject invalid revisions.dotnet build Orbit.slnx: exit 0, zero errors.env -u LANG dotnet test tests/Orbit.Application.Tests --no-build --filter 'FullyQualifiedName~Chat': 1,100 passed.env -u LANG dotnet test tests/Orbit.Application.Tests --no-build --filter 'FullyQualifiedName~MoveHabitParentCommandHandlerTests|FullyQualifiedName~HeldWrite': 156 passed after the final refactor.env -u LANG dotnet test: exit 0, 8,453 passed across all four test projects.env -u LANG LC_ALL=en_US.UTF-8 dotnet test: exit 0, the same 8,453 passed.The change introduces no HTTP response fields or external CLI response reads in production code. The installed MediatR and FluentValidation calls are exercised by the focused tests with the real argument-check handler and validators; dispatch returns the repository-owned
Result.dotnet test tests/Orbit.Application.Tests --filter FullyQualifiedName~HeldWriteRevisionTestspassed all 123 existing tests with both defects present.AccountDeletionRevision_SharesLockoutWithOrdinaryConfirmation: three cases accepted the correct code after exhausted attempts.ChallengeCheck_WrongCodesExhaustConfirmationBudget: both operations failed to decrement attempts.BulkObjectListEdit_ExecutesStoredRevisedValue: five supported edits returnedinvalid_revision.dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~HeldWriteRevisionTests|FullyQualifiedName~ConfirmAccountDeletionCommandHandlerTests|FullyQualifiedName~ApiKeyCreationChallengeFlowTests'passed all 164 tests. Malformed-entry and code-preservation guards passed before and after.env -u LANG dotnet test: exit 0, 8,474 passed.env LC_ALL=en_US.UTF-8 dotnet test: exit 0, 8,474 passed.Assumptions
None.
Manual steps
None.
None beyond normal API deployment. No new configuration, secrets, migrations, backfills, or client changes.