Skip to content

Preserve brain dump reuse and schedules through approval - #1000

Merged
thomasluizon merged 3 commits into
mainfrom
fix/ticket-1856-g9a-brain-dump
Oct 29, 2026
Merged

thomasluizon merged 3 commits into
mainfrom
fix/ticket-1856-g9a-brain-dump

Conversation

@thomasluizon

@thomasluizon thomasluizon commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Tracks thomasluizon/orbit-tickets#1856

Brain dumps that copied a suggested habit's zero-second clock values could hold a preview but fail approval. Recurring items carrying only a start anchor also lacked a visible first date, and source-text localization could overwrite a reused habit's stored title casing.

BulkCreateHabitsTool.Arguments.cs prepares the same typed arguments for capacity checks, validation, preview and execution. It converts zero-second suggestion times to minute precision and includes a supplied recurring start date as due_date when absent. Existing validators still reject invalid times, and the existing commands and domain guards remain authoritative. ProcessUserChatCommand.Resolution.cs prioritizes an existing ID and binds its stored title; HabitProposals.cs and HabitProposalValidator.cs keep localization from undoing that binding. PendingOperationChangePreviewer.Reuse.cs marks due_date as display-only when start_date controls recurrence. PendingOperationRevisionService.cs keeps a matching displayed date synchronized when the anchor is edited. No message pattern selects, triggers or rewrites tools.

HabitModelInstructions.cs and the bulk, lookup, calendar and habit-month descriptions limit brain dump preparation to the message, query_habits for reuse and suggest_habits for requested ideas. Prompt and tool text in English, with pt-BR review translations, is inventoried in BrainDumpCopy.md. No new user-facing runtime sentence is added. AnswerComposition.md and the tools README describe the behavior.

The captured reuse calls already supply habit_id, including English r1. The API retains entityId and the habit_id field's proposed UUID through JSON and SSE. The paired eval visible-preview.mjs projection removes those identity values; that remaining projection work belongs to the existing paired tickets thomasluizon/orbit-tickets#1863 and thomasluizon/orbit-tickets#1864. The ideas r2 and r3 approval message about duplication or changed fixtures was a row-count check after failed execution: the persistence replay exposes the actual HH:mm validation failure. After normalization, all three new records are saved and both stored fixtures remain byte-for-byte equivalent on fresh-context readback.

Assumptions

  • Treat the existing bulk habit_id and preview entityId as the equivalent identity requested by the ticket; rejected adding a redundant existingHabitId response property because the captured API already carries identity.
  • Derive the missing first date from the typed recurring start_date; rejected parsing date words from the message.
  • Keep minute-precision write validation and normalize only zero-second suggestion times in the bulk adapter; rejected relaxing the shared time validator for unrelated operations.

Test evidence

Before changing tests or implementation:

  • dotnet test tests/Orbit.Application.Tests --filter FullyQualifiedName~BrainDump --logger 'console;verbosity=minimal': exit 0, 23 passed with the defects present.
  • dotnet test tests/Orbit.Infrastructure.Tests --filter FullyQualifiedName~BrainDump --logger 'console;verbosity=minimal': exit 0, 12 passed with the defects present.

Strengthened tests before their fixes:

  • dotnet test tests/Orbit.Application.Tests --filter FullyQualifiedName~BrainDump_GateNine --logger 'console;verbosity=minimal': exit 1. BrainDump_GateNineCaptureKeepsIdentityAndEffectiveStartDate failed both captured mixed cases because the due_date field was absent; four captured reuse cases already passed.
  • The same command with the stored-title variants: exit 1, two failures showing Water instead of stored WATER and Beber água instead of stored Beber Água. The captured arguments were unchanged; only the owned stored title casing differed.
  • dotnet test tests/Orbit.Infrastructure.Tests --filter FullyQualifiedName~BrainDump_GateNine --logger 'console;verbosity=minimal': exit 1. BrainDump_GateNineIdeaApprovalPreservesEveryStoredFixture failed both captured ideas r2/r3 approvals with due_time must use HH:mm format or null. The test baseline was read from a fresh context to avoid SQLite DateTime kind serialization differences.

The final edit-path safeguard was also observed red before its fix:

  • dotnet test tests/Orbit.Application.Tests --filter FullyQualifiedName~BrainDump_GateNineCapture --logger 'console;verbosity=minimal': exit 1, seven captured cases offered an editable due_date even though start_date controls creation.
  • dotnet test tests/Orbit.Infrastructure.Tests --filter FullyQualifiedName~BrainDump_GateNineStartDateEdit --logger 'console;verbosity=minimal': exit 1, both captured mixed cases kept the old due_date after changing the anchor. These persistence replays pass the captured arguments through TerminalWriteDirective.ExecutionArguments, matching the production chat boundary's removal of its completion marker.

