Skip to content

refactor(github): board fields are written only through the roadmap store, and projects.py keeps provisioning #999

Closed as not planned

Description

@dan-petty

Context & Rationale

Two modules write board fields with gh project item-edit, and two own Status policy. Checked at 9c879ae.

  • roadmap/github_store.py (:571-810) writes a field and, beside it, the Job record ADR 0002 requires, so a later job can tell a person's change from its own.
  • github/projects.py (:851-1244: sync_repository_issues_to_project, plan_item_changes, _forced_status, initial_status, declared_priority, _edit_project_item_field, reconcile_project_custom_fields) writes without the compare. It forces Done / In Progress / In Review from pull request state, a vocabulary the Roadmap does not use; CONTEXT.md's Started, Stalled and Not planned appear nowhere in src/. gh project reconcile can therefore overwrite what a person or a job set.
  • The store is used by four milestone commands only. No command calls store.set_field; only the intake and refine jobs call it (roadmap/intake.py:1165, roadmap/refine.py:1156). commands/gh.py imports 9 names from github.projects and from roadmap.store side by side.
  • tests/test_github_projects.py and test_github_projects_reconcile.py: 62 tests patching projects.run_gh 18 times, _is_graphql_quota_exhausted 10 times and _get_authenticated_user 6 times.

Deletion test: delete the item-write half of projects.py and the only behaviour that vanishes is the old status-forcing policy; the field writes already exist in the store. Two real adapters (GitHubRoadmapStore, InMemoryRoadmapStore) already justify the seam.

Scope & Deliverables

Strategic Alignment

Scope added 2026-10-02: checked at 38517a8, with two corrections. "Not planned" does appear in src, as CloseReason.NOT_PLANNED in roadmap/store.py:68; only Started and Stalled do not. In Progress, In Review and Done are the board statuses that CONTEXT.md's Started names ("in progress, in review or done", CONTEXT.md:43-45), so the defect is not a foreign vocabulary. It is that projects.py forces them from pull request state (_forced_status, github/projects.py:916-930) and writes them with gh project item-edit (:990-1011) without the last-set compare ADR 0002 requires. The store is read by four gh milestones commands (commands/gh.py:316-398) and by the roadmap jobs; intake and refine write fields through it. #740 (v0.2.25, in flight) adds Status writes through the store (a stalled item goes back to Ready), the run record and the last-set reads to both adapters. #981 (v0.2.26) adds devops roadmap run.

Acceptance criteria

  • rg '"item-edit"' src finds only roadmap/github_store.py and the rate limiter's list of mutating verbs (config/constants.py:1935).
  • github/projects.py keeps template loading, field and view provisioning and the auth-scope checks. _forced_status, plan_item_changes, _edit_project_item_field, _reconcile_single_item, _apply_field_updates and the item-writing half of reconcile_project_custom_fields are moved into the job or deleted.
  • Status from pull request state is a roadmap job written against RoadmapStore and run by devops roadmap run. It applies today's rules (closed issue to Done, draft PR to In Progress, open or linked open PR to In Review). Before each write it compares the field with the value it last set, and leaves the field alone if a person changed it since.
  • A test on InMemoryRoadmapStore: a person moves an item from In Review back to In Progress while its PR is open, and the next job run leaves it there. The same test with no person's change writes In Review once, and a second run writes nothing.
  • gh project reconcile and gh project sync provision fields and views and write no item field. gh project sync reconciles by default today (--reconcile-fields, commands/gh.py:472-478; github/projects.py:1284-1287), so the flag goes. A test asserts that neither command issues an item-edit.
  • The item-writing tests in tests/test_github_projects.py and tests/test_github_projects_reconcile.py become job tests on InMemoryRoadmapStore, with no run_gh or GraphQL-quota patches. The provisioning tests stay.
  • The tests run offline.
  • Names the job that does.
  • uv run devops ci passes.
  • (person-run) devops roadmap run --dry-run on the board lists the Status writes it would make, and skips an item whose Status a person changed after the job's last write.

Key questions

Update 2026-10-08: refinement

Unblocked; #880 lands first. The item-edit criterion passes today only because reconcile uses item_edit_args (github/projects.py:991-1000); it becomes 'rg -n item_edit_args src prints nothing'. Helpers were renamed (plan_item_changes :833, reconcile_project_custom_fields :1044). Keep _stop_before_write. Provisioning stays in projects.py, so #1376 stays separate; the field builders go once nothing uses them, and the store's _read_fields already reads fail closed.

Proposed design

Problem statement

Two modules write board fields with gh project item-edit. The roadmap/github_store.py module writes with a Job record compare per ADR 0002. The github/projects.py module writes without the compare and forces Done, In Progress, or In Review from pull request state. A person's Status change can be overwritten. This item routes every board-field write through RoadmapStore so the last-set compare holds on every path. The projects.py module keeps only provisioning.

