Skip to content

lint updates.#56

Merged
josealekhine merged 14 commits intomainfrom
feature/lint
Apr 4, 2026
Merged

lint updates.#56
josealekhine merged 14 commits intomainfrom
feature/lint

Conversation

@josealekhine
Copy link
Copy Markdown
Member

No description provided.

Add docs/reference/audit-conventions.md — contributor-facing guide
covering all 34 internal/audit/ tests with before/after examples
and fix patterns.

Remove 4 overly broad exemptions from TestNoMagicStrings: format
verbs ("%d", "%x"), URL scheme prefixes ("https://"), HTML entities
("<"), and internal/err/ package exemption. Fix all 17 surfaced
violations by replacing fmt.Sprintf with strconv/hex stdlib calls
and extracting magic strings to config constants (cfgHTTP.Prefix*,
cfgGit.FlagLastN, cfgWarn.CopilotClose, cfgWarn.JSONEncode).

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
All user-facing format strings in write/steering, write/skill,
write/trigger, write/setup, mcp/handler, trigger/, and drift/
now go through desc.Text() with YAML-backed DescKeys.

Added 42 YAML entries in ui.yaml and 30 DescKey constants across
6 config/embed/text files (steering.go, trigger.go new; skill.go,
setup.go, mcp_tool.go, drift.go updated). Also adds predicate
naming convention section to audit-conventions.md.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Config const blocks with group docs are exempted from per-constant
doc checks. This lets ~1300 DescKey constants through without
individual docs. Added comment documenting the gap; tracked as
task for future tightening.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
… exemptions

Tighten TestDocComments so config/embed/ packages no longer get a
blanket exemption for const blocks — DescKey names like
DescKeyWriteSetupDeployMCP are not self-documenting. Added
per-constant doc comments to all ~1716 exported constants across
172 files in config/embed/{text,cmd,flag}.

Add "DO NOT widen" guard comments to all 10 exemption/allowlist
data structures across 7 audit test files. These prevent agents
from adding drive-by entries to make tests pass instead of fixing
the code.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Remove blanket isConstDef exemption from TestNoMagicStrings — const
definitions outside config/ are now caught as magic strings. All 156
violations resolved:

- Typed string enums (IssueType, TriggerType, InclusionMode,
  ResourceStatus, ResourceKind, CheckName, StatusType) moved to
  config/{drift,trigger,steering,sysinfo}/ with types.go convention.
- Path/label constants moved to config/{io,setup,skill,steering,
  trigger,hook,rc,bootstrap,dep}/.
- Templates (bash script scaffold, steering foundation files) moved
  to assets/tpl/{tpl_trigger,tpl_steering}.go.
- User-facing messages moved to YAML + desc.Text().
- Duplicate paramSummary replaced with field.Summary.
- Dead LabelAllTools in config/trigger deleted.
- Mixed visibility fix: hooks() moved to separate file.
- config/README.md updated with config/ vs entity/ type guidance.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
…bility

Unexport 5 test-only symbols (RegistryError, CreateVSCodeArtifacts,
LockedFrontmatterLine, RegisteredTools, MatchFull) and delete 1
(ErrCodeInvalidReq). Remove 6 entries from testOnlyExports (11
remain, all cross-package — tracked for future sessions).

Extract shared MCP deploy helper (cli/setup/core/mcp/) eliminating
3-way duplication across cursor/cline/kiro deploy.go files. Both
ensureMCPConfig and syncSteering now delegate to the shared package.

Fix mixed visibility: move registryError() and registeredTools()
to separate files (hooks.go, tools.go). Replace LockedFrontmatterLine
test usage with source constant session.FrontmatterLockedLine.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Replace 2 unhandled fmt.Fprintf calls with ctxIo.SafeFprintf
which logs write errors via warn.Warn per project convention.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Remove blanket isConstDef/isVarDef exemption from TestNoMagicValues
— numeric const definitions outside config/ are now caught. All 7
violations resolved:

- JSON-RPC error codes (ErrCodeParse, ErrCodeNotFound,
  ErrCodeInvalidArg, ErrCodeInternal) moved from mcp/proto/schema.go
  to config/mcp/schema/. Updated 14 consumer sites + 1 test file.
- DefaultPriority (50) moved to config/steering/. Updated
  steering/frontmatter.go and cli/steering/cmd/add/cmd.go.
- PollIntervalSec (5) moved to config/mcp/server/.
- Removed dead isVarDef helper from magic_values_test.go.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
…rors

Extract duplicated frontmatter splitting logic from steering/ and
skill/ into parse.SplitFrontmatter. Both callers now delegate to
the shared function and wrap errors with domain-specific context.

Delete 4 dead error constructors (MissingOpeningDelimiter,
MissingClosingDelimiter in err/steering and err/skill) and their
DescKey constants + YAML entries. Add new err/parser delimiter
constructors used by the shared function.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Replace 3 structurally identical memory/swap/disk check blocks
with a data-driven loop over a byteCheck slice. Same behavior,
less repetition.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
Rename isConsumerLayer → consumerLayer in cross_package_types_test.go
and isSyncableTool → syncableTool in steering/{format,sync}.go.
isNumeric was already removed during earlier migrations.

Persist session decisions and learnings.

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
…ge test usage

Remove the testOnlyExports allowlist entirely. Instead, add Phase
2.5 to TestNoDeadExports that loads packages with Tests: true and
removes symbols used cross-package in test files. A symbol imported
by a test in a different package is test infrastructure, not dead.

Also fix parser.findParser → parser.find (stuttery name) and move
to tools.go (mixed visibility).

Spec: specs/ast-audit-contributor-guide.md
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@josealekhine josealekhine self-assigned this Apr 4, 2026
@josealekhine josealekhine requested a review from bilersan as a code owner April 4, 2026 10:19
Signed-off-by: Jose Alekhinne <jose@ctx.ist>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Apr 4, 2026

Deploying ctx with  Cloudflare Pages  Cloudflare Pages

Latest commit: d35e98b
Status: ✅  Deploy successful!
Preview URL: https://c3b407ff.ctx-bhl.pages.dev
Branch Preview URL: https://feature-lint.ctx-bhl.pages.dev

View logs

@josealekhine josealekhine merged commit 7e41040 into main Apr 4, 2026
12 checks passed
@josealekhine josealekhine deleted the feature/lint branch April 4, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant