Design 47 H1 (7): a registry's published recomputes no module

The indexer kept a registry's published in its series and then recomputed every module, moving fingerprints with no kept catalog revision beside the re-pin a release's package-published starts. It keeps the version in its series and recomputes nothing: a fingerprint moves only with a kept revision, one per module release, kept by the re-pin. The seat mesh-wants' pipeline-wanted subject names its last token revision, the number of the runner's key (its form unchanged).

Builds: design 47 H H-A-211, H-A-213 (2), H-A-213 (4) (the subject's token), H-pins-spec-and-gaps leftover L3
This commit is contained in:
2026-11-20 23:48:08 +01:00
parent 07dc14bf53
commit 04f54d7773
6 changed files with 22 additions and 38 deletions
@@ -83,9 +83,9 @@ const SubjectWantedAll = "mesh.seat.mesh-wants.event.wanted.*.*"
// StreamPipelineWanted is the stream pipeline-wanted is kept in.
const StreamPipelineWanted = "SEAT_mesh-wants_pipeline-wanted"
// SubjectPipelineWanted is where pipeline-wanted is published, on mesh.seat.mesh-wants.event.pipeline-wanted.<branch>.<source>.
func SubjectPipelineWanted(branch, source string) string {
return "mesh.seat.mesh-wants.event.pipeline-wanted." + branch + "." + source
// SubjectPipelineWanted is where pipeline-wanted is published, on mesh.seat.mesh-wants.event.pipeline-wanted.<branch>.<revision>.
func SubjectPipelineWanted(branch, revision string) string {
return "mesh.seat.mesh-wants.event.pipeline-wanted." + branch + "." + revision
}
// SubjectPipelineWantedAll hears every pipeline-wanted.
@@ -434,7 +434,7 @@
},
{
"name": "pipeline-wanted",
"subject": "pipeline-wanted.<branch>.<source>",
"subject": "pipeline-wanted.<branch>.<revision>",
"keep": {
"max-age-days": 30,
"max-mib": 64
@@ -50,7 +50,7 @@ export declare const wantedSubjectAll: "mesh.seat.mesh-wants.event.wanted.*.*";
export declare const pipelineWantedStream: "SEAT_mesh-wants_pipeline-wanted";
export declare function pipelineWantedSubject(branch: string, source: string): string;
export declare function pipelineWantedSubject(branch: string, revision: string): string;
export declare const pipelineWantedSubjectAll: "mesh.seat.mesh-wants.event.pipeline-wanted.*.*";
@@ -52,8 +52,8 @@ export const wantedSubjectAll = "mesh.seat.mesh-wants.event.wanted.*.*";
export const pipelineWantedStream = "SEAT_mesh-wants_pipeline-wanted";
export function pipelineWantedSubject(branch, source) {
return "mesh.seat.mesh-wants.event.pipeline-wanted." + branch + "." + source;
export function pipelineWantedSubject(branch, revision) {
return "mesh.seat.mesh-wants.event.pipeline-wanted." + branch + "." + revision;
}
export const pipelineWantedSubjectAll = "mesh.seat.mesh-wants.event.pipeline-wanted.*.*";
@@ -22,8 +22,9 @@ var (
)
// heardVersion reads one message of the consumer as a version, false for any other subject. A package's is kept in its
// series; one that does not decode is said and acknowledged; a write that fails, or the recompute of its users that a
// publish starts, is left unacknowledged, so the bus gives it again.
// series; one that does not decode is said and acknowledged; a write that fails is left unacknowledged, so the bus gives it
// again. It recomputes no module: a fingerprint moves only with a kept catalog revision, a release's by the re-pin its
// package-published starts, one revision per module release (design 47 H-A-211, H-A-213 (2)).
func heardVersion(ctx context.Context, ix *index.Indexer, m jetstream.Msg, logf func(string, ...any)) bool {
var h index.HeardVersion
switch seat, ok := publishedSeats[m.Subject()]; {
@@ -51,14 +52,6 @@ func heardVersion(ctx context.Context, ix *index.Indexer, m jetstream.Msg, logf
if kept {
logf("packages: %s %s kept in its series (published %v)", h.Package, h.Version, h.Published)
}
if kept && h.Published {
// A series' newest moved: its users' fingerprints take it (DLV-I6), in the same turn as the publish is heard.
// A recompute that fails is not acknowledged, so the publish is offered again (design 47 H S15, H-A-167).
if err := ix.Recompute(ctx); err != nil {
logf("writing the modules again after %s %s was published failed, so the bus gives it again: %v", h.Package, h.Version, err)
return true
}
}
_ = m.Ack()
return true
}
@@ -32,30 +32,21 @@ func (unlistedStore) Keys(context.Context) ([]string, error) {
return nil, errors.New("the bus does not answer")
}
// TestHeardVersionRecomputeFailed: a publish whose recompute of its users fails is not acknowledged, so the bus gives
// it again (design 47 H S15, the pin specification's item 3); one whose recompute passes is.
func TestHeardVersionRecomputeFailed(t *testing.T) {
// TestHeardVersionMovesNoFingerprint: a registry's published is kept in its series and acknowledged, and recomputes no
// module: a fingerprint moves only with a kept revision, a release's by its re-pin on the package-published (design 47
// H-A-211, H-A-213 (2); the pin specification's leftover L3). The modules state here fails any recompute.
func TestHeardVersionMovesNoFingerprint(t *testing.T) {
data, err := json.Marshal(gopackageregistry.PublishedEvent{Kind: "package", Name: "git.example/novox/lib", Version: "0.1.4"})
if err != nil {
t.Fatal(err)
}
for _, c := range []struct {
name string
modules index.Store
acked int
}{
{"recompute fails", &unlistedStore{memStore{vals: map[string][]byte{}}}, 0},
{"recompute passes", &memStore{vals: map[string][]byte{}}, 1},
} {
t.Run(c.name, func(t *testing.T) {
ix := &index.Indexer{Packages: &memStore{vals: map[string][]byte{}}, Modules: c.modules, Manifests: &memStore{vals: map[string][]byte{}}}
m := &ackedMsg{subject: gopackageregistry.SubjectPublished, data: data}
if !heardVersion(context.Background(), ix, m, t.Logf) {
t.Fatal("the registry's published is not taken as a version")
}
if m.acked != c.acked {
t.Errorf("acknowledged %d times, want %d", m.acked, c.acked)
}
})
ix := &index.Indexer{Packages: &memStore{vals: map[string][]byte{}}, Modules: &unlistedStore{memStore{vals: map[string][]byte{}}},
Manifests: &memStore{vals: map[string][]byte{}}}
m := &ackedMsg{subject: gopackageregistry.SubjectPublished, data: data}
if !heardVersion(context.Background(), ix, m, t.Logf) {
t.Fatal("the registry's published is not taken as a version")
}
if m.acked != 1 {
t.Errorf("acknowledged %d times, want once: a publish recomputes nothing that could fail", m.acked)
}
}