Audit: laws & design-spec conformance across the codebase — findings documented as comments on this ticket #331
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#331
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?
What's requested
A complete audit of how well the repo's design specs and laws have been followed, with every deviation found documented as a comment on this ticket — one comment per finding, so each can be discussed, ruled on, and resolved independently.
This is a research/audit ticket: the deliverable is comments on this issue, not code changes.
The audit's terms of reference
What counts as "the laws and design":
AGENTS.md§1 — the numbered laws (dependency budget, git-as-subprocess, concurrency/lock order, and the rest of the numbered list).AGENTS.md§2 — the operational rules (spec spelling, test identity pinning, fresh-clone compile, CI publishing, etc.).docs/go/*.md(01–17) — the normative architecture specs; each doc's "Decisions & deviations" section is part of the record.docs/features/*.md(01–11) — the feature specs, each with their own wire/store/layout contracts and cache-class rules.DEVIATIONS.md— the already-ratified deviation ledger (a finding that's already ratified there is a non-finding; cite it and move on).Audit method (per area, evidence required):
go.modrequire list andweb/package.jsonruntime deps against the law's exact allowlist. Any undeclared dev-time tool counts too.internal/gitargv construction againstdocs/go/04_git.md's specified argv.### Concurrencysubsection; check lock ordersyncMu → packMu → rwusage and TryLock-onlyrwwrites againstdocs/go/13_concurrency.md.docs/go/07_api.md(cache classes per §4 — the two-class rule,[]-not-null, RFC 3339, plain-text errors, three route twins per NonRepo route,RegisterExposedcoverage) and store keys againstdocs/go/02_storage_protobuf.md.docs/features/*.md, verify the landed implementation matches the spec's endpoint table, auth classes, and storage keys — the known OpenUI-scan found several (#71–#98audit wave) but nothing systematic since.web/src/lib/importable in Node), thenode --testglob rule.fmtSpecSize/fmtSpecDurationrender rules, §9 naming/compat identity changes inDEVIATIONS.md.Deliverable format (each finding = one comment):
DEVIATIONS.md.DEVIATIONS.md(D-WEB-6, D-WEB-7, 17.1, the R1 rulings) are cited as context, not re-filed.Known hot spots to prioritize (from this ticket-tracker's own history): the cache-class drift family (#280 —
ccSWRcopy-pasted across feature packages, spec'd in two feature docs), discovery/RegisterExposedcoverage gaps (#272 — most feature packages never registered), and anything the audit waves #71–#98 touched that may have regressed.Scope guards
main— cite the commit SHA the audit ran against.Acceptance criteria
AGENTS.md§1 audited against the code, with a pass/fail comment (pass = short comment citing what was checked; fail = full finding format).docs/go/anddocs/features/spec checked for docs-vs-reality drift in its core contracts (endpoint tables, storage keys, cache classes, auth classes).go.modandweb/package.jsondiffed against law 1 exactly.DEVIATIONS.md-ratified items are cited as non-findings, not re-reported.[FINDING — docs-lie, law 12] DEVIATIONS.md D-DEP-1 still claims 'exactly three modules', contradicting the ratified x/crypto fourth module
Evidence (audit commit
70d29dd):Severity: docs-lie (doc fix needed, not a code violation — the code matches the amended law).
Recommendation: amend D-DEP-1 in DEVIATIONS.md to the four-module budget in the same change as any touch of that section; cite 17.1.
[FINDING — docs-lie, law 12] DEVIATIONS.md D-DEP-2 still claims 'zero npm runtime dependencies', contradicting ratified D-WEB-6/D-WEB-7
Evidence (audit commit
70d29dd):Severity: docs-lie (code matches the amended law; the ledger is stale).
Recommendation: mark D-DEP-2 superseded-by-chain (D-WEB-6 → D-WEB-7) instead of in force.
[FINDING — docs-lie, law 12] DEVIATIONS.md D-PKG-2 ('node stage exists ONLY to run esbuild') contradicts the ratified vite build
Evidence (audit commit
70d29dd):Severity: docs-lie (Dockerfile + Makefile match D-WEB-6; the ledger entry is stale).
Recommendation: amend D-PKG-2 to describe the vite+esbuild node stage (or mark superseded by D-WEB-6). Could be folded with the D-DEP-1/D-DEP-2 ledger-refresh into one 'DEVIATIONS.md staleness pass' ticket.
[FINDING — law violation (law 6 mechanism absent) + docs-lie, law 12] The sim tier is specified but does not exist: internal/sim/ absent, 'make sim' is a no-op
Evidence (audit commit
70d29dd):Severity: law violation class (the assertion mechanism law 6 mandates is absent) + docs-lie (doc 15 presents the tier as normative/landed).
Recommendation: either land internal/sim per doc 15 §4, or record an explicit decision (doc 15 Decisions section + DEVIATIONS.md) deferring/descoping it and fix AGENTS.md law 6 + §2 + Makefile references to match reality.
[FINDING — spec drift (minor), law 12] Doc 15 D3 names Make targets with no recipe: test-slow, contract-fs, dev (plus sim, filed separately)
Evidence (audit commit
70d29dd):Severity: spec drift, minor (doc over-claims; no code behavior at stake).
Recommendation: amend D3's target list to the actual Makefile (or restore the missing targets). Fold into the same ticket as the sim finding if the sim lands.
[FINDING — spec drift (minor), law 12] ssh-keys NonRepo routes lack /api-browser/v1 twins required by the 07 §3 lane note
Evidence (audit commit
70d29dd):Severity: spec drift, minor.
Recommendation: amend the 07 §3 lane note to carve out self-service ssh-keys as token-lane-only (or add the twins + ExposedTemplates). Suggest ruling alongside any 17_ssh.md touch.
[PASS — law 1] Dependency budget: go.mod and web/package.json match the amended allowlist exactly
Checked at
70d29dd: go.mod requires exactly BurntSushi/toml v1.6.0, go-chi/chi/v5 v5.3.2, x/crypto v0.56.0, x/net v0.58.0 (+ indirect x/sys, x/text) — the 4 allowed backend modules (chi core only; no chi/cors, chi/middleware, x/sync — C-1 honored, hand-rolled errgroup in internal/store/errgroup.go). web/package.json runtime deps exactly solid-js + @solidjs/router + marked@18.0.11 + dompurify@3.4.15; dev tools vite + vite-plugin-solid + tailwindcss + @tailwindcss/vite + esbuild only. No other package.json files carry deps. (The DEVIATIONS.md ledger lagging these amendments is filed as separate findings; the code and AGENTS.md are consistent.)[PASS — law 2] Git-as-subprocess: no git library imports; sampled argv matches docs/go/04_git.md
Checked at
70d29dd: grep for go-git/git2go/libgit2/src-d bindings across *.go → zero hits. Sampled argv: internal/git/refs.go:494 + bundle.go:343 'update-ref --stdin' (04 §4.3 grammar), refs.go:808 persistent 'cat-file --batch' peel cache (04 §D-ENG-4), upload.go:58 '-c uploadpack.allowSidebandAll=true upload-pack' (04:492). D-ENG-2 rev-list/cat-file-check pipeline and D-ENG-6 git.binary plumbing noted in code comments.[PASS — law 3] Concurrency: subsections present in every docs/go spec; TryLock-only rw writes honored
Checked at
70d29dd: every docs/go/01-17 doc carries Concurrency subsections (### in 02/04/07/08/12/13/14/16/17, #### in 01/03/05/06/09/10, numbered §§ in 11/15). Code: rw writes go only through TryWriteLock (internal/wal/reconcile.go:317, eviction.go:178-182); no blocking rw.Lock( anywhere; RLock readers at handle.go:305 are the sanctioned long-held read guards. Canonical primitive internal/wal/rw.TryRWMutex per ruling C-2; lock order syncMu → packMu → rw documented at handle.go:3. No out-of-order acquisition found in sampled paths.[PASS — hot spots] Cache-class drift (#280) and RegisterExposed coverage (#272) show no regression
Checked at
70d29dd: all feature packages define the spec'd classes — pulls/issues/social/identity/releases use 'private, no-cache' mutable-collab + version/folded ETags with 304 paths, 'no-store' on lists/task starts, SWR kept only where spec'd (pulls diff at pulls/http.go:571 per 03 §8; ref-dependent core routes). review/checks/tags/mirror/repoimport/notify literal no-store matches their specs (04/05: all no-store). Every feature package (issues, pulls, review, checks, social, releases, notify, identity, mirror, repoimport, tags) declares ExposedTemplates AND is composed via api.RegisterExposed in cmd/walhub/*.go in the same change (law 12 honored in code comments); discovery derives endpoints[] from the live route table + registry (internal/api/discovery.go:26-46, D-API-2 phantom-route rule intact).[PASS — sampled] Feature endpoint tables, storage keys, wire rules, and laws 4/5/7/8/9/10/11 spot checks
Checked at
70d29dd: 01 identity dispatch (routeUsers/routeOrgs/routeInvites, self-or-admin PUT, owner-gated rosters) matches the §8 table; 02/03 keys use the spec'd num:06x hex-storage/decimal-wire idiom with pr.json + mergeable.json sidecars; 04 review dispatch covers the reviews/threads/requests/suggest table; 10 import + 11 mirror dispatch (incl. both lanes, method matrix, 404/409/503 shapes, scrubbed errors) match their tables; 12_runner freeze honored (doc is DRAFT 'no code may land', no runner/actions code exists). Wire: plain-text errors via writePlain, RFC 3339 consts, []-initialized lists, per-segment decoding + both lanes everywhere. Laws: no upward imports from store/wal/git (law 8); golden proto fixtures in internal/store/proto/testdata/golden (law 5); task single-flight present (wal/singleflight.go — law 7); oidc-requires-allowlist enforced in config/validate.go:110 (law 9); setup-only 503 mode present in internal/server (law 10); cover gate ≥95 configured (Makefile:34-41) with samples policy 97.4% / config 95.7% (law 11). Frontend: zero .ts/.tsx, Tailwind v4 CSS-first (ui.css @import tailwindcss), render-md.js marked+DOMPurify wrapper (D-WEB-7), node --test uses glob in Makefile:29 + Woodpecker:32, pnpm allowBuilds + dist/.keep per field lessons.[AUDIT SUMMARY] Laws & design-spec conformance audit — 6 findings, 5 passes (commit
70d29ddc33, main, read-only, zero code changes)Findings by severity:
Passes: law 1 budget · law 2 git-subprocess · law 3 concurrency · #280/#272 hot spots · feature tables/keys/wire + laws 4/5/7/8/9/10/11 samples.
NOT verified (reason): full per-route auth-class matrix — sampled only, needs handler-by-handler pass; law 4 push-ACK-before-bucket-ACK ordering — needs publish-path trace; full ≥95% cover gate — 2 packages sampled, full 'make cover' not run (time); features 05/06/07/08 tables in full — cache/auth lines sampled; anything browser-rendered — no browser per instructions (curl/CDP explicitly out of scope for this ticket); MASTER_RUST_SPEC.md byte-compat beyond golden fixtures — fixtures + codec review only.
Audit findings converted to child issues: #337 (DEVIATIONS.md staleness: D-DEP-1/D-DEP-2/D-PKG-2), #338 (missing sim tier + Makefile targets), #339 (ssh-keys lane twins). This ticket closes once all three children are closed.
All three children closed: #337 (ledger refresh), #338 (sim tier landed), #339 (lane carve-out). Closing the audit parent.