After the fixes:

  • dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~BrainDump|FullyQualifiedName~ExistingHabitSuggestion|FullyQualifiedName~HabitProposalValidator' --logger 'console;verbosity=minimal': exit 0, 79 passed.
  • dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~BrainDump|FullyQualifiedName~PendingOperationChangePreviewer' --logger 'console;verbosity=minimal': exit 0, 160 passed after the editability safeguard.
  • dotnet test tests/Orbit.Infrastructure.Tests --filter FullyQualifiedName~BrainDump --logger 'console;verbosity=minimal': exit 0, 22 passed, including fresh-context approval readback for the captured ideas, reuse and mixed cases, plus start-date edits in both languages.
  • dotnet build Orbit.slnx -c Release: exit 0, zero errors. OpenAPI regeneration left every supported artifact unchanged.
  • python3 .github/scripts/openapi_artifacts.py freshness: exit 0.
  • node tools/capability-inventory.mjs --check: exit 0.

Full Release suite, each run with dotnet test tests/<project> -c Release --no-build --logger 'console;verbosity=minimal':

Project Exit Passed Skipped
Orbit.Domain.Tests 0 1215 0
Orbit.Application.Tests 0 9186 0
Orbit.Infrastructure.Tests 0 6610 14
Orbit.Analyzers.Tests 0 40 0

The skipped Infrastructure cases require the existing optional PostgreSQL test environment.

Ten fixture files in tests/Orbit.Application.Tests/Fixtures/BrainDumps retain the real g9a tool arguments, results and readback evidence. They come from API 74c6e4f with eval harness fba2380cc; GateNine.md records provenance and replay behavior. No new external runtime response fields are read. The model schema's habit_id is optional in the authored schema and becomes required with a nullable string type through StrictToolSchema, consistent with OpenAI's function calling guidance. The real captured values and the existing typed API result establish the identity contract, rather than a guessed fixture field.

Live pass^3 evals, paired UI/eval updates and copy approval remain with the coordinator. No browser or application server was started, and no second repository was edited.

Review round 1 (bd74452e)

  • Pullfrog P1 (inherited weekdays): a child that omits days and carries a start_date keeps days = null when the preview's display due_date is added, so CreateSubHabitCommand inherits the parent's weekdays through preview, revision and approval. Explicit days (including []) and dated items without start_date keep their behaviour. BulkCreateAgentOperationTests.InheritedWeekdays.cs failed on f14cc68d (six failures, empty saved weekdays) and passes now; 50 of 50 BulkCreateAgentOperationTests pass with persisted readback.
  • API main 3277ebfe (orbit-api#999) is merged in the same commit; it shared AnswerComposition.md, PendingOperationChangePreviewer.cs and Chat/Tools/README.md.
  • By exit code: Release build 0; Domain 1,215, Application 9,200, Infrastructure 6,622 (14 skipped, Postgres only), Analyzers 40; OpenAPI freshness and capability inventory pass.
  • No person-facing or model-facing string changes in this round.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

The new display-date normalization can silently change a child habit from its inherited weekday schedule to daily tracking. Preserve the effective schedule before merging.

Reviewed changes Reviewed the chat proposal, preview, revision, and approval paths, including the sibling client's existing preview contract.

  • Argument preparation: Bulk creation normalizes zero-second clocks and derives missing dates recursively before validation, preview, and execution.
  • Reuse identity: Supplied IDs determine stored title spelling, and localization preserves those reuse titles.
  • Approval editing: Anchored due dates become read-only, with matching displayed dates synchronized when the anchor changes.
  • Instructions and coverage: Brain dump read guidance, bilingual copy documentation, captured fixtures, and replay tests are updated. Focused suites passed with 79 Application and 22 Infrastructure tests; an additional isolated persistence reproduction confirmed the inline regression.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-6.1-sol | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new issues found.

Reviewed changes Reviewed the changes from f14cc68d through bd74452e and verified that the resolved weekday-inheritance finding is fixed.

  • Preserved inherited weekdays: Kept omitted weekdays distinct from explicit empty arrays when an anchored child receives a display date, without changing the date-only default.
  • Added persistence coverage: Exercised existing and newly created parents through preview, revision, refresh, approval, and saved schedule readback. All 50 BulkCreateAgentOperationTests passed locally.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@sonarqubecloud

Copy link
Copy Markdown

@thomasluizon
thomasluizon merged commit 1535efe into main Oct 29, 2026
27 checks passed
@thomasluizon
thomasluizon deleted the fix/ticket-1856-g9a-brain-dump branch October 29, 2026 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant