generated from lucas/rust-webserver-template
Re-split the docs by role and rewrite STATUS.md as a design delta #46
Labels
No labels
Agent
Ignore
Agent
In Progress
Agent
Planned
Agent
Planning
Agent
Ready
Agent
Triage
Compat/Breaking
Kind
Bug
Kind
Documentation
Kind
Enhancement
Kind
Feature
Kind
Security
Kind
Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
Tag/Good First Issue
Tag/Help Wanted
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lucas/logview#46
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
docs/STATUS.mdis badly stale. It was last touched in686e082("build(assets):manage Bulma with bun and lint the frontend in CI"), before all the VictoriaLogs and
view work landed, and it now asserts things that are flatly false:
LogsQL construction, no log model", while
src/victorialogs/{mod,client,entry,stream}.rsexists with
VictoriaLogs::new,search,LogEntry,parse_line,parse_labels, andreqwest/url/jiff/tokio-util/thiserrorare all inCargo.toml.src/views/— the view trait and all views. Nothing resembling a view exists", whilesrc/views/{mod,all}.rsexists (LogRow,ViewState,all::{QUERY, LIMIT, load}).templates/views/,templates/partials/log_row.html" absent — both exist, as doestemplates/error.html.VICTORIALOGS_URLandVICTORIALOGS_TOKENdo not exist" — both are clap/env optionsin
src/main.rs, the URL required, the token hidden from help behind aSecretnewtype whose
Debugprints[redacted].wiremock— not a dev-dependency; nothing fakes an upstream" — it is adev-dependency, and
tests/common/upstream.rswraps it in aFakeUpstreamreplayharness fed by
tests/fixtures/*.jsonl.AppErrorrenderstemplates/error.htmlas HTML; only/api/healthand the render-failure fallback areplain text.
web.rs,assets.rs,api/core.rs, omittingtests/views.rs(12tests) and
tests/victorialogs.rs(7).index.jspluslivereload.js, omittingtz.js,view-state.jsandview-all.js.Initial commit)" —the history is conventional commits throughout and
docs/development.mddocuments theconvention.
The deeper cause is that the four documentation files do not hold to distinct roles, so
the same material is written down more than once and the copies drift. The intended
division is:
docs/DESIGN.md— the full design: the vision and the big-picture decisions that keepwork inside it. Not a catalogue of every implementation detail; detail intrinsic to an
obvious requirement (rendering timestamps in the reader's timezone, for instance) needs
no design entry.
AGENTS.md— how an agent is supposed to work in this repository.docs/STATUS.md— only what differs from the wanted design.docs/development.md— local setup, commands, layout, and the conventions a humancontributor needs.
Against that,
AGENTS.mdcurrently carries a large amount of design (its "Architecture &Data Flow" section and its six "Invariants", each of which already has a corresponding
DESIGN.mddecision), and duplicatesdocs/development.md's command and layout tables.Plan
Documentation only. No file under
src/,templates/,tests/orassets/is touched,and no behaviour changes, so the build and the test suite are unaffected at every step.
Four stale doc comments were found during planning and are deliberately left alone:
src/views/mod.rs:1("each owns a LogsQL base query, its parameters and its template" —no view owns parameters, and the templates are declared in
src/routes/web/mod.rs),src/views/mod.rs:20-21("the eventual SSE path"),src/views/all.rs:3-4("filters growhere"), and
src/views/all.rs:12-13("the detail view that will read it"). Do not editthem.
Step 1 — Move architecture and invariants into
docs/DESIGN.mddocs/DESIGN.mdis today an intro paragraph followed by 15 numbered decisions, each withrationale and rejected alternatives. Insert two new unnumbered sections between the
intro paragraph and
## 1. Purpose: a curated reader, not an explorer, in this order,leaving the existing numbering untouched:
## Architecture, carrying across fromAGENTS.md(lines 21–64) the content of"The view abstraction", "Dependency direction" (including the
routes -> views -> victorialogscode block and the "Strictly one-way" rule) and"Request flow" (both the search-view and tail-view flow blocks). Keep the existing
###subheadings as###under the new##. Move the prose as written; adjust onlywhat is needed for it to read as design rather than instruction.
## Invariants, carrying across all six invariants fromAGENTS.mdlines 65–83 as asingle numbered list, preserving their order and wording. Replace the current lead-in
("These are the rules most easily got wrong. See
docs/DESIGN.mdfor why.") with alead-in stating that these are the rules derived from the decisions below and the ones
most easily got wrong, and append to each invariant a pointer to the decision it
derives from:
limit) → §11|safe) → §7Then repair two references inside
docs/DESIGN.md:AGENTS.md; what is actually built lives inSTATUS.md."Rewrite so it states that the derived rules are the Invariants section below, and that
STATUS.mdrecords where the tree differs from this design.AGENTS.md" → point atthe Invariants section of this file instead.
Step 2 — Strip
AGENTS.mdto agent-facing materialDelete from
AGENTS.md:## Architecture & Data Flowsection (lines 21–83, including its four###subsections, up to but not including
## Key Directories), now living indocs/DESIGN.md.## Key Directoriessection (lines 84–101, including the trailing "Adding aview is a four-step operation" sentence).
docs/development.md§Layout already carriesboth the path table and that sentence.
## Development Commandssection (lines 102–159), except the three piecesdocs/development.mddoes not already carry, which move todocs/development.md§Commands in Step 3: the
cargo-watchscoping rationale, thedocker build -t logview .release-image invocation, and the description of the CI job graph.
Keep
## Project Overview,## Code Conventions & Common Patterns,## Important Files,## Runtime/Tooling Preferencesand## Testing & QA, stripping the design prose thatnow lives in
docs/DESIGN.mdand replacing it with a link:## Project Overview: keep the first sentence identifying whatlogviewis. Replacethe "It is not a general LogsQL explorer…" paragraph with one sentence plus a link
to
docs/DESIGN.md§1.## Code Conventions & Common Patterns: keep router composition, the per-method handlermodule pattern, template-struct placement, the
AppError/bail!rules, thetestability seam, the async rule, formatting, and the crate-layout quirk. In the error
policy list, replace the rationale for surfacing upstream errors verbatim with a
pointer to invariant 5 in
docs/DESIGN.md; keep the operative rules themselves (HTMLerrors on browser routes, plain text on
/api/health, and the mid-stream SSE rule thatan
event: erroris emitted because the 200 is already committed).## Important Files: keep the table as-is.## Runtime/Tooling Preferences: keep the configuration table (LOGVIEW_ADDR,VICTORIALOGS_URL,VICTORIALOGS_TOKEN,RUST_LOG) and the secret-handling rule(redacted in
Debug, set once as a defaultAuthorizationheader, never per-call,never logged), and keep the rule that templates resolve asset URLs through
crate::assets::url. Replace with links todocs/DESIGN.md: the prefix-denotes-ownership rationale (§13), the asset-pipeline rationale including why Sass is not a
build.rsand why both profiles hash (§14), the Bulma/dart-sass choice (§15), and thetwo-independent-auth-paths note (§4a).
## Testing & QA: keep as-is.Finally, update the preamble pointers at
AGENTS.mdlines 3–7 to describe the newdivision:
docs/DESIGN.mdis the full design including the architecture and theinvariants;
docs/STATUS.mdis where the tree differs from that design;docs/development.mdis setup, commands, layout and commit conventions. Keep the existing warning that the
design describes the target, not the current tree, and that
STATUS.mdmust be consultedbefore assuming a module exists.
Step 3 — Absorb the three unique command notes into
docs/development.mdAdd to
docs/development.md§Commands:just devedit/result table, thecargo-watchscoping rationale fromAGENTS.md: the watcher is scoped tosrc,templatesandCargo.tomlon purpose,because watching the whole tree would restart the server whenever Sass writes
gen/assets/, downgrading every style save into a full page reload.docker build -t logview ., noting that it is the onlypath that exercises embedded assets, which debug builds do not.
spelling its steps out:
.forgejo/workflows/pr.yamlbuildsgen/assetsonce in anassetsjob and hands it tocheck(clippy-D warnings+fmt --check) andtestas an artifact; a
lintjob runs stylelint and Biome independently; animagejobbuilds the release image and smoke-tests the running container over HTTP.
Also fix the
docs/row of the §Layout table (line 76), which currently reads"
STATUS.md(what exists)": it now records where the tree differs from the design.Leave §Planning and §Git commits in this file untouched.
Step 4 — Rewrite
docs/STATUS.mdas a design deltaReplace the file in full. One entry per gap, each naming the
DESIGN.mdsection itdeviates from and the current partial state where one exists. No file paths, no symbol
names, no "what exists" inventory. Final content:
Step 5 — Repair
README.mdREADME.mdline 32 describesAGENTS.mdas "architecture, conventions, and developmentcommands" and line 34 describes
docs/STATUS.mdas "what is actually implemented". Bothare wrong after Steps 2 and 4. Rewrite the three documentation bullets so
AGENTS.mdishow an agent works in this repository,
docs/DESIGN.mdis the design including thearchitecture and invariants, and
docs/STATUS.mdis where the tree differs from thedesign. Add a bullet for
docs/development.md(setup, commands, layout, commitconventions), which the list currently omits.
Verification
Working directory: the repository root. No build is required — nothing outside
docs/,AGENTS.mdandREADME.mdis edited — but the Rust suite must still be green, since atemplate or source file touched by accident would show up there.
grep -rn "routes -> views -> victorialogs" AGENTS.md docs/ README.md→ onlydocs/DESIGN.md(docs/development.mdkeeps its own one-line prose form"Dependencies run one way:
routes -> views -> victorialogs", which is not thisblock and must survive).
grep -rn "Invariants" AGENTS.md docs/→ the heading appears only indocs/DESIGN.md; occurrences inAGENTS.mdare references, not a list.grep -rn "Architecture & Data Flow\|## Key Directories\|## Development Commands" AGENTS.md→ no matches.
grep -rn "AGENTS.md" docs/ README.mdandgrep -rn "STATUS.md\|DESIGN.md\|development.md" AGENTS.md README.md docs/— everyhit must describe the new division. In particular
docs/DESIGN.mdmust no longer sayrules derived from these decisions live in
AGENTS.md, and §11 must no longer say aninvariant is stated in
AGENTS.md.grep -rn "fn tail\|logsql/tail" src/→ no matches; the only SSE routeoutside
src/dev_reload.rsmust be none (grep -rn "Sse\|text/event-stream" src/hits
src/dev_reload.rsonly).grep -rni "time_range\|from=\|until=\|_time:" src/views/ src/routes/→ no matches.
grep -rn "trait View\|enum Mode" src/→ no matches.sort_direction:grep -rn "sort_direction" src/→ no matches.test -f rust-toolchain.toml→ false.If any of these now returns a match, the corresponding bullet is wrong and must be
dropped or narrowed rather than published as written.
grep -rniE "wiremock|no VictoriaLogs integration|Initial commit|plain-text responses only" docs/STATUS.md→ no matches.
git status --shortlists atmost
AGENTS.md,README.md,docs/DESIGN.md,docs/STATUS.md,docs/development.md.just testpasses (it builds assets first; a barecargo testcompiles against whatever is already in
gen/assets/).Assumptions & contingencies
ArchitectureandInvariantssections go before## 1. Purposeindocs/DESIGN.md, unnumbered, so the existing decision numbers stay stable and nothingthat cites a §number breaks. If a reviewer prefers them numbered as §16/§17 at the end,
that is a pure relocation of the same text.
docs/development.mdis assumed to remain the single home of the command and layouttables;
AGENTS.mdlinks to it rather than restating it. An agent reading onlyAGENTS.mdwill therefore need one hop to findjustrecipes — accepted, because twocopies are what caused the current drift.
DESIGN.mdsection and noSTATUS.mdentry:the
viewpreference cookie, server-side timezone rendering, the wrap toggle, the HTMLerror template, and Renovate. If a reviewer wants any of them documented, it is an
addition to
docs/DESIGN.md, not a gap indocs/STATUS.md.