Skip to content

feat(contracts): carry the reset-required store as typed problem detail - #2283

Merged
ScriptedAlchemy merged 2 commits into
masterfrom
fleet/reset-required-detail
Sep 27, 2026
Merged

ScriptedAlchemy merged 2 commits into
masterfrom
fleet/reset-required-detail

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

Follow-up to #2263 (merged as e2e6e18). #2263 merged its first commit only, reconciled against #2267's ProfileRoot threading. That left two things out:

  1. Master's daemon-control test module does not compile. restore_check_accepts_a_reset_required_daemon_and_returns_its_pending_reset still calls lock_user_data_dir_test_env() and the pre-refactor(storage): thread one ProfileRoot from each process boundary #2267 installed_service_status_snapshot(runner, version). On master e02eb55236, cargo test -p tracedecay-daemon-control fails:

    error[E0425]: cannot find function `lock_user_data_dir_test_env` in this scope
       --> crates/tracedecay-daemon-control/src/service/update_restore_tests.rs:273:21
    error[E0061]: this function takes 3 arguments but 2 arguments were supplied
       --> crates/tracedecay-daemon-control/src/service/update_restore_tests.rs:296:9
    

    This PR threads the fixture's ProfileRoot through the test. daemon-control lib: 99 passed.

  2. Reset-required refusals carry feat(contracts): carry typed problem detail beside the message #2259's typed detail. ApplicationProblemDetailV1::ResetRequired { authority, found_version, required_version, reason, remedy } is added, and ApplicationProblem::ResetRequired carries it. from_detail derives kind reset_required, retry never, legal action reset, code application.reset-required, and the message. Profile-retained reads (LCM, message search) and the project-open MCP refusal now answer with it, instead of flattening those facts into the message. Generated dashboard contracts are regenerated.

Proof

typed_terminal_restart_acceptance::reset_required_serving::… now also asserts the refusal's typed detail on a physically spawned daemon, over a profile whose session store records Git correlation v5:

{"kind":"reset_required","authority":"git correlation","found_version":5,"required_version":6,
 "reason":"git correlation profile schema 5 is incompatible with required schema 6; reset the profile",
 "remedy":"tracedecay wipe --all --yes"}

On master the same refusal is built from a plain SafeDiagnostic, so problem.detail is absent and this assertion fails. With this PR, typed_terminal_restart_acceptance passes 5 of 5.

Journey (built CLI; real beta.54 release-binary profile; this branch's daemon under a fake-systemctl managed service):

$ tracedecay daemon status   → state: running, service manager: RunningEnabled, protocol: Ready
$ tracedecay tool tracedecay_lcm_status --args '{"storage_scope":"user"}' --json
{"kind":"reset_required","legal_actions":["reset"],"retry":"never",
 "detail":{"authority":"git correlation","found_version":5,"kind":"reset_required",
  "reason":"git correlation profile schema 5 is incompatible with required schema 6; reset the profile",
  "remedy":"tracedecay wipe --all --yes","required_version":6}}
$ tracedecay doctor          → "Store profile authority requires reset (…). Pending operator action: run `tracedecay wipe --all --yes`" … exit=75
$ tracedecay wipe --all --yes → service stopped, profile wiped, service started, exit=0
$ tracedecay tool tracedecay_lcm_status {storage_scope:user} → status ok, no problem
$ tracedecay init; tracedecay_search alpha → fresh, alpha rank 1; tracedecay_status reset_required_stores → []; doctor exit=0

I could not re-run tracedecay update end to end on this build. This host's unauthenticated GitHub API quota is exhausted (403 remaining=0), so the release check fails before the flow completes. The maintenance window's stop, start, and restore still completed against the reset-required daemon, with no restore error. #2263's journey on the same update flow exited 75 and named the reset.

Suites (on e02eb55236, capped systemd-run scope)

  • tracedecay-daemon-control lib: 99 passed (does not compile on master)
  • tracedecay-contracts lib: 420 passed
  • tracedecay-automation-runtime lib: 414 passed
  • tracedecay-daemon-service lib: 320 passed. 1 failed, census_counts_each_composed_family_and_omits_uncomposed_families, red on master (test(daemon-service): adoption census expects 34 retrieval capabilities, catalog has 41 #2246)
  • tracedecay-cli bin (test-transport): 331 passed
  • tracedecay-mcp lib: 380 passed (workflow::test_runner cargo fixtures run serially: 10/10)
  • tracedecay lib project_open_handshake 3, tests::logging 4, doctor:: 39: all passed
  • tracedecay transport_acceptance_suite typed_terminal_restart_acceptance: 5 passed
  • Clippy -D warnings on the touched crates, with and without --features tracedecay-cli/test-transport,tracedecay/test-transport: clean
  • cargo fmt --all -- --check: clean. pnpm run contracts:check: up to date. Dashboard typecheck: clean

Persisted-shape refusals on retained reads and project-open tool calls
now answer ApplicationProblemDetailV1::ResetRequired with the refused
authority, its found and required versions, and the exact reset
command, instead of flattening them into the message.
@changeset-bot

changeset-bot Bot commented Sep 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 353303f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@ScriptedAlchemy
ScriptedAlchemy merged commit e681dea into master Sep 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T01:50:33.190621Z 353303f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ScriptedAlchemy
ScriptedAlchemy deleted the fleet/reset-required-detail branch September 27, 2026 01:48

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 353303feae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

/// A persisted store whose shape this binary does not open. It is served
/// in this typed state until the operator runs `remedy`, which deletes
/// the old data; nothing is migrated or backed up.
ResetRequired {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Regenerate the TypeScript SDK detail union

Adding this wire variant without updating crates/tracedecay-sdk/src/codegen.rs and regenerating sdks/typescript/src/types.ts leaves the public SDK's ApplicationProblemDetailV1 union limited to parked, stale_refresh_frontier, and lock_deadline. Responses from the new profile-retained and MCP paths therefore carry a reset_required discriminant that TypeScript declares impossible, preventing callers from narrowing the detail or accessing fields such as authority and remedy with their intended types. Update the generator and regenerate the SDK sources alongside the dashboard contracts.

AGENTS.md reference: AGENTS.md:L63-L68

Useful? React with 👍 / 👎.

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