<feed xmlns='http://www.w3.org/2005/Atom'>
<title>go-x-pkgsite/internal/api/api_test.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-14T16:19:25Z</updated>
<entry>
<title>internal/api: test ServePackage with db</title>
<updated>2026-04-14T16:19:25Z</updated>
<author>
<name>Jonathan Amsterdam</name>
<email>jba@google.com</email>
</author>
<published>2026-04-09T20:55:25Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=81095845401a2ac64bc5ee43a4f9b013207d3b7e'/>
<id>urn:sha1:81095845401a2ac64bc5ee43a4f9b013207d3b7e</id>
<content type='text'>
Test the ServePackage function against a real database, as well as the
fake data source.

- Modules and packages must be redistributable, or the DB strips
  the documentation.

- Documentation must contain source code.

We must temporarily skip the dependency tests, to reduce the diffs on
this change. The test is still important, because it asserts that the
pkgsite command has only a few dependencies. To re-establish it, we
will move the API tests to internal/testing/api.

Change-Id: I67243ea2345c5e735edbdd6ee5bf2349a6b1eb60
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/765502
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com &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;
</content>
</entry>
<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: test licenses and imports params</title>
<updated>2026-04-09T19:22:10Z</updated>
<author>
<name>Jonathan Amsterdam</name>
<email>jba@google.com</email>
</author>
<published>2026-04-09T12:10:31Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=654ef90febc3cd4bbc261b97fbea7a6c45e1d26d'/>
<id>urn:sha1:654ef90febc3cd4bbc261b97fbea7a6c45e1d26d</id>
<content type='text'>
Test the "licenses" and "imports" query params for the packages route.

Change-Id: I46c7dd18f0eb2e104d124d2d724039f920247e5b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/764540
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
TryBot-Bypass: Jonathan Amsterdam &lt;jba@google.com&gt;
Reviewed-by: Ethan Lee &lt;ethanalee@google.com&gt;
Auto-Submit: Jonathan Amsterdam &lt;jba@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: 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: implement filtering logic based on query params</title>
<updated>2026-04-02T15:01:06Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-03-24T20:45:28Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=2d0d60d0e456af02dfc52d79053d5a3a20fb11ff'/>
<id>urn:sha1:2d0d60d0e456af02dfc52d79053d5a3a20fb11ff</id>
<content type='text'>
Change-Id: Ica73fe1f12b2c65d08240479d1a135a51c3ae566
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758822
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
kokoro-CI: kokoro &lt;noreply+kokoro@google.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: consolidate error response handling for all handlers</title>
<updated>2026-04-02T02:31:36Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-03-24T19:38:01Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=aed8d2b9be2361625f8b305b91885f7c1a710f07'/>
<id>urn:sha1:aed8d2b9be2361625f8b305b91885f7c1a710f07</id>
<content type='text'>
- Ensure that all errors are wrapped correctly and served as a json
  error response.

Change-Id: I588552c755fb2135916da95dec6d37238d030d39
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758821
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;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
</content>
</entry>
<entry>
<title>internal/api: centralize pagination and trimming logic</title>
<updated>2026-03-31T19:06:07Z</updated>
<author>
<name>Ethan Lee</name>
<email>ethanalee@google.com</email>
</author>
<published>2026-03-24T15:29:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/go-x-pkgsite/commit/?id=50f3e086f52d8af852dacd214738f8f83a9007aa'/>
<id>urn:sha1:50f3e086f52d8af852dacd214738f8f83a9007aa</id>
<content type='text'>
- All handlers returning lists will utilize the paginate helper.
- Path trimming logic has also been modularized within a helper.

Change-Id: I5c99ae8264ea76587137e29524ad19795652e43b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/758642
Auto-Submit: Ethan Lee &lt;ethanalee@google.com&gt;
Reviewed-by: Jonathan Amsterdam &lt;jba@google.com&gt;
LUCI-TryBot-Result: Go LUCI &lt;golang-scoped@luci-project-accounts.iam.gserviceaccount.com&gt;
kokoro-CI: kokoro &lt;noreply+kokoro@google.com&gt;
</content>
</entry>
</feed>