Acceptance criteria

  • Criterion 1: No item_edit_args, field_list_args, or FieldListingPayload reference exists in src/.
    Verification: rg -n 'item_edit_args|field_list_args|FieldListingPayload' src prints nothing.
  • Criterion 2: github/projects.py keeps template loading, field and view provisioning, and auth-scope checks. Item-writing functions are removed.
    Verification: _forced_status, plan_item_changes, _edit_project_item_field, _reconcile_single_item, _apply_field_updates and the item-writing half of reconcile_project_custom_fields are absent from github/projects.py. The _stop_before_write helper is kept.
  • Criterion 3: Status from pull request state is a named roadmap job on RoadmapStore, run by devops roadmap run. It applies today's rules: closed issue to Done, draft PR to In Progress, open or linked open PR to In Review. Before each write it compares the field with the value it last set and leaves the field alone if a person changed it since.
    Verification: A test on InMemoryRoadmapStore: a person moves an item from In Review to In Progress while its PR is open, and the next job run leaves it there. With no person's change, the job writes In Review once, and a second run writes nothing.
  • Criterion 4: gh project reconcile and gh project sync provision fields and views. They write no item field. The --reconcile-fields flag is removed.
    Verification: A test asserts that neither command issues an item-edit. Running devops gh project sync --help shows no --reconcile-fields flag.
  • Criterion 5: Item-writing tests in tests/test_github_projects.py and tests/test_github_projects_reconcile.py become job tests on InMemoryRoadmapStore. No run_gh or GraphQL-quota patches remain in those tests. Provisioning tests stay.
    Verification: rg 'run_gh|_is_graphql_quota_exhausted|_get_authenticated_user' tests/test_github_projects.py tests/test_github_projects_reconcile.py finds no item-writing test patches. The provisioning and auth-scope tests are present and pass.
  • Criterion 6: The tests run offline.
    Verification: uv run pytest tests/test_github_projects.py tests/test_github_projects_reconcile.py passes with no network access.
  • Criterion 7: CI passes.
    Verification: uv run devops ci passes.
  • Criterion 8: devops roadmap run --dry-run on the board lists the Status writes it would make and skips an item whose Status a person changed after the job's last write.
    Verification: Run devops roadmap run --dry-run on a board with one person-changed item. The output lists the planned Status writes and names the skipped item.

Key questions

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    type/refactor
    scope/github
    priority/p2-medium
    on Oct 2, 2026
  2. dan-petty commented on Oct 3, 2026

    @dan-petty
    OwnerAuthor

    Order note (consolidation, 2026-10-03): #878 and #1010 are merged into #892 (v0.2.29). This item still lands after #892 and keeps its fixes. #880 (the priority source) lands before this item, in either order with #892. With all done, rg '"item-edit"' src finds only roadmap/github_store.py.

  3. dan-petty commented on Oct 8, 2026

    @dan-petty
    OwnerAuthor

    Note from #1361 (2026-10-08). #1361 moved every roadmap store write to card node ids, so the store no longer sends gh project field-list or a name-addressed item-edit --url --field (each about 101 GraphQL points on board #2 in gh 2.102.0). field_list_args, item_edit_args and FieldListingPayload remain only because gh project reconcile (github/projects.py, #892) still reads and writes through them. When this item moves reconcile's writes to the store, delete those builders and route reconcile through the store's node-id writes, so reconcile gets the same constant write cost.

  4. added this to the v0.2.37 milestone on Oct 17, 2026
  5. dan-petty commented on Oct 17, 2026

    @dan-petty
    OwnerAuthor

    Moved to v0.2.37: v0.2.37 started with fewer than its 16 items and was topped up to 16 from Ready items, critical fixes and P0 features first. (devops roadmap reprioritize)

  6. modified the milestones: v0.2.37, v0.2.38 on Oct 19, 2026
  7. dan-petty commented on Oct 19, 2026

    @dan-petty
    OwnerAuthor

    Status set back to New at 0ae4ea4: refine found it not ready (see Key questions, Fit and Suspected block in the proposed design in the issue body).

  8. modified the milestones: v0.2.38, on Oct 20, 2026
  9. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Status set to Ready at 69636b6 (see proposed design in issue body).

  10. dan-petty commented on Oct 28, 2026

    @dan-petty
    OwnerAuthor

    Closed as not planned. The item conflicts with a more recent project direction.

    This item routes every board-field write through RoadmapStore, so that the Job record compare of ADR 0002 holds on each write path. Its constraint is "ADR 0001 and ADR 0002 stand".

    On 2026-10-28 the owner decided that labels and milestones hold the Status, Priority, Value and Effort of an item, and that no roadmap job reads or writes the project board. The roadmap service moves to the devops-roadmap GitHub App (#1647), and a GitHub App gets the Projects permission only at organization level, so it cannot reach board 12.

    #2399 delivers that decision. It deletes the board code of the store, board_read.py, the board key and the Job record field check, and it amends ADR 0001. After #2399, no store writes a board field, so the premise of this item does not stay.

    No code was written for this item.

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

    priority/p2-mediumscope/githubtype/refactor

    Type

    No type

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions