<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go-x-pkgsite/internal/api/api.go, branch main</title>
<subtitle>Fork of golang.org/x/pkgsite with my patches.</subtitle>
<id>http://git.kilabit.info/go-x-pkgsite/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/go-x-pkgsite/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/'/>
<updated>2026-04-13T18:42:30Z</updated>
<entry>
<title>internal/api: improve ambiguous package path resolution</title>
<updated>2026-04-13T18:42:30Z</updated>
<author>
<name>Hana Kim</name>
<email>hyangah@gmail.com</email>
</author>
<published>2026-04-13T02:10:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=aca48c6d9dcc4892027cdad3243527882201358b'/>
<id>urn:sha1:aca48c6d9dcc4892027cdad3243527882201358b</id>
<content type='text'>
Instead of falling back to UnknownModulePath, we now:

1. Query all candidate module paths.
2. Filter out candidates where the database fell back to a different module path (preventing false positives like google.golang.org).
3. Filter out deprecated or retracted candidates if at least one good candidate exists.
4. Return 400 if ambiguity remains among good candidates.

This commit fixes the issue where /v1/package/google.golang.org/adk/agent was returning HTTP 400 because all candidate module paths matched:

```
{
 "code":400,
 "message":"ambiguous package path",
 "candidates":[
  {"modulePath":"google.golang.org/adk/agent","packagePath":"google.golang.org/adk/agent"},
  {"modulePath":"google.golang.org/adk","packagePath":"google.golang.org/adk/agent"},
  {"modulePath":"google.golang.org","packagePath":"google.golang.org/adk/agent"}]
}
```

Change-Id: I3ea24bca5144d536490019efd85fb597da214029
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/766380
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>internal/api: refactor error handling to increase consistency</title>
<updated>2026-04-09T20:23:05Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-04-09T18:48:49Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=ee3de85430431a53d070e4712a5caa9ddcc28628'/>
<id>urn:sha1:ee3de85430431a53d070e4712a5caa9ddcc28628</id>
<content type='text'>
- Refactored error handling to avoid leaking internal implementation
  details. Database and system errors are masked by falling back to
  standard HTTP statuses but still logging the entire error context.
- User facing error messages can now be specified within the Error
  struct.
- Added helpers in types.go to simplify error construction.
- Updated ServeModuleVersions to explicitly return 404 when no versions
  are found.
- Expanded test coverage in api_test.go to include 404 and 400 edge
  cases.

Change-Id: I89c4be3941126c15df6aefdd21e4bbd2d3b23be1
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764820
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Ethan Lee &lt;ethanalee@google.com&gt;
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: simplify filter code</title>
<updated>2026-04-09T18:29:52Z</updated>
<author>
<name>Jonathan Amsterdam</name>
<email>jba@google.com</email>
</author>
<published>2026-04-09T16:49:44Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=845e9f3a89f1a84a47606ae3b50cb3fb91b2d95a'/>
<id>urn:sha1:845e9f3a89f1a84a47606ae3b50cb3fb91b2d95a</id>
<content type='text'>
Change-Id: I5510faeb196af4ce1418affe6159b17187b9efa5
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764700
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Ethan Lee &lt;ethanalee@google.com&gt;
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: set cache-control headers</title>
<updated>2026-04-08T20:35:34Z</updated>
<author>
<name>Jonathan Amsterdam</name>
<email>jba@google.com</email>
</author>
<published>2026-04-07T22:52:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=b0096dc799437fdf92fc65135a7141fa8ad358be'/>
<id>urn:sha1:b0096dc799437fdf92fc65135a7141fa8ad358be</id>
<content type='text'>
Set an HTTP Cache-Control header for all API responses.

Since requests that reference a specific, numbered version apparently
always produce the same response, it is tempting to use the "immutable"
Cache-Control directive so these pages can be cached indefinitely. But
occasionally we must exclude a module. It would be unfortunate if the
module's data lived in caches forever. Instead, we cache such pages for
one day.

Pages that are subject to more rapid change, like those with versions
"latest", "master" and so on, or those that depend on data other than
a module (imported-by, search, etc.) are cached for an hour.
That is an arbitrary value that seems like a good compromise, since
the likelihood of a particular page's value changing in an hour is low.

Change-Id: I21414c22c724220c993c1dd7e7a0b49074efd8b9
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763782
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Ethan Lee &lt;ethanalee@google.com&gt;
Reviewed-by: Hyang-Ah Hana Kim &lt;hyangah@gmail.com&gt;
TryBot-Bypass: Jonathan Amsterdam &lt;jba@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: add examples parameter to PackageParams</title>
<updated>2026-04-08T18:49:01Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-04-06T21:37:38Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=0ef8af41d6814a34f239b02ab621c4cfcb8c0019'/>
<id>urn:sha1:0ef8af41d6814a34f239b02ab621c4cfcb8c0019</id>
<content type='text'>
- Enable conditional population of examples by introducing a new
  examples parameter.

Change-Id: I53314344a414c41b423185c115e600ec8b63e6bf
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763282
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Ethan Lee &lt;ethanalee@google.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: clean up redundant TODO</title>
<updated>2026-04-07T16:23:25Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-04-07T13:50:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=f1e456b85e628969cdc65e0fec050038e653d1a0'/>
<id>urn:sha1:f1e456b85e628969cdc65e0fec050038e653d1a0</id>
<content type='text'>
- The relevant logic has already been implemented.

Change-Id: I1d4f92e6d6c00666ba09a532e378fc1f0ede7856
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763400
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Ethan Lee &lt;ethanalee@google.com&gt;
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: add support for readme and licenses in ServeModule</title>
<updated>2026-04-07T16:23:15Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-04-07T14:44:16Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=3c8abd6a69a5031ca55e55d16e725476f1d69cba'/>
<id>urn:sha1:3c8abd6a69a5031ca55e55d16e725476f1d69cba</id>
<content type='text'>
- Utilize conditional fieldset in GetUnit to efficiently retrieve readme
  and license fields.
- Modify Module type to include HasGoMod.

Change-Id: Id22ac3f2485392749742332701d2e913f047b3da
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763401
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
Auto-Submit: Ethan Lee &lt;ethanalee@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: unify default pagination limits</title>
<updated>2026-04-07T15:31:17Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-04-06T21:37:29Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=d1eedfe77fdd85e4ec9dcef7e4a4411116eddbb2'/>
<id>urn:sha1:d1eedfe77fdd85e4ec9dcef7e4a4411116eddbb2</id>
<content type='text'>
Change-Id: Ie8faec1c02d74ac2559e78d8793d6050a98b38fc
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763281
Auto-Submit: Ethan Lee &lt;ethanalee@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: refactor ServePackage and extract helper functions</title>
<updated>2026-04-07T15:31:11Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-04-06T21:37:05Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=a82ef6233f8b2ebae8d4959c7c2596ec5e25dda2'/>
<id>urn:sha1:a82ef6233f8b2ebae8d4959c7c2596ec5e25dda2</id>
<content type='text'>
Change-Id: Iae93d49fdb6d3a196281d49cd2cf01a8b4e537e2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/763280
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Auto-Submit: Ethan Lee &lt;ethanalee@google.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
</content>
</entry>
<entry>
<title>internal/api: factor out common renderer things</title>
<updated>2026-04-06T14:29:56Z</updated>
<author>
<name>Jonathan Amsterdam</name>
<email>jba@google.com</email>
</author>
<published>2026-03-31T11:29:07Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=db814553826604e1f026789d4e3af0c1812f66b0'/>
<id>urn:sha1:db814553826604e1f026789d4e3af0c1812f66b0</id>
<content type='text'>
Change-Id: I5d8a579913942bcdea664af675ff2ef29888281c
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/761400
TryBot-Bypass: Jonathan Amsterdam &lt;jba@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
Reviewed-by: Hyang-Ah Hana Kim &lt;hyangah@gmail.com&gt;
Reviewed-by: Ethan Lee &lt;ethanalee@google.com&gt;
</content>
</entry>
</feed>
