Skip to content

feat: SFTP endpoint for game server files (spec 040) - #1

Merged
ValgulNecron merged 10 commits into
mainfrom
feat/initial-server
Nov 23, 2026
Merged

ValgulNecron merged 10 commits into
mainfrom
feat/initial-server

Conversation

@ValgulNecron

Copy link
Copy Markdown
Contributor

Summary

The SFTP component of Gameplane spec 040 (specs/040-sftp-access/ in GameplanePanel/Gameplane, issue GameplanePanel/Gameplane#1051). Per the settled delivery layout, this is the one sftp repo PR; it merges before the Gameplane PR (feat/040-sftp-access), which then points the sftp submodule at the merged commit.

Draft while the server is built. So far:

  • T003 scaffold: Go module, version subcommand, Dockerfile, CI caller of Gameplane's shared go-component.yaml, Dependabot, coverage gate, CLAUDE.md/AGENTS.md, README.md, specs.md.

Still to come in this PR: the SSH/SFTP server that authenticates and runs every file operation through the Gameplane API as the signed-in user (T020, T021 and the story tasks).

Verification

Local compile check only (GOWORK=off go build ./...); CI verifies the rest.


Generated by Claude Code

Go module, version-only entrypoint with tests, Dockerfile, shared CI
caller, Dependabot, coverage gate, and the guide/spec files modelled on
GameplanePanel/mcp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fa88ae36-34b5-463f-b449-7b6ccecd8bd6
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

The scaffold's main() held the error branch, which tests cannot reach, so
the 70% total gate failed at 62.5%. exitCode() now holds that logic and is
tested; main() only calls os.Exit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
…PI (spec 040)

- internal/apiclient: login, session check, server list and the file
  routes (list, stat, ranged download, streaming upload, rename, mkdir,
  delete) with API errors mapped to sentinels.
- internal/sshserver: password and public-key login through
  /sftp/v1/login, SFTP subsystem only (no shell, exec, PTY or
  forwarding), idle timeout, per-user session cap, 30 s session check
  that closes revoked sessions, Prometheus metrics.
- internal/vfs: one folder per server (/<server>, /_namespaces/<ns>/...)
  or one server for <user>+<server> logins, dotfiles hidden, server
  folders read-only, ranged reads, streamed uploads with resume and
  reordering of pipelined writes, rename, mkdir, remove, per-user
  transfer cap.
- serve command with flags/env; specs.md and README updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
ReadAt returns a nil error when the buffer is filled, even if the stream
ended at the same byte. Thread the Serve context through handle and
establish, use context-aware dial/listen, errors.Is for EOF checks, and
rename the service token file env constant to avoid gosec G101.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
Skipping 5 bytes of "hello world" leaves " world"; the case was
written in this PR with the leading space missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
The previous lint cleanup dropped the embedded Conn selector from Write,
turning it into infinite recursion (staticcheck SA5007).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
…ssions

Cap concurrent pre-authentication connections (--max-preauth-connections,
default 64) and count refusals in gameplane_sftp_preauth_rejected_total.
Reject a second concurrent session channel with ResourceShortage. End the
API session through POST /sftp/v1/sessions/end when a login is refused by the
session cap or a password login's handshake does not finish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
The handshake deadline was pushed out on every read, so a client dripping
bytes could hold a pre-auth slot indefinitely. It now ends LoginTimeout after
accept. The idle timeout after authentication is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
Accept a further session channel again, as before, but close it right after
refusing its requests so it never sits idle until the idle timeout. This
replaces the ResourceShortage rejection that broke
TestSecondSFTPSubsystemIsRefused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Claude <noreply@anthropic.com>
@ValgulNecron
ValgulNecron marked this pull request as ready for review November 23, 2026 15:13
@ValgulNecron
ValgulNecron merged commit d3045fd into main Nov 23, 2026
6 checks passed
@ValgulNecron
ValgulNecron deleted the feat/initial-server branch November 24, 2026 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants