Re-vendor the canonical files from sneak/prompts at dd4027b (closes #112)
check / check (push) Failing after 4s

The shared files are fetched from sneak/prompts dd4027b, with this
repository's own entries after the shared content in .gitignore,
.editorconfig and .dockerignore.

Lint and tests are Dockerfile phases (golangci-lint v2.14.0, Debian Go
1.24.13) that the build stage depends on, and the Makefile targets call
the script/ entrypoints. make fmt also formats Markdown with prettier.

Fixes for the new lint findings: the auth cookie is always Secure, an
IRC connection's relay goroutine stops when the connection closes, and
repeated strings are constants. neoirc-cli treats a plain-HTTP server on
localhost or a loopback address as secure, so local use keeps its session.

Whether the 60-second test cap covers building the test phase is open
on sneak/prompts issue 113.

Model: opus-5-5
This commit was merged in pull request #115.
This commit is contained in:
2026-10-06 21:01:46 +02:00
parent 9a46421902
commit bb7bcb31ea
47 changed files with 2975 additions and 1427 deletions
+29 -28
View File
@@ -19,6 +19,12 @@ import (
"sneak.berlin/go/neoirc/pkg/irc"
)
// Error texts that several commands reply with.
const (
msgNoSuchChannel = "No such channel"
msgNotChannelOp = "You're not channel operator"
)
// Params defines the dependencies for creating a Service.
type Params struct {
fx.In
@@ -142,7 +148,7 @@ func (s *Service) SendChannelMessage(
return 0, "", &IRCError{
irc.ErrNoSuchChannel,
[]string{channel},
"No such channel",
msgNoSuchChannel,
}
}
@@ -256,10 +262,11 @@ func (s *Service) JoinChannel(
isCreator := countErr == nil && memberCount == 0
if !isCreator {
if joinErr := checkJoinRestrictions(
joinErr := checkJoinRestrictions(
ctx, s.db, chID, sessionID,
channel, suppliedKey, memberCount,
); joinErr != nil {
)
if joinErr != nil {
return nil, joinErr
}
}
@@ -306,7 +313,7 @@ func (s *Service) PartChannel(
return &IRCError{
irc.ErrNoSuchChannel,
[]string{channel},
"No such channel",
msgNoSuchChannel,
}
}
@@ -348,7 +355,7 @@ func (s *Service) SetTopic(
return &IRCError{
irc.ErrNoSuchChannel,
[]string{channel},
"No such channel",
msgNoSuchChannel,
}
}
@@ -372,14 +379,13 @@ func (s *Service) SetTopic(
return &IRCError{
irc.ErrChanOpPrivsNeeded,
[]string{channel},
"You're not channel operator",
msgNotChannelOp,
}
}
}
if setErr := s.db.SetTopic(
ctx, channel, topic,
); setErr != nil {
setErr := s.db.SetTopic(ctx, channel, topic)
if setErr != nil {
return fmt.Errorf("set topic: %w", setErr)
}
@@ -409,7 +415,7 @@ func (s *Service) KickUser(
return &IRCError{
irc.ErrNoSuchChannel,
[]string{channel},
"No such channel",
msgNoSuchChannel,
}
}
@@ -420,7 +426,7 @@ func (s *Service) KickUser(
return &IRCError{
irc.ErrChanOpPrivsNeeded,
[]string{channel},
"You're not channel operator",
msgNotChannelOp,
}
}
@@ -609,7 +615,7 @@ func (s *Service) ValidateChannelOp(
return 0, &IRCError{
irc.ErrNoSuchChannel,
[]string{channel},
"No such channel",
msgNoSuchChannel,
}
}
@@ -620,7 +626,7 @@ func (s *Service) ValidateChannelOp(
return 0, &IRCError{
irc.ErrChanOpPrivsNeeded,
[]string{channel},
"You're not channel operator",
msgNotChannelOp,
}
}
@@ -682,33 +688,28 @@ func (s *Service) SetChannelFlag(
) error {
switch flag {
case 'm':
if err := s.db.SetChannelModerated(
ctx, chID, setting,
); err != nil {
err := s.db.SetChannelModerated(ctx, chID, setting)
if err != nil {
return fmt.Errorf("set moderated: %w", err)
}
case 't':
if err := s.db.SetChannelTopicLocked(
ctx, chID, setting,
); err != nil {
err := s.db.SetChannelTopicLocked(ctx, chID, setting)
if err != nil {
return fmt.Errorf("set topic locked: %w", err)
}
case 'i':
if err := s.db.SetChannelInviteOnly(
ctx, chID, setting,
); err != nil {
err := s.db.SetChannelInviteOnly(ctx, chID, setting)
if err != nil {
return fmt.Errorf("set invite only: %w", err)
}
case 's':
if err := s.db.SetChannelSecret(
ctx, chID, setting,
); err != nil {
err := s.db.SetChannelSecret(ctx, chID, setting)
if err != nil {
return fmt.Errorf("set secret: %w", err)
}
case 'n':
if err := s.db.SetChannelNoExternal(
ctx, chID, setting,
); err != nil {
err := s.db.SetChannelNoExternal(ctx, chID, setting)
if err != nil {
return fmt.Errorf(
"set no external: %w", err,
)