Skip to content

Link manually published GitHub issues to local suggestion records #5350

Description

@Widthdom

Problem and priority

P2 — posting order 7/10. Audit candidates: D11.

A suggestion manually published through GitHub CLI cannot be linked back through an explicit local suggestion operation. Context text says it was published, but structured state still says draft/unsubmitted, creating avoidable re-submission risk. The workflow should also support several local findings intentionally consolidated into one upstream issue.

Reproduction and actual results

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll suggestions show f86c78ab419b --json --db .cdidx/codeindex.db

In the audited local history, this record's context explicitly says it was published as #5259 and must not be submitted again, while status remains draft, submitted_to_github is false, the attempt count is zero and no upstream issue identity is attached. That audit-local record ID is illustrative, not expected in another checkout.

To reproduce independently, create a local suggestion, manually publish its issue through GitHub, then inspect the available suggestions update/help surface: lifecycle transitions exist, but there is no explicit operation to associate the existing issue URL/number without submitting another issue.

Implementation instructions and cautions

Start with src/CodeIndex/Cli/SuggestionsCommandRunner.cs, SuggestionStore and SuggestionRecord.

  • Add an explicit link/associate operation accepting a validated repository identity and issue URL/number. This operation must never create a remote issue.
  • Persist the upstream identity, manual/external provenance and audit timestamp atomically. Define published/submitted/upstream-resolution states clearly without fabricating a cdidx submission attempt or falsely marking implementation complete.
  • Support multiple suggestions linked to one issue, as required when several audit observations share one PR. Idempotent linking should succeed; conflicting reassociation must be explicit and must not silently overwrite history.
  • Validate repository/host/issue identity and distinguish issues from pull requests if remote verification is used. Any verification should be read-only, bounded and use the existing GitHub integration; document offline behavior.
  • Keep old stores readable. Do not scrape arbitrary context text to mutate history automatically, and do not mass-update unrelated historical drafts.
  • Ensure list/show/export/duplicate-preflight understand the association so later submit actions can avoid accidental re-publication.

Acceptance and validation

  • Manually create one issue, link one and then multiple local suggestions to it, and verify an atomic round trip with zero remote issue-creation calls.
  • Cover idempotent repeats, wrong repository/invalid URLs, conflicting links, unavailable remote verification, old records and failed persistence.
  • Verify subsequent export/list/submission behavior and documented state transitions without faking submission attempts or completion.

Prior issues

Follow-up to closed #4719, which added manual lifecycle transitions and atomic export, and #4441, which added local update/delete operations. Those operations do not attach an existing upstream issue identity. The observed draft state reflects a missing association workflow; the audit does not establish that a previously linked ID was lost.

Baseline and delivery

Observed during the 2026-09-12 dogfood audit on macOS arm64, using repository-built cdidx 1.49.0 / Debug net8.0 at 36f2e68cb0d7f17bc9591d01ad3045abe870da9b. The build passed with zero warnings/errors. The root database and workspace-manifest freshness checks were healthy, with index and reference-graph completeness true. Counts/timings describe that checkout. Validation during discovery used focused CLI/MCP/LSP reproductions, not the full test suite.

Implement one focused PR for this issue. Follow AGENT_GUIDE.md and the relevant workflows, use the repository-built cdidx for discovery, preserve supported .NET 8/.NET 9 and cross-platform behavior, and avoid new runtime dependencies outside repository policy. Add focused behavioral tests for changed contracts, update affected help/documentation, and include a bilingual changelog.d/unreleased/ fragment for user-visible changes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    .NETPull requests that update .NET codeenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions