refactor: retarget check 31 bn-chrome sync from core to pluginsdk

The bn chrome (head/toolbar/engagement/asset_hooks) synced copy moved from
core/templates/bn to pluginsdk/templates/bn as part of P1 of the proto-first
plugin SDK program. Point the drift gate at ../pluginsdk and update all
message/title text (cms<->pluginsdk). cms is still the authoring source.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Alex Dunmow 2026-07-07 10:51:27 +08:00
parent cc19b7eabb
commit de43bca80f

View File

@ -7,9 +7,9 @@ import (
)
// The bn chrome files authored in cms/backend/templates/bn and mechanically
// synced (make sync-templates) into the sibling core repo's templates/bn.
// Guest-side plugin templates compile core's copy into their wasm, so the two
// checkouts must stay byte-identical. validation.go is intentionally NOT in
// synced (make sync-templates) into the sibling pluginsdk repo's templates/bn.
// Guest-side plugin templates compile pluginsdk's copy into their wasm, so the
// two checkouts must stay byte-identical. validation.go is intentionally NOT in
// this set (cms's is a two-context-key bridge over the SDK tracker); neither
// is img.templ (cms-only, not referenced by the chrome).
// See cms docs/superpowers/specs/2026-07-07-bn-chrome-single-source-design.md.
@ -24,16 +24,16 @@ func init() {
register(Check{
Seq: 310,
ID: "31",
Title: "bn chrome templates in sync between cms and core",
Title: "bn chrome templates in sync between cms and pluginsdk",
Run: func(ctx *ScanContext, rep *Reporter) {
cmsDir := filepath.Join(ctx.repoRoot, "backend", "templates", "bn")
if _, err := os.Stat(cmsDir); err != nil {
rep.Skip("no backend/templates/bn in this repo — template-sync gate not applicable")
return
}
coreDir := filepath.Join(ctx.repoRoot, "..", "core", "templates", "bn")
if _, err := os.Stat(coreDir); err != nil {
rep.Skip("sibling core checkout not found — cannot verify template sync")
sdkDir := filepath.Join(ctx.repoRoot, "..", "pluginsdk", "templates", "bn")
if _, err := os.Stat(sdkDir); err != nil {
rep.Skip("sibling pluginsdk checkout not found — cannot verify template sync")
return
}
@ -44,23 +44,23 @@ func init() {
drifted = append(drifted, name+" (unreadable in cms: "+err.Error()+")")
continue
}
coreBytes, err := os.ReadFile(filepath.Join(coreDir, name))
sdkBytes, err := os.ReadFile(filepath.Join(sdkDir, name))
if err != nil {
drifted = append(drifted, name+" (missing in core)")
drifted = append(drifted, name+" (missing in pluginsdk)")
continue
}
if !bytes.Equal(cmsBytes, coreBytes) {
if !bytes.Equal(cmsBytes, sdkBytes) {
drifted = append(drifted, name)
}
}
if len(drifted) > 0 {
rep.Fail("%d bn chrome file(s) drifted between cms and core", len(drifted))
rep.Fail("%d bn chrome file(s) drifted between cms and pluginsdk", len(drifted))
for _, name := range drifted {
rep.Findingf("templates/bn/%s differs — cms is the authoring source; run `make sync-templates` in cms, then commit + tag + push core", name)
rep.Findingf("templates/bn/%s differs — cms is the authoring source; run `make sync-templates` in cms, then commit + tag + push pluginsdk", name)
}
} else {
rep.OK("bn chrome sync set byte-identical across cms and core (%d files)", len(templateSyncSet))
rep.OK("bn chrome sync set byte-identical across cms and pluginsdk (%d files)", len(templateSyncSet))
}
},
})