Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/repo-doc-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ function counts(projectRoot) {
function expectedSurface(projectRoot) {
const version = packageVersion(projectRoot);
const surfaceCounts = counts(projectRoot);
const published = read(projectRoot, 'USERS.md')
.includes(`latest published release is v${version}`);
return {
version,
published,
counts: surfaceCounts,
surface: `${surfaceCounts.skills} skills, ${surfaceCounts.agents} agents`,
commandSurface: `${surfaceCounts.skills} slash commands`,
Expand Down Expand Up @@ -88,6 +91,11 @@ function checkDefinitions(projectRoot) {
{ safeFix: true, reason: 'user support source version mirrors package version' }),
makeCheck('architecture-version', 'ARCHITECTURE.md', `STABLE v${expected.version}`,
{ safeFix: true, reason: 'architecture release marker mirrors package version' }),
...(expected.published
? [makeCheck('architecture-publication-status', 'ARCHITECTURE.md',
`STABLE v${expected.version} published release`,
{ safeFix: true, reason: 'published versions must not retain release-candidate status' })]
: []),
makeCheck('architecture-surface', 'ARCHITECTURE.md',
`Core: ${expected.surface}, ${expected.workflowSurface}`,
{ safeFix: true, reason: 'architecture surface mirrors repository counts' }),
Expand Down Expand Up @@ -187,7 +195,13 @@ function safeFixContent(relPath, text, expected) {
`The current source version is v${expected.version}`);
case 'ARCHITECTURE.md':
return replaceOnce(
replaceOnce(text, /STABLE v[0-9]+\.[0-9]+\.[0-9]+/g, `STABLE v${expected.version}`),
replaceOnce(
text,
/STABLE v[0-9]+\.[0-9]+\.[0-9]+(?: (?:release candidate|published release))?/g,
expected.published
? `STABLE v${expected.version} published release`
: `STABLE v${expected.version}`
Comment on lines +200 to +203

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 Preserve release-candidate status for unpublished versions

When the current source version is not yet the latest published release, for example USERS.md says the latest published release is the previous version, expected.published is false but any safe architecture fix still matches and consumes release candidate here, then rewrites it to bare STABLE v.... That means a routine surface-count or version sync during release-candidate prep silently removes the candidate status that this guard is meant to distinguish; the previous regex only updated the version portion and preserved the suffix.

Useful? React with 👍 / 👎.

),
/Core: [0-9]+ skills, [0-9]+ agents, [0-9]+ workflows/g,
`Core: ${expected.surface}, ${expected.workflowSurface}`
);
Expand Down
16 changes: 16 additions & 0 deletions scripts/test-repo-doc-sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,22 @@ test('run applies only safe mechanical updates and leaves narrative docs stale',
assert(result.after.prose.some((check) => check.path === 'RELEASE.md'));
});

test('published versions cannot retain release-candidate architecture status', () => {
const tmp = mkFixture();
writeRel(tmp, 'USERS.md',
'The current source version is v9.8.7, and the latest published release is v9.8.7.\n');
writeRel(tmp, 'ARCHITECTURE.md',
'STABLE v9.8.7 release candidate\nCore: 4 skills, 2 agents, 1 workflows\n');

const before = repoDocSync.detect(tmp);
assert(before.stale.some((check) => check.id === 'architecture-publication-status'));

repoDocSync.run(tmp, { log: false });
const architecture = readRel(tmp, 'ARCHITECTURE.md');
assert(architecture.includes('STABLE v9.8.7 published release'));
assert(!architecture.includes('release candidate'));
});

test('run writes a Godpowers repo-doc sync log', () => {
const tmp = mkFixture();
repoDocSync.run(tmp);
Expand Down