Files
ai/testsupport_test.go
zeekay 53c94fa2cd feat(web): native session provider + native serving, drop beego from ai
Completes the beego removal: hanzoai/beego v1.12.13 leaves go.mod and ai
imports zero first-party beego.

- Cut 5 (session): web.MemorySessions — a cookie-keyed in-memory session store
  implementing web.Store, bound to the router via UseSessions. bootstrap builds
  and binds it; object.DeleteSessions (was DeleteBeegoSession) destroys through
  it. Drops beegoSessions/initSessionManager/beego.GlobalSessions and the
  BConfig session settings.
- 4c (lifecycle): cmd/aid serves routers.App on a native http.Server (was
  beego.Run/beego.BeeApp.Handlers); httpport and config read via conf.AppConfig;
  the beego/session/redis provider import is dropped.
- Tests: the route harnesses (crawl/images/videos/mount_repro/web_wire) and the
  authz round-trip use the native session store; the web primitive tests drop
  the beego-context differential (behavior is pinned by explicit assertions).

go build ./... green; go test ./web ./routers ./controllers green; the sqlite
wire tests (cloud rewrite, selective iam alias, gated auth-reject, mount
forward, body echo) pass. The residual hanzoai/beego/v2 // indirect is pulled
transitively through hanzoai/cloud, not ai.
2026-07-18 00:26:24 -07:00

32 lines
1.0 KiB
Go

// Copyright 2023-2025 Hanzo AI Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ai
import (
"time"
"github.com/hanzoai/ai/routers"
"github.com/hanzoai/ai/web"
)
// wireTestSessions binds an in-memory session store to the router, matching the
// runtime's session wiring so the route tests exercise the real session path.
func wireTestSessions() {
if web.Sessions == nil {
web.Sessions = web.NewMemorySessions("cloud_session_id", time.Hour)
}
routers.App.UseSessions(web.Sessions)
}