Refactor architecture into eight components and consolidate reliability work
Build and publish container images / images (push) Successful in 9m34s
Release container images / release (push) Successful in 36s

Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts.

Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation.

Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
This commit is contained in:
Anya Tokugawa committed 2026-11-01 15:23:31 +09:00
1 parent 9dd425f765
commit d5d21b7841
302 files changed
+20037 -3492

No files matched your search

+27 -19
View File
@@ -2,7 +2,6 @@ package server
import (
"archive/zip"
"bytes"
"context"
"io"
"mime"
@@ -47,23 +46,20 @@ func (s *Server) handleArchiveEntry(w http.ResponseWriter, r *http.Request) {
return
}
if strings.EqualFold(filepath.Ext(revision.Filename), ".zip") {
hydrated, err := s.store.GetRevision(revision.UUID)
if err != nil {
http.NotFound(w, r)
return
}
s.serveZIPEntry(w, r, hydrated.Body, entry)
return
}
source, err := s.store.DocumentPath(revision.DocumentHash)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
s.serveZIPDocumentEntry(w, r, revision.DocumentHash, entry)
return
}
ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second)
defer cancel()
lease, err := s.store.MaterializeDocument(ctx, revision.DocumentHash, 1<<30)
if err != nil {
http.Error(w, "archive source unavailable or exceeds materialization limit", http.StatusServiceUnavailable)
return
}
defer lease.Close()
command := exec.CommandContext(ctx, "nice", "-n", "10",
"7z", "x", "-so", "-y", "-spd", "-mmt1", "-p-", "--", source, entry)
"7z", "x", "-so", "-y", "-spd", "-mmt1", "-p-", "--", lease.Path, entry)
command.WaitDelay = time.Second
stdout, err := command.StdoutPipe()
if err != nil || command.Start() != nil {
http.Error(w, "cannot extract archive entry", http.StatusUnprocessableEntity)
@@ -85,16 +81,24 @@ func (s *Server) handleArchiveEntry(w http.ResponseWriter, r *http.Request) {
}
}
func (s *Server) serveZIPEntry(
func (s *Server) serveZIPDocumentEntry(
w http.ResponseWriter,
r *http.Request,
body string,
hash string,
entry string,
) {
reader, err := zip.NewReader(
bytes.NewReader([]byte(body)),
int64(len(body)),
)
input, err := s.store.OpenDocumentContext(r.Context(), hash)
if err != nil {
http.NotFound(w, r)
return
}
defer input.Close()
size, err := input.Seek(0, io.SeekEnd)
if err != nil {
http.Error(w, "cannot determine archive size", http.StatusUnprocessableEntity)
return
}
reader, err := zip.NewReader(input, size)
if err != nil {
http.Error(w, err.Error(), http.StatusUnprocessableEntity)
return
@@ -103,6 +107,10 @@ func (s *Server) serveZIPEntry(
if file.Name != entry || file.FileInfo().IsDir() {
continue
}
if file.UncompressedSize64 > 128<<20 {
http.Error(w, "archive entry exceeds 128 MiB limit", http.StatusRequestEntityTooLarge)
return
}
source, err := file.Open()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)