Skip to content

fix(graph): reuse local Cursor auto-sync path - #656

Merged
IvGolovach merged 1 commit into
junhoyeo:mainfrom
IvGolovach:codex/cursor-graph-sync-20260601
Jun 4, 2026
Merged

fix(graph): reuse local Cursor auto-sync path#656
IvGolovach merged 1 commit into
junhoyeo:mainfrom
IvGolovach:codex/cursor-graph-sync-20260601

Conversation

@IvGolovach

@IvGolovach IvGolovach commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Make tokscale graph reuse the same best-effort Cursor auto-sync helper used by the other local reports.
  • Preserve the existing Cursor setup warnings while avoiding a hard failure when the implicit sync runtime cannot be created.
  • Add a CLI regression test proving a fresh Cursor cache does not emit a failed-sync warning for graph output.

Why

tokscale graph had its own Cursor sync path instead of using the shared local-report helper. That made graph behavior drift from models/hourly/time reports: a fresh cache could still trigger a sync attempt and a runtime initialization failure could escape the best-effort path. Reusing the shared helper keeps graph consistent with the rest of the CLI and avoids turning optional Cursor refresh into a blocker for local graph generation.

Diff scope

  • crates/tokscale-cli/src/main.rs: replaces the graph-specific Cursor sync block with auto_sync_cursor_for_local_report, preserving setup warnings and benchmark output semantics.
  • crates/tokscale-cli/tests/cli_tests.rs: adds a graph regression for fresh Cursor cache behavior using an explicit Cursor client filter to keep the test focused on the sync path.

Branch integrity

  • Base branch: main.
  • Validated base SHA: a86e688d620939d2c973c6d5625baa815ea223d7.
  • Ahead/behind: 0 behind / 1 ahead against origin/main.
  • Merge base: a86e688d620939d2c973c6d5625baa815ea223d7.
  • Fast-forward safety: origin/main is an ancestor of this branch.

Commit integrity

  • Introduced commit: 8e0aecc2cc96e3a9e5369d335543829701c11b8b fix(graph): reuse local Cursor auto-sync path.
  • The PR contains one logical change scoped to graph Cursor auto-sync behavior and regression coverage.
  • Ledger: not applicable - not required for this change family.
  • Version: not applicable - no release manifest changed; version coherence was verified.

Diff hygiene

  • git diff --name-status origin/main...HEAD: only crates/tokscale-cli/src/main.rs and crates/tokscale-cli/tests/cli_tests.rs changed.
  • git diff --check origin/main...HEAD: PASS, no output.

Validation mode and proof

Mode 2 - narrow runtime change, because the diff changes one CLI report path and focused CLI tests without touching migrations, auth, deployment tooling, or external contracts.

  • TDD red proof: cargo test -p tokscale-cli test_graph_fresh_cursor_cache_skips_auto_sync_warning failed before the implementation by exposing Cursor sync failed; using cached data despite a fresh cache.
  • cargo test -p tokscale-cli test_graph_fresh_cursor_cache_skips_auto_sync_warning: PASS, 1 test.
  • cargo test -p tokscale-cli cursor_auto_sync: PASS, 5 tests.
  • cargo test -p tokscale-cli graph_cursor: PASS, 1 test.
  • cargo fmt --all -- --check: PASS, no output.
  • bash scripts/check-version-coherence.sh: PASS, Version coherence OK: 3.0.0.
  • git diff --check origin/main...HEAD: PASS, no output.
  • Additional lint: cargo clippy -p tokscale-cli -- -D warnings could not run in this local environment because installed rustc is 1.86.0 while resolved dependencies require rustc 1.88.0+.
  • Not run: full workspace test suite - not required for selected validation mode; required remote CI will run after the PR is opened.

Required remote gates

Pending - GitHub Actions and mergeability checks will run after the PR is opened. Remote CI is expected to provide the final lint/build proof on its configured Rust toolchain.

Migration notes

Not applicable - no database migration changed.

Runtime safety

The change reuses an existing best-effort helper rather than introducing a new sync mechanism. Cursor sync remains optional, fresh caches short-circuit refresh, setup warnings are preserved, and graph generation still proceeds from local/cached data when sync is unavailable. No invariant regression introduced.

Documentation integrity

Not applicable - no docs, commands, or runbooks changed.

Rollback plan

Rollback: revert this PR. DB downgrade: not applicable. Data repair: not applicable. Operational caveats: reverting would restore graph-specific Cursor sync behavior that can warn or fail differently from other local reports.

Known residual risks

Remote CI and GitHub mergeability are pending until the PR is opened. Local clippy for tokscale-cli could not run on this machine because the installed Rust compiler is older than the resolved dependency MSRV; targeted tests and formatting passed locally.


Summary by cubic

Makes tokscale graph reuse the shared best-effort Cursor auto-sync helper used by other local reports. This keeps behavior consistent, avoids unnecessary sync warnings on a fresh cache, and ensures graph generation never blocks on auto-sync.

  • Bug Fixes
    • Switched to auto_sync_cursor_for_local_report for graph.
    • Preserved setup warnings; no hard failure if the implicit runtime can’t start.
    • Added CLI regression test to confirm fresh Cursor cache doesn’t emit a failed-sync warning.

Written for commit 8e0aecc. Summary will update on new commits.

Review in cubic

Validation
* Validation tier: Tier 2 - Narrow runtime change; graph now reuses the existing local-report Cursor sync helper and adds a CLI regression test for the fresh-cache warning path.
* Red test: cargo test -p tokscale-cli test_graph_fresh_cursor_cache_skips_auto_sync_warning: FAIL before fix, exposed `Cursor sync failed; using cached data` despite fresh cache.
* cargo test -p tokscale-cli test_graph_fresh_cursor_cache_skips_auto_sync_warning: PASS
* cargo test -p tokscale-cli cursor_auto_sync: PASS
* cargo test -p tokscale-cli graph_cursor: PASS
* cargo fmt --all -- --check: PASS
* git diff --check: PASS
* git diff --cached --check: PASS
* Version: PASS, bash scripts/check-version-coherence.sh
* Ledger: not applicable - not required for selected validation tier/change family.
* Additional lint: cargo clippy -p tokscale-cli -- -D warnings could not run; local cargo-clippy reported rustc 1.86.0 while dependencies require rustc 1.88.0+.
* Not run: full test suite - not required for selected validation tier.

Rollback
* git revert HEAD
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tokscale Ignored Ignored Preview Jun 1, 2026 4:13am

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

@IvGolovach
IvGolovach merged commit 4987875 into junhoyeo:main Jun 4, 2026
15 checks passed
@IvGolovach
IvGolovach deleted the codex/cursor-graph-sync-20260601 branch June 4, 2026 22:52
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.

2 participants