Validate GitHub issue-form answers before exporting items

Merged
UN
1mo ago
+1136-60

An explicitly selected GitHub issue form is compiled into a completion contract before export. Required answers, supported validators and pm-field bindings are checked against current SDK state before any POST/PATCH. Missing or invalid answers produce one bounded repair checklist and zero remote writes.

Externally supplied names now use own-property semantics throughout the package. Previously, an omitted optional toString answer could read Object.prototype and block an otherwise complete export. Now toString, constructor, __proto__, hasOwnProperty, valueOf and Unicode IDs work as ordinary data. There is no prototype-name denylist. Invalid pollution-shaped answer objects refuse by value type, and prototype descriptors remain unchanged.

Answer and binding input maps validate through Map, preserving own __proto__ entries that a record parser discarded. Shared guarded reads and own data-property writes cover options, headers, project status candidates, GraphQL aliases, timeline/identity/native fields, closeout counters and operational JSON lookups. Environment snapshots use Map and writes define own properties on both runtimes. The package-wide audit lists converted sites and explains the remaining numeric offsets, fixed-schema accesses and safe deletion.

AcceptanceEvidence
Required dropdown/text fields and supported validators/bindingsTyped compileIssueForm/completeIssueForm, pm github form --compile, and opt-in export form flags
Unsupported constructs explicitly refuseOne strict bounded input boundary; no silent omission of unsupported form elements or validators
Missing required answer means zero remote writesSDK and installed CLI guards validate the entire selected batch before writes; randomized required-answer failures invoke the actual exporter with --apply against a recording fake server
Valid prototype/Unicode names are allowedFixed optional toString omission successfully exports; own __proto__ answers and binding names are retained; options, headers and project mappings have direct regression tests
Property model closes the lookup class500 generated issue forms compare complete compiled fields, validation verdict and answered counts against an independent Map model; every name is required/optional and answered/omitted/blank; every case checks Object.prototype descriptors
State/input safetyOriginal 500 seeded SDK state sequences and 500 extreme-validator/output-count cases remain; no persisted completion plan or idempotency key is introduced
Agent-sized output, docs, no-git operationTyped SDK, compact TOON/JSON, README/examples and real plain SDK trackers without git/gh

Form-scoped export selection uses certified complete SDK listing in process. This also works without a pm or git executable and avoids redundant CLI dependency coverage profiles during the generated export checks. The adapter uses native SDK document reads, expected errors and the package's existing authenticated/retrying REST reader. It adds no journal or shared mutable completion state. Every check reads current native state; the form digest is a source identifier, not approval or an idempotency key. Existing import/sync and export identity/idempotency behavior is unchanged.

Real-data regression uses a filesystem-read-only, non-git copy of the public pm-github tracker at fcd9f93e28e85b170506ceac507d82a911173683, with the public feature-request form. Results remain 152 items, 5 fields / 3 required, 68 ready, 84 incomplete, 100 required-answer repairs; 152 identical replays, unchanged full snapshot fingerprint, 0 tracker / 0 remote writes. Maximum reports remain 1,580 JSON / 1,660 TOON bytes. The runner is test/issue-form-real-data.ts; no tracker contents are published here.

Behavioral revert proof: changing only the answer lookup from Map.get back to inherited record lookup (Object.fromEntries(request.answers)[field.id], preserving the new internal representation) makes the 500-form property test fail with an answered-count mismatch, 0 versus 1, exit 1. Restoring Map.get passes. Separately, reverting only form export selection to the child CLI makes the no-executable regression fail with ENOENT; the certified SDK selector passes. The original export-guard revert proof remains recorded on the pm item. No thread reply or reviewer request was posted.

Local validation:

  • Prototype fixed/property and no-executable selection: 3/3 under Node and Bun, including all 500 generated forms and 430 zero-write required refusals.
  • Helper/projects/release-policy/coverage selection: 76/76; handlers/lifecycle/identity/refresh/closeout selection: 237/237.
  • Full issue-form and own-property targeted c8 selection: 15/15, zero failed/skipped, exact 100/100/100/100 for issue-forms.ts and own-record.ts.
  • node --test test/own-property.test.ts and targeted local Bun: 4/4 each. pm test pm-github-ix5j --run --only-last --progress also passed.
  • npm run typecheck, npm run build, npm run build:test, npm run lint, npm run docstring (20 files / 220 declarations), npm run duplication (21 authored modules / zero duplicates), privacy and changelog checks passed. Pins, source scope and thresholds are unchanged.

Full gates passed for bad1b0be328e9e12c209d2fc5b4fd0edec4d4eba: CI run 40282827255, CodeQL run 40282827281. Every matrix job completed successfully; no skipped, cancelled or failed tests.

GateNode versionsMeasured result per job
npm run release:check22, 261,514 passed; 0 failed/skipped/cancelled; 21 authored modules exact 100/100/100/100
bun run release:check22, 261,514 passed; 0 failed/skipped/cancelled; 21 authored modules exact 100/100/100/100
npm run test:bun (native Bun 1.3.14)22, 261,514 passed across 55 files; 0 failed/skipped

All six suite runs confirm the 500 generated forms and 430 zero-write required refusals. Source scope, thresholds, heap limit and CI commands are unchanged. The previous correction run passed 1,513 tests before exhausting c8 aggregation memory; it is historical failure evidence, not acceptance evidence. Certified in-process SDK selection resolves that aggregation overhead without dropping cases.

PM item: pm-github-ix5j, unclosed with its claim released. All review work and the revert proof are in its append-only history.

Separate follow-up: pm-github-fqjp tracks legacy custom terminal-status mapping. Existing export identity/idempotency limitations remain outside this change. Automated review services previously skipped or reported unavailable quota/trial; no approval is inferred.

Summary by Sourcery

Add opt-in GitHub issue-form contracts that validate current tracker state before export while hardening package-wide handling of externally supplied property names.

New Features:

  • Add read-only GitHub issue-form compilation and completion through the typed SDK and pm github form command.
  • Allow opt-in issue-form validation and generated bodies during export, with complete batch preflight and zero writes when answers are incomplete or invalid.

Bug Fixes:

  • Prevent inherited prototype properties from being mistaken for externally supplied answers, options, headers, mappings, and other data.
  • Preserve valid prototype-name and Unicode keys while safely rejecting malformed pollution-shaped inputs and protecting object prototypes.

Enhancements:

  • Centralize own-property reads, own data-property writes, and null-prototype accumulators across external-data boundaries.
  • Support bounded validators, native field bindings, repair checklists, compact reports, and explicit refusal codes for unsupported or invalid form input.

Build:

  • Add YAML and Zod dependencies for issue-form parsing and strict input validation.

Documentation:

  • Document issue-form contracts, supported schema features, validation behavior, CLI usage, and own-property handling.
  • Add issue-form answer and binding examples plus a package-wide own-property audit.

Tests:

  • Add comprehensive issue-form, prototype-safety, zero-write export, SDK-native, CLI, property-based, fuzz, and real-data regression coverage.

Chores:

  • Record PM feature and follow-up issue history for the form validation work.