Summary
tools/sync-team.ts has zero test coverage. The most critical gap is writeMarkerSection, which mutates CLAUDE.md and opencode.md by finding <!-- FYSO TEAM START --> / <!-- FYSO TEAM END --> markers and replacing the content between them. Its string-index logic has untested edge cases that could silently corrupt these configuration files during team sync.
Evidence
- File:
opencode-plugin/src/tools/sync-team.ts, function writeMarkerSection (lines ~40-58).
- Bug scenario 1 — partial markers: If the file contains
<!-- FYSO TEAM START --> but not <!-- FYSO TEAM END --> (e.g., user edited the file and accidentally deleted the closing marker), the function falls through to appending a second full section instead of reporting or recovering. Repeated syncs would keep appending duplicates.
- Bug scenario 2 — multiple marker pairs: If the file has two
START/END pairs (e.g., from a prior duplication bug), indexOf finds the first START and first END, potentially slicing across unrelated content.
- Impact: These files drive agent behavior configuration. Corruption goes undetected until the user notices broken prompts.
Acceptance criteria
Suggested validation
Create opencode-plugin/src/tools/sync-team.test.ts. The partial-marker tests should fail before any fix to writeMarkerSection is applied (confirming the edge case exists) and pass after the fix. Run with npx vitest run src/tools/sync-team.test.ts.
Pipeline
- Esta issue fue solicitada por un agente de mantenimiento programado.
- Entra sin labels para publicarse en triage; segun configuracion puede requerir aceptacion manual o autoaceptarse.
Summary
tools/sync-team.tshas zero test coverage. The most critical gap iswriteMarkerSection, which mutates CLAUDE.md and opencode.md by finding<!-- FYSO TEAM START -->/<!-- FYSO TEAM END -->markers and replacing the content between them. Its string-index logic has untested edge cases that could silently corrupt these configuration files during team sync.Evidence
opencode-plugin/src/tools/sync-team.ts, functionwriteMarkerSection(lines ~40-58).<!-- FYSO TEAM START -->but not<!-- FYSO TEAM END -->(e.g., user edited the file and accidentally deleted the closing marker), the function falls through to appending a second full section instead of reporting or recovering. Repeated syncs would keep appending duplicates.START/ENDpairs (e.g., from a prior duplication bug),indexOffinds the first START and first END, potentially slicing across unrelated content.Acceptance criteria
writeMarkerSectioncovering: fresh file (no markers), existing file with valid markers (replace), file with START but no END, file with END but no START, file with multiple marker pairs.getColorandfirstLineOfutility functions.Suggested validation
Create
opencode-plugin/src/tools/sync-team.test.ts. The partial-marker tests should fail before any fix towriteMarkerSectionis applied (confirming the edge case exists) and pass after the fix. Run withnpx vitest run src/tools/sync-team.test.ts.Pipeline