* fix(http): bd gate check over http through issueops.ListGates gate check listed its open gates with a raw SearchIssues filter (gate type, closed excluded, --limit), which the HTTP backend refuses, so the command failed before reading a gate on a remote scope and gc's core gate-sweep order (bd gate check --type=timer --escalate) failed every tick there. The listing now goes through issueops.ListGates over openQuerier on the direct and proxied routes, the same entry bd gate list took in S20 (#7549): the same question, served as queryIssues by every deployed server. The close, the bead-gate target read and sighting, the pure timer arm and the gh/gt execs are unchanged. The gh:run discovery's await_id persist still refuses on the wire and counts as that gate's error. The served corpus gains mc-gate-check-timer, mc-gate-check-gh (gate-sweep's argv) and gate-check-all. No seeded gate carries an await type, since no wire create accepts await_*, so these prove the listing is served. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * docs(gate): name both refused gate check writes; close gate's filter hole Review fixes for #7578 (apply-fixes, iteration 1). CHANGELOG, minor (taken): the entry said a bead gate's sighting was already served over HTTP. It is not. evaluateBeadGate records the first sighting (await_seen) through recordSeen, which calls the raw store.UpdateIssue (cmd/bd/gate.go:675). The HTTP Store has no UpdateIssue override, so its embedded unsupportedDoltStorage refuses the call in the client before any request is sent (internal/httpclient/unsupported_gen.go), exactly as it refuses the gh:run discovery's await_id persist. "Refuses on the wire" was wrong for the same reason. The entry now names both writes and keeps "counts as that gate's error" (applyGateCheckResults counts r.err). The sighting is written only when the check finds the awaited bead, not yet closed, in the gate's own store; inspectBeadGate sets seenHere only there. CHANGELOG, nit (taken): `bd gate check --limit -1` used to list every open gate on the direct and proxied routes, because the raw search emitted no LIMIT clause for a negative limit. The listing now goes through issueops.ListGates, whose Querier rejects a negative limit as ErrValidation, and the HTTP server rejects it too (internal/httpapi/query.go). The entry says so. .golangci.yml, minor (taken): at this head cmd/bd/gate.go and gate_proxied_server.go name no filter type (one each at the base), so their slot in the cmd/bd forbidigo family only kept a hole open. `gate` leaves the alternation, with a "LEFT this list" note like the ones for search, status and count. gate_discover keeps its own hole: findPendingGates still builds the raw filter. Declined: - bd gate discover still refuses over HTTP in findPendingGates (minor): the synthesis' first remedy is no change in this PR, and the file is not in this PR's diff. Finalize files the follow-up to move it onto ListGates. - the proxied listing is not pinned on its own (nit): it calls the same listOpenGatesForCheck as the direct route (gate_proxied_server.go:106), and the synthesis calls accepting the gap defensible. - listOpenGatesForCheck/listOpenGatesWith naming (nit): the remedy is "leave as is". Verified: - git diff --check: clean. - bazel build --config=nogo -- //cmd/bd:all on the edited config: 16 targets, exit 0. - Probe, then reverted: a types.IssueFilter literal in gate.go and a types.WorkFilter literal in gate_proxied_server.go each failed nogo with forbidigo's "do not write a filter here", so the hole is shut. - git merge-tree against the heads of all 102 other open PRs that touch CHANGELOG.md or .golangci.yml (today's census): this commit changes no conflict count in either file. 43 PR/file pairs already conflict with or without it. Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
657 lines
37 KiB
YAML
657 lines
37 KiB
YAML
# Lint policy for nogo (//tools/nogo), which runs these linters beside every
|
|
# Bazel Go compile: tools/nogo/internal/golangci embeds this file and applies
|
|
# it as golangci-lint v2.10.1 would (enabled linters, settings, run.tests,
|
|
# generated files, exclusion rules). Decoding is strict, so a key the nogo
|
|
# wrappers do not implement fails the build. golangci-lint itself still reads
|
|
# it (editors, ad-hoc runs), but CI gates on nogo; see engdocs/LINTING.md.
|
|
version: "2"
|
|
|
|
run:
|
|
timeout: 5m
|
|
tests: false
|
|
|
|
linters:
|
|
default: 'none'
|
|
enable:
|
|
- depguard
|
|
- errcheck
|
|
- forbidigo
|
|
- gosec
|
|
- misspell
|
|
- unconvert
|
|
- unparam
|
|
- sloglint
|
|
|
|
settings:
|
|
depguard:
|
|
rules:
|
|
# Mechanical enforcement of the Storage Boundary in
|
|
# engdocs/PROJECT_CHARTER.md: only the storage adapter packages may
|
|
# depend on the Dolt engine directly.
|
|
dolt-storage-boundary:
|
|
list-mode: lax
|
|
files:
|
|
- "$all"
|
|
# Storage adapter packages are the intended home for Dolt access.
|
|
- "!**/internal/storage/**"
|
|
- "!**/internal/doltserver/**"
|
|
# Exception: the proxied-server surface needs Dolt server config
|
|
# (servercfg, filesys) to launch/manage a real `dolt sql-server`
|
|
# process. Candidate for migration behind the storage adapter.
|
|
- "!**/cmd/bd/proxied_server.go"
|
|
# Exception: eventkit is DoltHub's analytics/telemetry client,
|
|
# not the Dolt storage engine - dropped here so the narrower
|
|
# dolt-storage-boundary-metrics-exception rule below can allow
|
|
# eventkit specifically while still denying any other dolthub
|
|
# import (e.g. the engine itself) in these two files.
|
|
- "!**/internal/metrics/flusher.go"
|
|
- "!**/internal/metrics/metrics.go"
|
|
deny:
|
|
- pkg: github.com/dolthub
|
|
desc: "Dolt engine access is restricted to the storage adapter packages (internal/storage, internal/doltserver) - see engdocs/PROJECT_CHARTER.md 'Storage Boundary'"
|
|
# Companion rule for the two files excluded above: allow only
|
|
# DoltHub's eventkit telemetry client, still deny the Dolt engine
|
|
# (or any other dolthub package) so metrics can't become a backdoor
|
|
# around the storage boundary.
|
|
dolt-storage-boundary-metrics-exception:
|
|
list-mode: lax
|
|
# No "$all" here: this rule's files list is a plain allowlist
|
|
# (not "!$all" + inclusions) because depguard expands "$all" to
|
|
# "**/*.go" even when negated, which would match every file
|
|
# (including these two) and make the rule apply nowhere.
|
|
files:
|
|
- "**/internal/metrics/flusher.go"
|
|
- "**/internal/metrics/metrics.go"
|
|
allow:
|
|
- github.com/dolthub/eventkit
|
|
deny:
|
|
- pkg: github.com/dolthub
|
|
desc: "Dolt engine access is restricted to the storage adapter packages (internal/storage, internal/doltserver) - see engdocs/PROJECT_CHARTER.md 'Storage Boundary'"
|
|
# internal/workapi is the work-query contract shared by every bd
|
|
# frontend, so it must be callable from a cobra command and from an
|
|
# HTTP handler alike - which means it can depend on neither. Same
|
|
# allowlist shape as the metrics exception above: no "$all", because
|
|
# depguard expands it to "**/*.go" and the rule would apply nowhere.
|
|
workapi-frontend-boundary:
|
|
list-mode: lax
|
|
files:
|
|
- "**/internal/workapi/**"
|
|
deny:
|
|
- pkg: github.com/spf13/cobra
|
|
desc: "internal/workapi is frontend-independent: the CLI parses flags and passes plain params - see internal/workapi/doc.go"
|
|
- pkg: net/http
|
|
desc: "internal/workapi is frontend-independent: the HTTP layer decodes requests and passes plain params - see internal/workapi/doc.go"
|
|
# The other half of that boundary. internal/httpapi is TRANSPORT: it
|
|
# decodes parameters, hands the whole request to issueops.Reader, and
|
|
# shapes the answer onto the wire. "No handler builds a filter or
|
|
# supplies a ConfigSource" is the Reader slice's acceptance criterion,
|
|
# and the rule above cannot enforce it - it constrains what workapi
|
|
# imports, not who imports workapi. Without this, a handler could call
|
|
# BuildListFilter tomorrow and every gate would stay green, which is
|
|
# exactly how a hosted viewer once shipped a bare IssueFilter and served
|
|
# in_progress rows as "ready".
|
|
#
|
|
# Tests are exempt: they read the shared default constants
|
|
# (workapi.DefaultReadyLimit) to prove the handler uses those rather
|
|
# than literals of its own, which is a guard, not a construction.
|
|
httpapi-transport-boundary:
|
|
list-mode: lax
|
|
files:
|
|
- "**/internal/httpapi/**"
|
|
- "!$test"
|
|
deny:
|
|
- pkg: github.com/steveyegge/beads/internal/workapi
|
|
desc: "internal/httpapi is transport only: a read handler asks the provider for issueops.Reader and passes the whole request - it never builds a filter - see internal/httpapi/reads.go"
|
|
# The OTHER way past the roles, and the one the rule above does not
|
|
# close. Denying internal/workapi stops a handler BUILDING a filter; it
|
|
# does nothing about a handler taking uw.IssueUseCase() and calling the
|
|
# use case straight, which needs no filter and no builder. That is not a
|
|
# hypothetical shortcut - it is exactly what the proxied CLI did for
|
|
# years, and unpicking it is what the role accessors exist for. A second
|
|
# front door that reached the domain directly would be the same two
|
|
# implementations again, arriving one handler at a time.
|
|
#
|
|
# Deny-by-default over the whole package, so a file added here tomorrow
|
|
# is covered the moment it exists. The two holes below are named, and
|
|
# each one is a VALUE the caller assembled, never a use case:
|
|
#
|
|
# server.go Config.Workspace is domain.ContextInfo, the startup
|
|
# snapshot the embedder hands in. The package resolves
|
|
# no workspace state of its own; this is the type of the
|
|
# thing it is given.
|
|
# handlers.go contextResponse projects that snapshot with
|
|
# domain.PublishedContext - the SAME projection `bd
|
|
# context` publishes, which is where the credential and
|
|
# host-path exclusions live. Reimplementing it here to
|
|
# satisfy a lint rule would be the field-by-field copy
|
|
# that projection exists to prevent.
|
|
#
|
|
# Neither file touches a use case, and both are small: the read handlers
|
|
# (reads.go), the one write (claim.go) and everything added later stay
|
|
# guarded. Tests are exempt for the reason the rule above exempts them -
|
|
# they stand up domain fakes to drive the handlers.
|
|
httpapi-domain-boundary:
|
|
list-mode: lax
|
|
files:
|
|
- "**/internal/httpapi/**"
|
|
- "!$test"
|
|
- "!**/internal/httpapi/server.go"
|
|
- "!**/internal/httpapi/handlers.go"
|
|
deny:
|
|
- pkg: github.com/steveyegge/beads/internal/storage/domain
|
|
desc: "internal/httpapi is transport only: a handler reaches storage through an issueops role accessor on the provider, never through the domain use cases - see internal/httpapi/claim.go"
|
|
# The same boundary, transposed onto the front door that was last past
|
|
# it. cmd/bd cannot be closed to the domain wholesale — thirty of its
|
|
# non-test files import internal/storage/domain today and unpicking
|
|
# them is a program, not a rule — so this closes it ONE COMMAND AT A
|
|
# TIME, and `bd label` is the first entry.
|
|
#
|
|
# It denies internal/storage/uow as well as internal/storage/domain,
|
|
# and the second package is the one that does the work here. depguard
|
|
# matches IMPORTS, and a file can call uw.LabelUseCase().AddLabel(...)
|
|
# without importing domain at all — the method call needs no import for
|
|
# the inferred type. That is exactly what cmd/bd/label_proxied_server.go
|
|
# did, so a domain-only deny would have been a rule that could not see
|
|
# the bypass it was written for. Reaching a use case requires a unit of
|
|
# work, opening one requires uow.RunTx, and THAT is an import.
|
|
#
|
|
# THIS RULE COVERS THE IMPORT SPELLING AND ONLY THE IMPORT SPELLING, and
|
|
# by itself it is NOT sufficient. cmd/bd is one package, so
|
|
# proxiedOpenReadUOW (cmd/bd/show_proxied_server.go) hands any file in
|
|
# it a uow.UnitOfWork with no import of its own — measured: a label.go
|
|
# calling proxiedOpenReadUOW(ctx) and then uw.LabelUseCase().AddLabel()
|
|
# compiles and passes this rule. An import-scoped guard cannot see a
|
|
# bypass routed through an in-package helper, and pretending otherwise
|
|
# would be worse than no rule, because the next reader greps for the
|
|
# guard, finds one, and stops looking.
|
|
#
|
|
# What closes that route is the forbidigo `LabelUseCase` rule below,
|
|
# and since ga-2ltro.12 that rule is PACKAGE-WIDE across cmd/bd while
|
|
# this one still names one file. The asymmetry is the design, not a
|
|
# gap: forbidigo denies the CALL, which is what a front door has to
|
|
# stop doing, and every file may be held to that today. depguard denies
|
|
# the PACKAGE, which a file cannot stop importing until its whole
|
|
# command has moved — fifty-eight non-test files in cmd/bd open a unit
|
|
# of work for verbs no role serves yet. So the pair covers a caller who
|
|
# reached the domain through some third spelling (a helper returning a
|
|
# use case directly, say) in the one file that has fully migrated, and
|
|
# forbidigo alone covers the call everywhere else. Both were verified
|
|
# by mutation, one bypass each; ga-2ltro.12 re-verified the forbidigo
|
|
# half from a file the depguard half does not name.
|
|
#
|
|
# cmd/bd/label.go holds every label decision now — the arg split, the
|
|
# reserved-prefix refusal, the patch, the report — and reaches storage
|
|
# only through issueops.Lifecycle and issueops.Reader.
|
|
# cmd/bd/label_proxied_server.go is NOT on this list and legitimately
|
|
# imports uow: it is where the route's capability accessors live, and
|
|
# it still holds `list-all` and `propagate`, whose questions no role
|
|
# answers yet. It joins the list when they move.
|
|
#
|
|
# The list grows by one file per command whose front doors reach the
|
|
# roles, the way cmd-bd-role-constructors grows by one package per
|
|
# shared body. cmd/bd/state.go is the second entry: ga-2ltro.12 moved
|
|
# `bd state`, `bd state list` and `bd set-state` onto Reader.Get and
|
|
# Lifecycle, deleted their proxied twin outright, and left the file
|
|
# importing neither package — so the rule pins a migration that has
|
|
# happened rather than asking for one that has not.
|
|
cmd-bd-domain-boundary:
|
|
list-mode: lax
|
|
files:
|
|
- "**/cmd/bd/label.go"
|
|
- "**/cmd/bd/state.go"
|
|
- "!$test"
|
|
deny:
|
|
- pkg: github.com/steveyegge/beads/internal/storage/domain
|
|
desc: "bd label and bd state reach storage through an issueops role accessor, never through the domain use cases - see openIssueLifecycle in cmd/bd/label.go"
|
|
- pkg: github.com/steveyegge/beads/internal/storage/uow
|
|
desc: "these commands do not open a unit of work: the route fork is the accessor (openIssueLifecycle/openIssueReader), and a unit of work here is how a use-case call gets back in - see cmd/bd/label.go"
|
|
# store.IssueReader() is the door to the reader role, and a store wears
|
|
# decorators (telemetry spans, hook firing) that each add their layer in
|
|
# their OWN accessor. A command holding the storage.DoltStorage
|
|
# interface that called the shared constructor directly would get a
|
|
# bare, unspanned reader - and would look like perfectly ordinary code.
|
|
# That constructor used to live in internal/workapi, which 22 cmd/bd
|
|
# files already import for the builders, so it was one line away at all
|
|
# times. It now lives in internal/workapi/storereader and this is what
|
|
# keeps it there.
|
|
#
|
|
# No matching entry for internal/httpapi: depguard matches pkg by
|
|
# prefix, so httpapi-transport-boundary above already denies the
|
|
# subpackage along with its parent.
|
|
#
|
|
# The list grows by one entry per store-backed role that gets a shared
|
|
# body of its own. It is a LIST rather than a rule per role so the next
|
|
# one is a one-line edit here - see
|
|
# engdocs/ADDING_AN_ISSUEOPS_ROLE.md.
|
|
cmd-bd-role-constructors:
|
|
list-mode: lax
|
|
files:
|
|
- "**/cmd/bd/**"
|
|
deny:
|
|
- pkg: github.com/steveyegge/beads/internal/workapi/storereader
|
|
desc: "a command reaches the reader role through store.IssueReader(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storereader/reader.go"
|
|
- pkg: github.com/steveyegge/beads/internal/workapi/storecounter
|
|
desc: "a command reaches the count role through store.Counter(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storecounter/counter.go"
|
|
- pkg: github.com/steveyegge/beads/internal/workapi/storeworkspaceconfig
|
|
desc: "a command reaches the workspace-settings role through store.WorkspaceConfig(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storeworkspaceconfig/workspaceconfig.go"
|
|
- pkg: github.com/steveyegge/beads/internal/workapi/storeversionreconciler
|
|
desc: "a command reaches the version-marker role through store.VersionReconciler(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storeversionreconciler/versionreconciler.go"
|
|
- pkg: github.com/steveyegge/beads/internal/workapi/storestats
|
|
desc: "a command reaches the summary role through store.StatsReporter(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storestats/reporter.go"
|
|
- pkg: github.com/steveyegge/beads/internal/workapi/storereadycounter
|
|
desc: "a command reaches the ready-count role through store.ReadyCounter(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storereadycounter/counter.go"
|
|
- pkg: github.com/steveyegge/beads/internal/workapi/storequerier
|
|
desc: "a command reaches the boolean-query role through store.Querier(), never through the constructor: the accessor is where each storage decorator adds its layer - see internal/workapi/storequerier/querier.go"
|
|
# beadserrors sits BENEATH every role leaf, so whatever it imports is
|
|
# imported by all of them - which is the reason it exists. The second
|
|
# leaf reached into issueops for one sentinel and pulled internal/types
|
|
# along behind it, and that import claimed the memory plane sits
|
|
# downstream of the issue plane. Stdlib only, and enforced rather than
|
|
# requested, because the next tempting import is always one shared
|
|
# constant that "obviously belongs with the errors".
|
|
#
|
|
# strict, not lax: this is an allowlist of the whole world, so a rule
|
|
# that named packages to deny would have to predict them.
|
|
beadserrors-leaf:
|
|
list-mode: strict
|
|
files:
|
|
- "**/beadserrors/**"
|
|
allow:
|
|
- "$gostd"
|
|
# The CONSTRUCTION half of that same boundary, and the half that actually
|
|
# matches the failure. The depguard rule above denies a handler IMPORTING
|
|
# the builders; it does not deny a handler naming the filter types, which
|
|
# internal/httpapi can already reach (reads.go uses types.CheckFieldLen and
|
|
# types.IssueWithCounts). A hand-rolled `types.IssueFilter{}` would skip the
|
|
# builders entirely and still lint clean - which is EXACTLY what the hosted
|
|
# viewer shipped: a bare IssueFilter that leaked gates, wisps, templates and
|
|
# closed beads that `bd list` hides.
|
|
#
|
|
# analyze-types resolves the selector to the type it actually denotes, so
|
|
# an aliased import of internal/types is caught and an unrelated package
|
|
# that happens to be called `types` is not.
|
|
#
|
|
# WHAT THE RULE FORBIDS IS NAMING THESE TYPES - a composite literal, a var,
|
|
# a struct field, a parameter, a return. It does not forbid HOLDING one:
|
|
# `filter, err := workapi.BuildListFilter(...)` names no type and passes,
|
|
# which is the point, but so would an inferred assignment from any other
|
|
# source, including a helper in one of the excepted files below. So the
|
|
# rule forecloses WRITING a filter in scope - which is what hand-rolling
|
|
# looks like - and it is not a proof that every filter in scope came from a
|
|
# builder. That is still the difference that matters: the builder is where
|
|
# the closed/done exclusions, the template, gate, infra and wisp
|
|
# suppression and the limit defaulting live.
|
|
#
|
|
# SCOPE, set by the exclusion rules near the bottom of this file:
|
|
#
|
|
# internal/httpapi/** every file, no exceptions. Each read handler hands
|
|
# the whole request to issueops.Reader and the
|
|
# surface has no other job, so a file added here
|
|
# tomorrow is covered the moment it exists.
|
|
# cmd/bd/** DENY BY DEFAULT, with the files that legitimately
|
|
# build a filter named as exceptions below. This is
|
|
# the way round that survives a rename: `bd list`
|
|
# split into a new helper, or show.go renamed, stays
|
|
# guarded. An inclusion list of five filenames -
|
|
# which is what this was - stops applying the moment
|
|
# the code moves, silently.
|
|
#
|
|
# Nothing else in the tree is in scope, deliberately: there are ~750
|
|
# legitimate filter literals in storage, the domain, conformance and the
|
|
# tests, and a tree-wide ban is not the claim.
|
|
forbidigo:
|
|
analyze-types: true
|
|
forbid:
|
|
- pattern: 'LabelUseCase$'
|
|
msg: "reach the label plane through issueops.Lifecycle (Patch.Labels) and issueops.Reader, never the domain use case - see openIssueLifecycle in cmd/bd/label.go"
|
|
- pattern: '^types\.(IssueFilter|WorkFilter)$'
|
|
pkg: '^github\.com/steveyegge/beads/internal/types$'
|
|
msg: "do not write a filter here: take one back from a builder in internal/workapi, or pass the whole request to issueops.Reader. internal/httpapi may never name these types; cmd/bd denies them by default and lists the files that legitimately build their own, with the reason for each, in .golangci.yml - see issueops/reader.go"
|
|
- pattern: '^fmt\.Print(f|ln)?$'
|
|
pkg: '^fmt$'
|
|
# Keep the prefix in sync with the list/graph text exclusion below.
|
|
msg: "do not write list/graph output through process stdout: route format output through the command writer; mark an intentional non-format path locally"
|
|
- pattern: '^os\.Stdout$'
|
|
pkg: '^os$'
|
|
# Keep the prefix in sync with the list/graph text exclusion below.
|
|
msg: "do not write list/graph output through process stdout: route format output through the command writer; mark an intentional non-format path locally"
|
|
errcheck:
|
|
exclude-functions:
|
|
- (*database/sql.DB).Close
|
|
- (*database/sql.Rows).Close
|
|
- (*database/sql.Tx).Rollback
|
|
- (*database/sql.Stmt).Close
|
|
- (*database/sql.Conn).Close
|
|
- (*os.File).Close
|
|
- (os).RemoveAll
|
|
- (os).Remove
|
|
- (os).Setenv
|
|
- (os).Unsetenv
|
|
- (os).Chdir
|
|
- (os).MkdirAll
|
|
- (fmt).Sscanf
|
|
- (fmt).Fprint
|
|
- (fmt).Fprintf
|
|
- (fmt).Fprintln
|
|
- fmt.Fprint
|
|
- fmt.Fprintf
|
|
- fmt.Fprintln
|
|
misspell:
|
|
locale: US
|
|
|
|
exclusions:
|
|
rules:
|
|
# forbidigo holds four rules: filter construction, label-plane access,
|
|
# and the two process-stdout forms used by list/graph output. The entries
|
|
# from here to the test exemption define their scopes. This first one
|
|
# keeps every rule off the rest of the tree; the settings block says why.
|
|
#
|
|
# The previous version of this comment said there was exactly one rule and
|
|
# that a second "would need this widened or replaced". That came true, and
|
|
# what it cost is the entry below plus a `text:` on THREE of the per-path
|
|
# holes. Every hole from here down is written for the FILTER rule and
|
|
# predates the label one, so a hole that names only a path silently opens
|
|
# both. That is fine wherever the file never reaches a label use case, and
|
|
# it is not fine for the files that do - see the three `text:`-scoped
|
|
# entries below.
|
|
- path-except: '^(internal/httpapi/|cmd/bd/)'
|
|
linters:
|
|
- forbidigo
|
|
# Process stdout is forbidden only across the list/graph file families.
|
|
# Existing non-format paths in those families carry local, reviewed
|
|
# exceptions; a new file or output site is denied by default. Scoping by
|
|
# the diagnostic text keeps the filter and label rules unchanged.
|
|
- path-except: '^cmd/bd/(list|graph).*\.go$'
|
|
# This prefix must match both fmt.Print and os.Stdout messages above.
|
|
text: 'do not write list/graph output through process stdout'
|
|
linters:
|
|
- forbidigo
|
|
#
|
|
# THE LABEL-PLANE RULE IS NOW PACKAGE-WIDE ACROSS cmd/bd (ga-2ltro.12).
|
|
# It used to be narrowed by a `path-except` to cmd/bd/label.go, the one
|
|
# file ga-26w10 had migrated, on the argument that holding an unmigrated
|
|
# command to a rule written for a migration it had not had would be a lint
|
|
# waived on sight. What that reasoning missed is that the waiver was
|
|
# INVISIBLE: a file outside the exemption got no marker, no reason and no
|
|
# diff, so the three commands still hand-rolling the four-way
|
|
# (add|remove) x (wisp|durable) switch the rule exists to delete looked
|
|
# exactly like the ones that had nothing to declare. There is no
|
|
# `path-except` here any more. Every remaining caller carries its own
|
|
# //nolint:forbidigo with the reason that site is not a role's question,
|
|
# and a reviewer can count them.
|
|
#
|
|
# Inside cmd/bd the rule is deny-by-default, so each entry below is a
|
|
# HOLE in it and carries the reason that hole exists. 59 of the 389
|
|
# non-test files under cmd/bd are on this list; widening it is an edit
|
|
# here and a diff a reviewer sees. internal/httpapi has no entry and is
|
|
# meant not to.
|
|
#
|
|
# The modes of `bd list` and `bd show` that consume the filter as a
|
|
# VALUE: the recursive --parent tree walk (it re-parents a copy at every
|
|
# level), the --watch poll loop, the proxied route's builder call (it has
|
|
# to name the type to hand the filter back), and --current (which
|
|
# resolves an id from a deliberately BARE filter that must not pick up
|
|
# the default listing's exclusions).
|
|
#
|
|
# `bd list`'s PAGE left this hole when issueops.Reader took it on both
|
|
# routes: cmd/bd/list.go and cmd/bd/list_proxied_server.go were never on
|
|
# this list and still are not, and the modes above are all that keeps this
|
|
# file on it. The entry therefore stays and the count is unchanged — a
|
|
# role commit that could not remove one says so rather than implying it.
|
|
- path: '^cmd/bd/list_show_filter_modes\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# `bd ready` hands its filter to the plain listing and to --claim, and
|
|
# readyInput carries it as a field for them. Routing only the listing
|
|
# through the role would fork the command in two, so the filter stays
|
|
# nameable here. The other modes take no filter from readyInput: --gated
|
|
# and --mol answer a different question and short-circuit before the
|
|
# flags are gathered, and so does --explain, which is a whole-graph
|
|
# diagnostic and therefore builds its own fixed request through the same
|
|
# builder (readyExplainFilter, which names the type it returns) rather
|
|
# than inlining a third copy of the default - bd-3fs.3. The blocked-issue
|
|
# views in these files name the type directly for an empty filter or one
|
|
# carrying only a --parent id, which is the absence of a filter rather
|
|
# than one this command built. `bd ready`'s LISTING is on the shared
|
|
# BUILDER and, on the proxied route, the shared EPILOGUE; it is not on a
|
|
# role, and this rule does not pretend otherwise. Its other two questions
|
|
# are: --claim goes to ReadyClaimer and the published total to
|
|
# ReadyCounter, both over the request rather than the filter, on both
|
|
# routes - which is why this hole keeps shrinking rather than growing.
|
|
- path: '^cmd/bd/ready(_input|_proxied_server)?\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# Everything below this point is a command that is NOT one of the three
|
|
# shared reads. Each asks storage its own question and builds the filter
|
|
# that question needs; none is on the reader role or claims to be. They
|
|
# are grouped by family only so the reasons stay readable - every file is
|
|
# still named, and a new file in a family is still an edit here.
|
|
#
|
|
# Commands with a direct route and a proxied twin that build the same
|
|
# filter on both.
|
|
#
|
|
# `status` LEFT this list when the StatsReporter role took the assignee
|
|
# filter, the ready-work filter and the status fold off both its routes:
|
|
# cmd/bd/status.go and cmd/bd/status_proxied_server.go now build an
|
|
# issueops request and name no filter type, so the hole they needed is
|
|
# closed rather than merely unused. Removing an entry here is how a role
|
|
# commit proves its front doors reached the role.
|
|
#
|
|
# `purge` left it the same way when the Sweeper role took the candidate
|
|
# filter off both `bd purge` and `bd prune`: cmd/bd/purge.go now builds an
|
|
# issueops.SweepRequest, and cmd/bd/purge_proxied_server.go is down to the
|
|
# provider's capability accessor. `gc` stays — it is a different command
|
|
# that still selects its own closed beads, and it now shares only the pure
|
|
# recheck (workapi.FilterSweepCandidates) with the role.
|
|
# `text:` ON EVERY HOLE IN THIS FAMILY, this one included, and the
|
|
# completeness is the point rather than the tidiness. A hole naming only a
|
|
# path opens EVERY forbidigo rule for its files, so an unscoped one is a
|
|
# standing invitation: move the call into a file the hole already covers
|
|
# and the label guard never sees it. That is not hypothetical - it is how
|
|
# the guard spent its first slice unable to see mol_port.go's copy of the
|
|
# switch it was written for.
|
|
#
|
|
# The first version of this pass scoped only the three holes that covered
|
|
# a file with a LabelUseCase call TODAY, and reasoned that the others
|
|
# "name no file that reaches a label use case, so widening them now would
|
|
# be churn asserting nothing". That reasoning is wrong in the one way that
|
|
# matters for a guard: a rule is not sized by where the violations are, it
|
|
# is sized by where the next one may be WRITTEN. A review probe put a
|
|
# neutrally-named helper into the ado/gitlab/jira/linear hole and it
|
|
# passed. Every hole below is scoped now, and adding a file family to this
|
|
# list no longer silently costs the label boundary.
|
|
#
|
|
# The `_test\.go` exemption further down stays unscoped on purpose: `run:
|
|
# tests: false` means forbidigo never analyzes a test file at all, so that
|
|
# entry asserts nothing either way and scoping it would be the churn this
|
|
# comment just refused to write.
|
|
#
|
|
# `search` LEFT this list when all three of its routes moved onto
|
|
# issueops.Reader.List with issueops.SearchListRequest (cmd/bd/search.go);
|
|
# it builds no filter any more.
|
|
#
|
|
# `gate` LEFT it when `bd gate check` joined `bd gate list` on
|
|
# issueops.ListGates over the route's Querier: cmd/bd/gate.go and
|
|
# cmd/bd/gate_proxied_server.go name no filter type any more.
|
|
# `gate_discover` keeps its own hole below, since findPendingGates still
|
|
# asks SearchIssues for its gates.
|
|
- path: '^cmd/bd/(close|duplicates|find_duplicates|gc|graph|info|label|orphans|purge|todo|wisp|human)(_proxied_server)?\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# Molecule reporting: each selects the members of one molecule.
|
|
#
|
|
# `mol current` and `mol progress` LEFT this list when their in_progress
|
|
# and hooked listings moved onto issueops.Reader.List (cmd/bd/mol_roles.go)
|
|
# so a remote backend answers them. The proxied route's in-transaction
|
|
# port still searches through the unit of work, and that filter lives in
|
|
# mol_port.go beside the port.
|
|
- path: '^cmd/bd/mol_(port|ready_gated|stale)\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# External-tracker sync: each selects the beads to push to its tracker.
|
|
- path: '^cmd/bd/(ado|gitlab|jira|linear)\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# Bulk movement of issues in, out and across prefixes. export_source is
|
|
# export's storage seam (classic store vs proxied unit of work): it does
|
|
# not build a filter, it carries the one export.go builds through to
|
|
# whichever stack is live.
|
|
- path: '^cmd/bd/(export|export_auto|export_source|import|migrate|migrate_issues|migrate_personal|rename|rename_prefix)\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# doctor's diagnostics and the fixes that follow them.
|
|
- path: '^cmd/bd/doctor_(conventions|pollution)\.go$|^cmd/bd/doctor/(maintenance|fix/maintenance|fix/migrate)\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# One command each, no family to join.
|
|
#
|
|
# `count` LEFT this list when the Counter role took the filter off both
|
|
# its routes: cmd/bd/count.go now builds an issueops.CountRequest and
|
|
# names no filter type, so the hole it needed is closed rather than
|
|
# merely unused. Removing an entry here is how a role commit proves its
|
|
# front door reached the role.
|
|
|
|
- path: '^cmd/bd/(cleanup|completions|gate_discover|lint|ping|repo|swarm|template)\.go$'
|
|
text: 'do not write a filter here'
|
|
linters:
|
|
- forbidigo
|
|
# Tests are exempt for the same reason the depguard twin exempts them:
|
|
# recordingIssues in reads_test.go holds []types.WorkFilter and
|
|
# []types.IssueFilter to CAPTURE what the reader asked storage for, which
|
|
# is how the guard is checked, not a construction. `run.tests: false`
|
|
# already means this never fires - this is here so flipping that switch
|
|
# does not turn the guard into a landmine on its own oracle.
|
|
- path: '_test\.go'
|
|
linters:
|
|
- forbidigo
|
|
# G304: File inclusion via variable in tests is safe (test data)
|
|
- path: '_test\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G304"
|
|
# G306: File permissions 0644 in tests are acceptable (test fixtures)
|
|
- path: '_test\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G306"
|
|
# G304: Safe file reads from known JSONL and error paths
|
|
- path: 'cmd/bd/doctor/fix/sync_branch\.go|cmd/bd/doctor/git\.go|cmd/bd/doctor/sync_branch_jsonl\.go|cmd/bd/dolt\.go|cmd/bd/rename_prefix\.go|internal/beads/beads\.go|internal/syncbranch/worktree\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G304"
|
|
# G302/G306: Directory/file permissions 0700/0750 are acceptable
|
|
- linters:
|
|
- gosec
|
|
text: "G302.*0700|G301.*0750"
|
|
# G302/G306: JSONL files and error logs need 0644 for debugging/sharing
|
|
- path: 'cmd/bd/setup\.go|internal/git/worktree\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G306"
|
|
# G306: Git hooks must be executable (0700)
|
|
- path: 'cmd/bd/init\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G306.*0700"
|
|
# G204: Subprocess launched with variable — all subprocess args are from
|
|
# trusted internal sources (git commands, config values, validated IDs)
|
|
- linters:
|
|
- gosec
|
|
text: 'G204'
|
|
# G104: Deferred file/db closes - errors are non-critical
|
|
- path: 'cmd/bd/show\.go|cmd/bd/doctor/dolt\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G104"
|
|
# G115: Integer overflow conversion uintptr->int in terminal fd wrappers (safe on 64-bit)
|
|
- linters:
|
|
- gosec
|
|
text: "G115"
|
|
# G117: Exported struct fields matching secret patterns are intentional API fields
|
|
- path: 'internal/compact/compactor\.go|internal/jira/client\.go|internal/linear/types\.go|internal/linear/oauth\.go|internal/storage/versioned\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G117"
|
|
# G304: Safe file reads from config paths
|
|
- path: 'internal/config/config\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G304"
|
|
# G306: Config file permissions 0644 are acceptable
|
|
- path: 'internal/config/config\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G306"
|
|
# G703: Path traversal via taint — paths are from config or internal construction
|
|
- linters:
|
|
- gosec
|
|
text: "G703"
|
|
# G704: SSRF via taint in API clients with user-configured URLs
|
|
- path: 'cmd/bd/doctor/(claude|version)\.go|internal/github/client\.go|internal/gitlab/client\.go|internal/jira/client\.go|internal/linear/client\.go|internal/linear/oauth\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G704"
|
|
# G705: XSS via taint in CLI template rendering (no browser context)
|
|
- path: 'cmd/bd/compact\.go|internal/linear/client\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G705"
|
|
# G705: XSS via taint in CLI progress/warning/error output — every flagged
|
|
# sink is fmt.Fprint* to the terminal (os.Stderr or cobra's stdout/stderr
|
|
# writers), never a browser context (surfaced by the gosec bundled with
|
|
# golangci-lint v2.10)
|
|
- path: 'cmd/bd/(ado|doctor|errors|github|gitlab|hooks|jira|linear|main|notion|sync_push_pull)\.go'
|
|
linters:
|
|
- gosec
|
|
text: "G705"
|
|
# errcheck: fmt.Fprintf errors are noise in CLI help text generation
|
|
- path: 'cmd/bd/help_all\.go'
|
|
linters:
|
|
- errcheck
|
|
text: "fmt.Fprintf"
|
|
# errcheck: Ignore unchecked errors in test files for common cleanup patterns
|
|
- path: '_test\.go'
|
|
linters:
|
|
- errcheck
|
|
text: "Error return value of .*(Close|Rollback|RemoveAll|Setenv|Unsetenv|Chdir|MkdirAll|Remove|Write|SetReadDeadline|SetDeadline|Start|Stop).* is not checked"
|
|
|
|
# unparam: Placeholder functions that may return errors in future implementation
|
|
- path: 'cmd/bd/jira\.go'
|
|
linters:
|
|
- unparam
|
|
text: 'reimportConflicts|resolveConflictsByTimestamp'
|
|
# unparam: childrenMap return computed for future parent-child display
|
|
- path: 'cmd/bd/list\.go'
|
|
linters:
|
|
- unparam
|
|
text: 'buildBlockingMaps.*childrenMap'
|
|
# unparam: truncateID maxLen kept for readability
|
|
- path: 'cmd/bd/migrate\.go'
|
|
linters:
|
|
- unparam
|
|
text: 'truncateID.*maxLen'
|
|
# unparam: getConfig error return kept for API consistency with store.GetConfig
|
|
- path: 'internal/(linear|gitlab|jira)/tracker\.go'
|
|
linters:
|
|
- unparam
|
|
text: 'getConfig'
|
|
# unparam: ctx kept for context propagation; callers currently all pass rootCtx
|
|
- path: 'cmd/bd/linear\.go'
|
|
linters:
|
|
- unparam
|
|
text: 'getLinearConfig'
|
|
# misspell: "cancelled" is intentional - matching GitHub API response values
|
|
- path: 'cmd/bd/gate\.go'
|
|
linters:
|
|
- misspell
|
|
text: 'cancelled'
|
|
|
|
issues:
|
|
uniq-by-line: true
|