Skip to content

Migrate custom field default values #63

Description

@SIkebe

Background

GitHub Projects supports default values for Text, Number, and Single-select project fields. New items are automatically populated with those defaults. FieldSnapshot currently has no default-value property, so export, import, and verify silently omit this behavior.

Date fields do not support defaults and are not part of this issue.

Confirmed API capability (2026-08-19)

Default values are browser-only for all three supported field types.

  • GitHub.com GraphQL introspection shows no defaultValue field on ProjectV2Field or ProjectV2SingleSelectField.
  • CreateProjectV2FieldInput and UpdateProjectV2FieldInput accept names, select options, and iteration configuration, but no default value.
  • The Projects REST field response and create request contain field metadata/options/configuration but no default-value property.
  • REST has no Project-field update endpoint that could set a default later.

The implementation must use Playwright for both reading and writing defaults. There is no REST/GraphQL default-value path to cover in Ghpmv.Integration.Tests.

Implementation scope

  • Add backward-compatible nullable snapshot properties for Text, Number, and Single-select defaults.
  • Read defaults from Project field settings even when no item currently uses the value.
  • Resolve a Single-select default by option name, never by source option ID.
  • Apply defaults after the field and select options exist.
  • Preserve existing item values; changing a default must affect only future items.
  • For legacy snapshots with no captured default, preserve the target default rather than clearing it.
  • Compare captured defaults during browser-assisted verify.

Test strategy

  • Add serialization and backward-compatibility tests in SnapshotTests.cs.
  • Add deterministic mapping/verifier tests for Text, Number, and Single-select defaults, including zero, negative, Unicode text, and renamed option IDs.
  • Add Playwright E2E coverage for source export, target import, browser-assisted verify, clearing a default, and target drift for all three supported types.
  • Do not add an Integration test for the default setting itself because public REST/GraphQL does not expose it.
  • Browser E2E must use cancellation tokens and finally cleanup.

ghpmv-e2e-validation skill integration

Do not add a separate user-facing scenario selector for this issue. Extend the existing browser-e2e flow and standard fixture checkpoints.

This feature is not complete until the existing browser-e2e flow validates field defaults end to end.

  • Extend the API/UI fixture builder and setup --fixture --fixture-ui path to create Text, Number, and Single-select fields with deterministic defaults and pre-existing items with non-default values.
  • Keep the existing validation-mode selection; announce the additional source/target Project state and post-import draft item within the normal resource-creation confirmation.
  • Require Step 6 to inspect snapshot.json and confirm all captured typed defaults before target preparation.
  • After import/verify, have the skill create a disposable target draft through the supported UI/API path and observe that GitHub applies the defaults; this is a functional assertion, not just a settings-page check.
  • Confirm pre-existing imported item values did not change.
  • Inject one target default drift, rerun browser-assisted verify, and require a Field mismatch before restoration.
  • Add all created drafts/Projects to the resource inventory and require explicit cleanup consent.
  • Add/update Browser E2E fixture tests and non-secret E2E settings only where needed.

Existing manual E2E flow additions

E2E runtime consolidation: Do not add a standalone feature scenario or repeat the full fixture/export/import/verify/cleanup sequence. Fold fixture setup into the existing fixture step, snapshot assertions into the existing export result, target assertions into the existing import/verify and visual checklist, deliberate drift into the existing negative-test phase, and repair into the single idempotence re-import. Reuse the same snapshot, mappings, and target Project. Add another disposable target or native command only when a distinct code path cannot be proven otherwise; document why and include every added resource in the existing inventory and cleanup.

Extend the existing browser-assisted migration flow in docs/MANUAL_TEST_PLAN.md with these checkpoints:

  1. Configure source Text, Number, and Single-select fields with distinctive defaults, including Unicode text, zero or a negative number, and a non-first select option.
  2. Run browser-assisted export and inspect the captured defaults in snapshot.json.
  3. Import into a disposable fresh target Project and run browser-assisted verify.
  4. In the target UI, inspect each field setting and create a new draft item after import. Confirm the new item is automatically populated with all three defaults while pre-existing imported items retain their original values.
  5. Change one target default and rerun verify; the Field category must identify the drift.
  6. Rerun import, create another new draft, and confirm the restored defaults are applied without changing existing items.
  7. Record commands, field values, the new-draft behavior, verify output, and UI observations.
  8. Delete the disposable target Project.

If fixture setup cannot configure defaults deterministically, extend the browser fixture command or document exact field-settings preparation steps.

Acceptance criteria

  • ghpmv-e2e-validation can build the default-value fixture, inspect snapshot values, validate functional application to a new target item, detect drift, and clean up created drafts/Projects.

  • docs/MANUAL_TEST_PLAN.md verifies both the stored settings and their functional effect on newly created target items, including drift, rerun, and cleanup.

  • Text defaults round-trip.

  • Number defaults round-trip, including zero and negative values.

  • Single-select defaults round-trip by option name.

  • Clearing a captured default is supported.

  • Legacy snapshots do not modify the target default.

  • Existing item values are unchanged.

  • Browser-assisted verify detects default-value drift.

  • Field-default support and Date-field exclusion are documented.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions