Skip to content

Conflict-proof the generated patches, CHANGELOG and core docs (Phase 1, PR A) - #103

Merged
Birfy merged 3 commits into
mainfrom
feat/conflict-proofing-phase1
Oct 15, 2026
Merged

Birfy merged 3 commits into
mainfrom
feat/conflict-proofing-phase1

Conversation

@Birfy

@Birfy Birfy commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Phase 1, PR A of 3 (conflict-proofing, from the measured hotspots in the speed-up plan). No behavior change to FlyBot itself; three commits, one per hotspot.

What changed

  1. Patches no longer conflict on generated headers. generate writes edits to upstream files without index <hash> lines and with each hunk's new-side start set to its old-side start (git's position hint; the old side is fixed by the pristine upstream, the true new side moves with every hunk above). Files upstream does not have go whole into patches/ds-bot/files/ instead of one @@ -0,0 +1,N @@ hunk whose N changes with every edit; they need no topics.json entry. generate applies each file's diff alone and compares it with core/ before writing; check also compares the executable bit. 29 files moved; 4 patches that only added files are gone.
  2. CHANGELOG: one fragment per change. changelog.d/<name>.<kind>.md; .github/scripts/changelog.mjs check|preview|release <version> (no network, no shell). CI package job runs check. Existing [Unreleased] entries stay and are folded in at release. changelog.d/** is T1 in risk-rules.json.
  3. Docs hotspot. ds-bot-core.md split into core-host, core-client and a small pin/patch page; generated patches/ds-bot/*.patch|files|topics.json are no longer owned (so a core change does not force a doc edit for them). Invariants sit under headings so PRs append in different places.

Evidence (replays in /workspace on the box; scripts: conflict-replay.sh, docs-hotspot-replay.mjs)

  • Two branches edit the same three core files (hooks.js new file, index.js, store.js), X near the top, Y near the bottom, each regenerates patches, then merge:
    • before (main): CONFLICT in patches/ds-bot/0002-flybot-api-host.patch, 4 regions: three index <hash> lines, the new-file @@ -0,0 +1,802 @@ vs +1,803, and a shifted hunk header +539,7 vs +540,6.
    • after: merge CLEAN; ds-bot-patches.mjs check passes on the merged tree without regenerating; both edits present.
  • Last 30 merges on main, pages each would have been forced to edit: ds-bot-core.md 16 → 3; new core-host 10, core-client 7.

Verification at the tip

Tip SHA: 3896928 (CI green: test, plugins x2, package, tests-ok)
Ran: npm run verify (Node 24), actionlint, check-pack.mjs, new tests (ds-bot-patches.test.mjs, changelog.test.mjs)
Not run (and why): smoke test (no host code changed); typecheck step (types untouched)

Not done / follow-ups

  • core/client.js and 0008-client-bundle.patch still conflict whenever two PRs change the client (generated bundle; build it instead of patching it). Out of scope.
  • Still conflicts, on purpose: two edits within ~6 lines of each other, or the same lines.
  • Hunk-start hint: if a repeated context ever made it misapply, generate falls back to exact numbers for that file (never hit on current patches).
  • After this merges, open PRs need one rebase: take main's patches/ds-bot, run generate (AGENTS.md recipe).

Birfy added 3 commits October 15, 2026 23:51
…aders, new files stored whole

Two branches that edit the same core file used to conflict in patches/ds-bot
on the 'index <hash>' lines, the '@@ -0,0 +1,N @@' line count of a new file and
the new-side start of every later hunk. generate now writes edits to upstream
files without index lines and with each hunk's new-side start set to its
old-side start (a position hint; generate proves every file still reproduces
core/), and stores files that upstream does not have verbatim in
patches/ds-bot/files/. check also compares the executable bit. New files need
no topics.json entry any more.

Docs-not-needed: the docs follow in the docs-split commit of this PR
… at release

Every PR appended at the top of the same [Unreleased] section. A change now adds
changelog.d/<name>.<kind>.md; '.github/scripts/changelog.mjs release <version>'
folds the fragments (and any entries still under [Unreleased]) into a release
section. CI checks the fragments; changelog.d/** is T1 in the risk rules.

Docs-not-needed: the docs follow in the docs-split commit of this PR
…tch page

arch-docs forced every PR that touched core/ to edit docs/subsystems/ds-bot-core.md
(16 of the last 30 merges). The server and browser code now have their own pages,
the generated patches are no longer owned, and invariants sit under headings so
parallel PRs append in different places.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T15:56:35.954055Z 3896928 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3896928e6b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 144 to 145
const changed = [...new Set([...upstream, ...core])].sort().filter(f => !upstream.has(f) || !core.has(f) ||
!readFileSync(join(ROOT, UPSTREAM, f)).equals(readFileSync(join(ROOT, CORE, f))))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include executable-bit-only changes when generating patches

When an existing upstream file changes only its executable bit, this content-only changed filter omits it entirely. For example, making core/src/client/about.js executable and running generate produces no patch change, after which check fails with executable bit differs from ds-bot/ + patches; therefore the prescribed generate/check workflow cannot represent a valid mode-only core change. Include mode differences in changed so the generated diff records them.

AGENTS.md reference: AGENTS.md:L68-L68

Useful? React with 👍 / 👎.

Comment on lines +92 to +93
const section = `## [${version}] - ${date}\n\n${lead ? `${lead}\n\n` : ''}${renderKinds(kinds)}\n\n`
return `${changelog.slice(0, afterHeading)}\n${section}${changelog.slice(end)}`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Update changelog comparison references during release

On every release, this inserts the new version section but leaves the reference definitions at the bottom of CHANGELOG.md unchanged. Releasing 0.1.1 from the committed changelog therefore leaves [Unreleased] comparing v0.1.0...HEAD and creates no [0.1.1] reference, so the Unreleased link continues to include already released changes and the new version heading is not linked. The release operation should add the version comparison reference and advance the Unreleased base tag.

Useful? React with 👍 / 👎.

@Birfy
Birfy merged commit 9c8b446 into main Oct 15, 2026
6 checks passed
@Birfy
Birfy deleted the feat/conflict-proofing-phase1 branch October 15, 2026 16:05
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.

1 participant