Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Number issues and change requests for human references

e05f1c48d4ee55635cd7b77889f0545137198106 · Keenan Nemetz · 13d ago · parent 41d1fee9

Number issues and change requests for human references

A ULID is an unreadable handle, and the 8-character prefix the list showed
is mostly timestamp: this repository's 27 issues shared seven distinct
six-character prefixes and two pairs already collided at eight. The part
people actually type carried almost no information.

Issues and change requests now share one gap-free sequence (#1, #42, ...)
derived from the creation order in the metadata branch's history, the way
one forge counts both in a single run.

The number is not stored. It is the rank of the entity's creation commit,
so nothing is written when an entity is created, a repository needs no
backfill, the same history gives the same numbers on every clone, and
`vole admin index rebuild` reproduces them from git. A ULID stays the
identity: paths, front matter, `closes:` and audit entries are unchanged,
and data/index.db only caches the mapping so a page render does not walk
history.

Every id-taking command accepts a number, `#42` links in a body through a
kind-agnostic /r/<repo>/n/42 route, and --closes resolves an alias to the
ULID before writing.

Closes #45

server/web/markdown_test.go +46

@@ -98,3 +98,49 @@ func TestDocHrefResolvesAgainstTheDocument(t *testing.T) {
98 98 })
99 99 }
100 100 }
101
102 // A body may name an entity by its durable ULID or by its `#42` alias. Both link,
103 // and the alias goes to the kind-agnostic route because only the server can say
104 // whether a number names an issue or a change request.
105 func TestCrossReferencesLinkBothForms(t *testing.T) {
106 t.Parallel()
107 const id = "01M5JR2JK29KKMAA1T9MDNTPBP"
108 cases := []struct {
109 name string
110 in string
111 want string
112 }{
113 {
114 name: "ulid",
115 in: "fixed in #" + id + "\n",
116 want: "fixed in [#" + id + "](/r/demo/issues/" + id + ")\n",
117 },
118 {
119 name: "number",
120 in: "see #42 for the reason\n",
121 want: "see [#42](/r/demo/n/42) for the reason\n",
122 },
123 {
124 name: "number at end of line",
125 in: "closes #7",
126 want: "closes [#7](/r/demo/n/7)",
127 },
128 {
129 name: "inside a fence is literal",
130 in: "```\n#42\n```\n",
131 want: "```\n#42\n```\n",
132 },
133 {
134 name: "a heading is not a reference",
135 in: "# 42 things\n",
136 want: "# 42 things\n",
137 },
138 }
139 for _, tc := range cases {
140 t.Run(tc.name, func(t *testing.T) {
141 if got := linkCrossReferences("demo", tc.in); got != tc.want {
142 t.Fatalf("linkCrossReferences(%q) = %q, want %q", tc.in, got, tc.want)
143 }
144 })
145 }
146 }