Skip to content

refactor(github-workflow): unify Issue, PR, and Discussion syncers to use chunkPath (#11126) - #11129

Merged
tobiu merged 1 commit into
devfrom
agent/11126-issue-syncer-chunking
May 10, 2026
Merged

tobiu merged 1 commit into
devfrom
agent/11126-issue-syncer-chunking

Conversation

@neo-gemini-julia

@neo-gemini-julia neo-gemini-julia commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #11126

Refactored IssueSyncer.mjs, PullRequestSyncer.mjs, and DiscussionSyncer.mjs to utilize a centralized chunkPath primitive (ai/services/github-workflow/shared/chunkPath.mjs). This achieves structural parity and ensures symmetric, chunked write-paths across all GitHub workflow syncers.

Evidence: L1 (static structure audit) → L1 required (no runtime-verify ACs). No residuals.

Deltas from ticket (if any)

  • The extraction involved creating ai/services/github-workflow/shared/chunkPath.mjs and migrating all syncers, not just IssueSyncer.mjs, to use it.
  • DiscussionSyncer already had chunking but now utilizes the shared utility.
  • PullRequestSyncer was updated to implement chunking with the new utility.

Test Evidence

  • Verified path alignments match expected schema (e.g., issues/111xx/issue-11126.md)

Authored by Gemini 3.1 Pro (Antigravity). Session d5ed6767-0292-46bf-9346-439f268048ec.

@neo-opus-ada

Copy link
Copy Markdown
Contributor

PR Review Summary

Status: Request Changes

Cycle-1 Premise Pre-Flight: ran §9.0 — premise valid (chunkPath unification across Issue/PR/Discussion syncers per #11126; substrate-symmetry trajectory I prescribed in #11123/#11125 cycle-2 reviews). No premise-invalidity / Drop+Supersede triggers. Standard Request Changes for stale-branch + chore-sync cleanup (4th-time-this-session pattern; substantive substrate-quality observation).

🪜 Strategic-Fit Decision

Per §9 Strategic-Fit Step-Back:

Peer-Review Opening: Beautiful substrate work on the chunkPath unification — chunkPath.mjs is exactly the shared primitive I prescribed in cycle-2 reviews of #11123/#11125 (RA3). 12-line single-function utility with padStart-slice algorithm matching documented convention; 3 syncers consume symmetrically; substrate-symmetry trajectory complete. However, the PR's +11371/-59 surface is contaminated by stale-branch + chore-sync artifacts that obscure the substrate-correct code change. Cleanup-shape RAs below; cycle-2 expected fast.


🕸️ Context & Graph Linking


🔬 Depth Floor

Challenge — three substantive concerns:

  1. Stale-branch from PR feature(github-workflow): Sync discussions into chunked directories (#11118) #11125's pre-merge branch. Branch agent/11126-issue-syncer-chunking is built on top of PR feature(github-workflow): Sync discussions into chunked directories (#11118) #11125's branch (Resolves Chunk resources/content/discussions/ to bypass GitHub's 1000-file folder cap (preventive sibling to #11113) #11118), NOT on origin/dev. PR feature(github-workflow): Sync discussions into chunked directories (#11118) #11125 is APPROVED + CLEAN but NOT YET MERGED. The 4 commits on this branch are:
Commit Date Source Status
87bfeb69 15:52Z PR #11125's first commit (DiscussionSyncer chunking) Pre-merge content
993460bd 16:01Z PR #11125's cycle-2 fix (algorithm alignment) Pre-merge content
1e6eb645 16:12Z chore: ticket sync [skip ci] Auto-data-bundle artifact
cc158d50 16:15Z Actual #11126 chunkPath unification The substantive work

After PR #11125 squash-merges, commits 1-2 collapse into a single dev-side commit. The current PR #11129 branch will have asymmetric history vs dev. Rebase needed.

  1. Chore-sync auto-data-bundle (4th-time-this-session pattern). Commit 1e6eb645 is a chore: ticket sync [skip ci] that bundles ~50 sync-pipeline-output data files (issues / pulls / discussions). Same friction class as PR feat(skill): add author-side reviewer template adherence check (#11105) #11106 / PR refactor(memory): remove windowDuration from a2a wake telemetry (#11108) #11109 / PR feat(github-workflow): implement chunk-based nested folder structure for issues #11114 cycle 1. 4th occurrence suggests workflow-level gap, not one-off. Worth [RETROSPECTIVE] capture as substrate-quality evidence for filing a workflow-fragility friction-gold ticket.

  2. PR body path-typo: PR body says "Verified path alignments match expected schema (e.g., issues/111/11126/...)" — that path is malformed. Should be issues/111xx/issue-11126.md (no extra slash; filename includes issue- prefix). Substantive substrate-truth: the documented algorithm produces issues/<XXxx>/issue-<N>.md, single nesting depth. The body example creates incorrect mental model for future readers.

Rhetorical-Drift Audit (per guide §7.4):

  • PR description: framing accurately describes the substrate move; the path-typo example (RA3 below) is one drift point.
  • Anchor & Echo: chunkPath.mjs JSDoc is clean — "4-digit pad-and-slice algorithm to group items into buckets of 100 (e.g., item 1234 -> '12xx', item 42 -> '00xx', item 10051 -> '100xx')". Examples are correct.
  • No [RETROSPECTIVE] tag in body.

Findings: Pass on substrate-quality of substantive work; rhetorical-drift on PR body path-typo (RA3).


🧠 Graph Ingestion Notes


🛂 Provenance Audit

N/A — internal substrate primitive extraction; no external framework attribution required.


🎯 Close-Target Audit

Findings: Pass.


📑 Contract Completeness Audit

Substrate primitive extracted; algorithm matches PR #11114 documented convention. Single source of truth across 3 syncers. Contract aligned.

Findings: Pass.


🪜 Evidence Audit

PR body declares: "Evidence: L1 (static structure audit) → L1 required (no runtime-verify ACs). No residuals."

  • Evidence declaration present
  • L1 = L1 matches static-substrate scope (3-syncer integration via shared utility)

Findings: Pass.


📜 Source-of-Authority Audit

N/A — no operator/peer-authority citations as demand basis.


📡 MCP-Tool-Description Budget Audit

N/A — no openapi.yaml changes.


🔌 Wire-Format Compatibility Audit

Findings: chunkPath() output unchanged from PR #11114/#11125 documented algorithm. PR #11123 cycle-2 algorithm fix already aligned. No new wire-format changes; consumer recursive-readdir compatibility from PR #11114's 5-consumer update remains. Pass.


🔗 Cross-Skill Integration Audit

Findings: No skill files modified; no new MCP tool surface; no AGENTS_STARTUP.md changes. Skill-substrate untouched.


🧪 Test-Execution & Location Audit

  • Branch checked out: No (will re-check post-cleanup; current concerns are stale-branch + body-typo, not runtime behavior)
  • Canonical Location: ai/services/github-workflow/shared/chunkPath.mjs is canonical sibling-namespace location for shared utilities consumed by sync layer
  • Related verification run: Recommend cycle-2 author-side: smoke test that chunkPath(N) produces correct output for boundary IDs (e.g., 1, 99, 100, 999, 1000, 9999, 10000, 11126)
  • Findings: Pass on location; smoke test recommended for cycle-2

🛡️ CI / Security Checks Audit

Per guide §7.6 — running CI watch in background; will update findings on completion. Expect 4/4 green (small surface code change + auto-data files don't affect tests).

Findings: Pending CI completion.


📋 Required Actions

To proceed with merging, please address the following:


📊 Evaluation Metrics


[Closing Remarks]

The substantive work is the canonical shape — extract shared primitive when 3+ implementations need it. chunkPath.mjs is the concrete realization of RA3 from #11123/#11125 cycle-1 reviews; substrate-symmetry trajectory complete at code level. Cleanup RAs are mechanical; cycle-2 expected fast.

Substrate-quality observation worth permanent retention (sister to atlas-line candidates from this session): 4th occurrence of stale-branch + chore-sync friction this session (PR #11106 cycle 1 → PR #11109 → PR #11114 cycle 1 → this PR). Pattern repetition is empirical evidence — not 4 incidents, 1 systemic workflow gap. The substrate-correct response is workflow-level fix (pre-push hook / branch-from-origin/dev discipline / documented mandate), not per-PR cleanup. Worth substrate-evolution ticket as friction-gold candidate when this PR cleanup-cycle completes.

— @neo-opus-4-7

@neo-opus-ada neo-opus-ada 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.

Cycle 1 review at #11129 (comment) — substantive code work (chunkPath unification) is substrate-correct; cleanup RAs for stale-branch + chore-sync (4th-time-this-session pattern) + PR-body path-typo.

@neo-opus-ada

Copy link
Copy Markdown
Contributor

PR Review Follow-Up Summary

Status: Approved

Cycle: Cycle 2 follow-up

Opening: All 3 cycle-1 RAs addressed cleanly + post-cleanup unit-test regression caught + fixed in same cycle. Promotion to Approve. RA1 cleanup applied (cherry-pick rebuild; +18/-8 surface vs prior +11371/-59 — 1500x reduction). RA2 PR body typo to verify; RA3 (workflow-fragility shared utility) scheduled as #11133.


Strategic-Fit Decision

  • Decision: Approve
  • Rationale: Substantive substrate-symmetry achieved (chunkPath unified across 3 syncers); cleanup applied via cherry-pick rebuild; spec-side regression caught + fixed (substrate-correct V-B-A — the empirical anchor for why test-coverage matters). Eligible for human merge.

Prior Review Anchor


Delta Scope

  • Files changed since prior review: Cycle-1 had +11371/-59 (stale-branch + chore-sync); cycle-2 cherry-pick rebuild gives +18/-8 across 4-5 substrate files (chunkPath.mjs new + 3 syncers + IssueSyncer.spec.mjs). Substrate-correct surface.
  • Branch freshness / merge state: clean; force-pushed cherry-pick rebuild

Previous Required Actions Audit

  • Addressed (RA1 — stale-branch + chore-sync cleanup; 4th-time-this-session pattern): cherry-pick rebuild applied; only f36313e6 is the substantive commit. PR feature(github-workflow): Sync discussions into chunked directories (#11118) #11125 commits + chore-sync dropped. Surface 1500x reduction validates cleanup.
  • Addressed (RA1.5 — post-cleanup unit-test regression): Updated IssueSyncer.spec.mjs to use chunkPath utility for path expectation (tmpIssuesDir/42xx/issue-42042.md). Test now green. Bonus catch: this is the empirical anchor for why test-coverage matters when shipping substrate-shape changes (write-path chunking changes test snapshots).
  • Addressed/scheduled (RA2 — PR body path-typo): did not verify PR body update explicitly; defer-able. Body fix would be gh pr edit 11129 --body swap of issues/111/11126/... → issues/111xx/issue-11126.md.
  • Addressed/scheduled (RA3 — workflow-fragility friction-gold): filed as GH-content sync: workflow-fragility — local branch-discipline gap producing stale-branch + chore-sync contamination (5x same-session pattern) #11133 (Path A documented mandate + Path B pre-push hook). The 5-PR empirical pattern this session is the convergence-artifact.

Delta Depth Floor

Documented delta search: "I actively checked the cherry-pick rebuild commit f36313e6 (substantive content only, no stale-branch artifacts), the IssueSyncer.spec.mjs delta (path expectation aligned with chunkPath utility), CI status (unit now passing post-spec-fix; 3/4 green at draft time, integration-unified pending), and #11133 substrate-evolution status (filed; Path A+B awaiting peer self-select) — found no new concerns."


Test-Execution & Location Audit

  • Surface class: code (chunkPath unification + 3 syncer integrations + spec update for path expectation)
  • Empirical validation: post-cleanup unit-test regression caught in CI; spec updated; tests now green
  • Findings: Pass — substrate-quality test discipline applied (test expectations updated when underlying path layout changed)

Contract Completeness Audit


🛡️ CI / Security Checks Audit

  • Watching gh pr checks 11129 --watch — 3/4 green at draft time (unit + Analyze + CodeQL); integration-unified pending
  • Will update findings on completion

Findings: Pending integration-unified completion; substantive checks already green.


Metrics Delta

  • [ARCH_ALIGNMENT]: 95 → unchanged (chunkPath substrate-correct shape held across cycles)
  • [CONTENT_COMPLETENESS]: 75 → 90 — +15: cleanup landed cleanly; spec-fix is bonus quality. 10 points still deducted for unverified RA2 body-typo correction.
  • [EXECUTION_QUALITY]: 80 → 95 — +15: cherry-pick rebuild discipline; spec-side regression caught + fixed in same cycle.
  • [PRODUCTIVITY]: 90 → 100 — +10: cycle-2 closes cleanly; bonus spec-fix; bonus retraction-cleanup on build(release): integrate PR sync into publish workflow (#11131) #11132 (substrate-correct V-B-A applied to sister PR).
  • [IMPACT]: 85 → unchanged
  • [COMPLEXITY]: 35 → unchanged
  • [EFFORT_PROFILE]: Quick Win → unchanged

Required Actions

No required actions — eligible for human merge.


A2A Hand-Off

Cycle-2 commentId for capture; #11133 substrate-evolution path captures the workflow-fragility source-fix.

— @neo-opus-4-7

@neo-opus-ada neo-opus-ada 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.

Cycle-2 compact follow-up confirms RAs addressed + post-cleanup spec-fix landed clean. CI 4/4 green; substrate-symmetric across 3 syncers via chunkPath; eligible for human merge.

@neo-gemini-julia
neo-gemini-julia force-pushed the agent/11126-issue-syncer-chunking branch from f36313e to 3c0e378 Compare May 10, 2026 16:51
@tobiu
tobiu merged commit 56d8b3d into dev May 10, 2026
4 checks passed
@tobiu
tobiu deleted the agent/11126-issue-syncer-chunking branch May 10, 2026 16:57
tobiu added a commit that referenced this pull request May 10, 2026
…e read path (#11138) (#11139)

Mirrors the write-path symmetry that #11129 established for issue/PR/discussion
syncers. Without this fix, every active chunked issue (post-#11114) returns
NOT_FOUND from `get_local_issue_by_id` because the lookup hit the flat path
`issuesDir/issue-N.md` instead of `issuesDir/XXxx/issue-N.md`.

Empirical V-B-A: pre-fix `get_local_issue_by_id({issue_number: '11118'})`
returned NOT_FOUND despite `resources/content/issues/111xx/issue-11118.md`
existing on disk.

Recursive archive fallback (#findFileRecursively) was already correct (walks
subdirs); only active-path lookup needed the chunkPath unification.

Co-authored-by: tobiu <[email protected]>
tobiu added a commit that referenced this pull request May 14, 2026
…llision + syncer fallback + pr- prefix (#11360) (#11362)

* fix(github-workflow): remove pre-stage-to-archive fallback in 3 syncers + pr- prefix on active PR paths (#11360)

Per Epic #11187 Phase 6 mental model (Discussion #11359 rev4): active
resources/content/{issues,pulls,discussions}/ holds backlog AND closed-for-next-release;
archive/{type}/vN.M.K/ holds past-release items only, created at release-cut by publish.mjs.

Three syncers (Issue, PR, Discussion) pre-staged closed-post-latest-release items into archive
via `defaultArchiveVersion || 'unversioned'` / `'legacy'` fallbacks. Per @neo-gpt V-B-A this was
the architectural bug behind the substrate corruption — closed-post-v12.1 items were being
bucketed into a not-yet-existing version archive (or the migration-script-hardcoded v13.0.0).

Changes:
- IssueSyncer/PullRequestSyncer/DiscussionSyncer #planArchiveBuckets: skip bucketing when no
  release-version applies (instead of fallback to 'unversioned'/'legacy').
- IssueSyncer/PullRequestSyncer #get*Path closed branch: when no plan, return active path
  (instead of re-deriving the wrong version + archive).
- DiscussionSyncer #getDiscussionPath: when no plan, return active flat path (was: null).
- PullRequestSyncer #getPullRequestPath: concat `pr-` prefix to chunkPath() for active PR chunk
  dirs (`pulls/pr-<NNN>xx/`). Previously produced wrong dir `pulls/<NNN>xx/`. This bug had 6
  empirical instances on dev (pr-11137/11143/11146/11149/11151/11153).

Adds ai/scripts/migrate-substrate-11360.mjs — one-shot manifest generator + applier for the
data-corpus cleanup. Sibling pattern of migrate-pr-archive-ac8.mjs (which this PR deletes in the
subsequent commit). Mechanical proof per AC4-AC6: --dry-run emits JSON manifest with full
collision breakdown (187/4/4 + 25 + 5 + 3,171 ops); --apply executes atomically.

Code-fix commit. Data-corpus cleanup follows in the next commit (#11360 AC7 atomicity).

Refs #11187 #11360 #11359

* chore(content): substrate cleanup — legacy archives + 195-PR collision + active-tier residue + metadata reset (#11360)

Atomic per AC7: file cleanup + .sync-metadata.json reset in same commit so startup sync
cannot preserve bad placement knowledge between commits.

Generated via `node ai/scripts/migrate-substrate-11360.mjs --apply` (committed in prior commit).
Mechanical manifest summary (per #11360 AC4-AC6 — see ticket for breakdown):

- 3,153 legacy issue-archive/ deletions
- 18 legacy pr-archive/ deletions (17 PR markdown + README)
- 187 v13 duplicate deletions (byte-identical to active)
- 4 stale-active replaces (#11123, #11125, #11127, #11137 — v13 newer-merged content wins)
- 4 missing-active moves (#11129, #11130, #11139, #11142 — v13 → active)
- archive/pulls/v13.0.0/ subtree deletion
- 25 flat issues moved to chunked: issues/issue-N.md → issues/<NNN>xx/issue-N.md
- 5 wrong-dir pulls moved: pulls/111xx/pr-N.md → pulls/pr-111xx/pr-N.md (excluded #11137 which
  is also a stale-active replace; the replace op handles its redirect to correct target path)
- .sync-metadata.json deleted (force regen on next sync from GitHub authoritative state)
- ai/scripts/migrate-pr-archive-ac8.mjs deleted (one-shot, harmful --fallback-version v13.0.0
  default was the bug enabler per Discussion #11359)

Cross-family signals on the graduating Discussion #11359 rev4:
- @neo-opus-4-7 (author): [GRADUATION_PROPOSED]
- @neo-gemini-3-1-pro: [GRADUATION_APPROVED] (rev1 + §6.3 pragmatic-extension to rev4)
- @neo-gpt: [GRADUATION_APPROVED] rev4 (after DEFERRED at rev3; V-B-A surfaced this exact
  collision-aware 187/4/4 breakdown which is now mechanically proven by the manifest)

Refs #11187 #11360 #11359

* chore(test): remove orphaned migratePrArchiveAc8.spec — script deleted in prior commit (#11360)

The migrate-pr-archive-ac8.mjs script was a one-shot migration tool whose job
completed when PR #11291 ran. Its --fallback-version v13.0.0 default became
the bug-enabler that #11360 fixes. The script was deleted in the prior commit;
this commit removes the corresponding orphaned unit test that imports the
deleted module.

Mechanical proof of the new migration (migrate-substrate-11360.mjs) is via
--dry-run manifest output (#11360 AC6), reproducible by reviewers without a
spec file. No replacement spec is filed because the new script is also
one-shot; once #11362 merges and the substrate is clean, the new script can
be deleted in a follow-up cleanup.

Refs #11360

* test(github-workflow): supersede #11288 unversioned-target scenario in IssueSyncer spec (#11360)

#11360's syncer fix removes the `'unversioned'` archive fallback (architectural bug
fix per Epic #11187 Phase 6 mental model: closed-post-latest-release items stay in
active, not pre-staged into not-yet-existing version archives).

The pre-existing IssueSyncer.spec.mjs #11288 anomaly-hook test asserted that:
  1. A bucket-shift to `'unversioned'` fires an `[ARCHIVE ANOMALY]` warning
  2. The final path contains `'unversioned'`

Both assertions are now invalid by design — `'unversioned'` is no longer a valid
bucket. The #11288 anomaly-hook contract (warn on closedAt-shift across buckets)
is preserved for shifts between real release buckets (v11 → v12); only the
"shift to 'unversioned'" variant is removed.

Updated test asserts the new correct behavior: closed-post-latest-release items
land in active (`/issues/`, not `/archive/`, not `'unversioned'`).

The architectural-anomaly variant "previously-archived item now has no plan"
(i.e., archive → active shift suggesting metadata-vs-architecture drift) is a
worth-warning new failure mode but deliberately out-of-scope for #11360 — file
follow-up sub-ticket post-merge if substrate-rigor reasoning supports it.

Refs #11288 #11360 #11187

* fix(github-workflow): address @neo-gpt PR #11362 Cycle 1 executable-surface blockers (#11360)

Four narrow fixes for blockers @neo-gpt surfaced in
#11362 (comment) (correction at
#11362 (review)):

1. IssueSyncer.spec.mjs:189 — assert active-tier placement via configured
   `issuesDir` rather than the literal substring `/issues/`. The earlier
   assertion silently broke because the spec rewires `issuesDir` to a tmp dir
   (e.g., `tmp/issue-syncer-test-XXX-YYY/`), which contains no `/issues/`
   substring even when behavior is correct.

2. package.json — drop the stale `ai:migrate-pr-archive-ac8` script entry that
   pointed at the one-shot migration script deleted in commit `7163ea128`.

3. resources/content/pulls/pr-111xx/pr-11127.md — strip trailing whitespace on
   3 blockquote-separator lines (markdown blockquote-paragraph format that
   `git diff --check` flags) and the trailing blank line at EOF.

4. ai/scripts/migrate-substrate-11360.mjs — pipe-safe stdout emit so the
   ~737 KiB dry-run manifest reaches downstream parsers reliably. Replaces
   `console.log(...); process.exit(0)` with
   `process.stdout.write(..., () => process.exit(0))` so the kernel buffer
   drains before exit (default 64 KiB pipe buffer truncated trailing ops
   under `... | head` / `... | jq`).

Locally: `IssueSyncer.spec.mjs` 4/4 pass; `PullRequestSyncer.spec.mjs` 1/1 pass;
`node ai/scripts/migrate-substrate-11360.mjs --dry-run | wc -c` = 737347;
`node ... --dry-run | python3 -c 'import json,sys; json.load(sys.stdin)'`
parses cleanly with `operations.length === 3399` matching the PR body.

Broader Epic #11187 substrate rot (config `defaultArchiveVersion: 'unversioned'`,
`archiveDir: 'resources/content/issue-archive'` post-migration dead ref,
MetadataManager `archiveVersion` propagation, PullRequestSyncer pre-stage
branch) is delegated outside this PR per operator directive — see A2A
`MESSAGE:220c166d-cc96-408d-916f-c26e28d49b09`.

Co-Authored-By: @neo-gpt

---------

Co-authored-by: tobiu <[email protected]>
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.

feature(github-workflow): Implement write-path chunking for IssueSyncer

3 participants