Skip to content

feat(lint): migrate easyp lint to the easyprotoc compiler (milestones lint-easypc-infra + import-easyprotoc) - #258

Merged
ZergsLaw merged 327 commits into
mainfrom
feat/lint-easypc-infra
Nov 26, 2026
Merged

ZergsLaw merged 327 commits into
mainfrom
feat/lint-easypc-infra

Conversation

@onokonem

@onokonem onokonem commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Milestones on this branch: v1.0 lint-easypc-infra (7 phases) + v1.1 import-easyprotoc (4 phases) — both shipped and verified on the branch.

Final state: easyp lint runs on the easyprotoc compiler. v1.0 migrated lint from go-protoparser to the compiler + protoast model; v1.1 replaced the interim vendored copy with the public module github.com/easyp-tech/easyprotoc (pinned v0.0.0-20261104120806-f378f3f3a05f) and reconciled the branch with main #253, which already uses the same module in the breaking path. Output format, paths and exit codes stay byte-identical; only the three v1.0 rules (PACKAGE_NO_IMPORT_CYCLE, SYNTAX_SPECIFIED, FIELD_NOT_REQUIRED) and deterministic ordering are visible to users.

Status: all 11 phases verified passed (goal-backward verification, security threats_open: 0, nyquist validated). Final acceptance on the public module: 34-package -race battery green (0 FAIL, 0 races, one known environment skip), Gates A–D ×2, golden 94 byte-exact, both D-07 position gates, bin/golangci-lint run ./... = 0 issues., zero schema drift. Tag v1.1.

v1.1 import-easyprotoc (latest)

Phase 1: Merge main #253 + reconciliation

Merge commit 994c503 (parents: branch base → 5d36266). Blob-exact resolution of the three internal/core conflicts: breaking_profiles.go from origin/main (easyprotoc/protoc path), dom.go from the branch (Position = protoast.Position), core.go as the import union; lint contour byte-frozen, 9-file first-parent changeset. Full -race battery green on the merge tree.

Phase 2: Consumer swap + vendored tree removal

One atomic commit (5342455): consumer imports switched to the public packages (easyprotoc/protoc, easyprotoc/protoc/syntax, easyprotoc/parser), all 648 vendored files deleted (48 .go, 555 .proto, VENDORED.md, both cmd binaries), go mod tidy a no-op (pins unchanged, no replace/vendor).

Phase 3: Seal removal + docs + lint green

One docs commit (9320361): .golangci.yml exclusion, AGENTS.md sealed-vendor rule and three stale compiler citations removed; .spec documents the pinned module and the internal/protoast seam (D-07 rune columns). The pre-existing Session.Close errcheck (internal/sourceview/session_test.go) fixed at source in a separate test commit (6f52840) — lint goes to exactly 0 issues. without suppressions.

Phase 4: Acceptance on the module

Full v1.0 acceptance set re-proven on the final tree (6f52840): 34-package -race battery (the 7 vendored test packages are gone by design), Gates A–D ×2 vs 1e9a596, golden 94 byte-exact, D-07a/b, core/CLI matrices, lint 0 issues., schema drift 0, exact pins, empty live-surface seal grep.

Requirements: IMPORT-REC-01, IMPORT-DEP-01, IMPORT-CONS-01, IMPORT-VENDRM-01, IMPORT-SEAL-01, IMPORT-PARITY-01 — all complete.

v1.0 lint-easypc-infra

Goal: easyp lint runs on the compiler with byte-identical output, paths and exit codes — invisible to users except three new rules and deterministic ordering. Other subsystems untouched.

Phase 1: Vendor the compiler

Compiler + internal/protoast copied byte-verbatim from the lab @ 08cef10; zero new dependencies; lint/breaking read models split; rune-column position contract proven.

Phase 2: Linker + error routing

(*Core).linkSources three-outcome classifier + typed lintResolver seam; COMPILE remark class; exit codes 0/1/2 proven through the Action path.

Phase 3: Two-pass engine

LintLinked: parallel windows of 256, ModuleRule Collect/Finish for cross-file rules, deterministic total ordering, central suppression filter, lint.use validation parity.

Phase 4: Port all rules

All 41 registry rules ported with main-wins semantics in 6 batches; per-batch parity tests (53 cells, full-registry closure: 41 rules fire, 73→94 findings pinned); colocated tests keep main's literals.

Phase 5: Flip the lint path

One atomic commit: old lint path deleted, rename consolidation, class-1 COMPILE cells through Action — the single user-visible change point; rollback = git revert.

Phase 6: New rules + schema/MCP regen

Three new rules, verbatim lab ports, teeth-corpus parity; schemas + MCP descriptions updated atomically.

Phase 7: Acceptance

wazero v1.9.0 data race fixed (first full green -race ./...); acceptance gates A–D ×2 through baseline (1e9a596) + HEAD binaries; SC3 battery green.

Verification

  • Full -race ./... suite on the final tree: 34 packages, 0 FAIL, 0 races, one known environment skip (TestGenerateGoHeaderUsesCompilerVersion — protoc-gen-go absent), 3 no-test packages
  • bin/golangci-lint run ./...: exactly 0 issues. (fix at source, no suppressions)
  • Schema drift: empty (go run ./cmd/easyp schema-gen idempotent)
  • Acceptance gates A–D ×2 on the teeth corpus through baseline + HEAD binaries
  • Golden corpus: 94 findings byte-exact (every rule fires ≥1)
  • Lint parity unchanged after the module swap (golden/Gates/D-07 re-run; zero expectation edits)
  • Pins (easyprotoc v0.0.0-20261121194146-14f27ad9ce15, protobuf v1.37.0-rc.1); go mod tidy -diff empty; no replace/vendor
  • 32-bit builds: GOOS=linux GOARCH=arm GOARM=7 go build ./cmd/easyp ./cmd/easyp-mcp green (requires the upstream 32-bit lexer fix — see Follow-ups)
  • CI tests green, including the acceptance baseline oracle fetch in the shallow checkout
  • Corpora parity + perf measurement — pending_user_unblock (scripts committed-ready, see v1.0 backlog)
  • hadolint — Docker unavailable on the build machine (Dockerfile untouched)

Key Decisions

  • v1.1 supersedes vendoring: the compiler repo went public, so the module is consumed directly (same pin as the breaking path on main); no compiler code lives in this repo. Fixes go upstream via a version bump.
  • v1.0 vendored byte-verbatim from a pinned lab SHA as the interim approach (sealed, no in-tree edits) — historical, superseded by v1.1.
  • One atomic flip commit for the lint path switch — rollback = git revert.
  • Deterministic output ordering is an intentional strengthening (main's order was nondeterministic).
  • Corpora letters deferred with ready-to-fire scripts (conservative option, ratified).

Risks & Dependencies

  • Compiler pin is a pseudo-version (upstream has no tags yet); bump when tags appear. The unmerged upstream branch feat/easyp-integration (generation metadata, changes Link error semantics) is deliberately not taken — it belongs to the codegen series.
  • wazero pinned at v1.9.0 with easyp-side construction serialization; upstream upgrade needs separate verification.
  • Acceptance-corpora parity/perf on full scale completes after corpora access is provided.

Success Metrics & Release Criteria

  • Automated core green (this PR): full -race suite, lint 0 issues, schema drift empty, acceptance gates, golden 94, D-07
  • Release when corpora parity + perf gate complete after corpora unblock, and hadolint runs once Docker is available

Follow-ups (post-close)

  • Upstream 32-bit fix (easyprotoc PR add new rules #2): the pinned module's lexer compared len(src) with math.MaxUint32, which does not compile on 32-bit targets and broke the CI linux/arm7 cross-build (pre-existing on the branch, not caused by v1.1). The one-line uint64 fix is open upstream as easyp-tech/easyprotoc#2; this branch pins that commit (v0.0.0-20261121194146-14f27ad9ce15). Re-pin to upstream main once the PR merges.
  • CI baseline oracle: TestAcceptanceGates builds the v1.0 baseline from commit 1e9a596 and fails when absent; the workflow now fetches it explicitly by full SHA in the depth-1 checkout.

Milestone closeout notes

  • v1.1 archived under .planning/milestones/v1.1-*; tag v1.1 on the close commit.
  • One recorded closeout override: Phase 1/2 verification fingerprints read stale because Phase 3 edited covered files (one test-only errcheck fix; two comment-only files, proven by the comment-only diff gate). Behavioral acceptance was re-proven on the final tree by Phase 4 — no behavioral coverage lost.

- TestLintLinked with 7 named cells: determinism, D-01 sort order,
  COMPILE routing, central comment suppression both flag sides,
  ModuleRule lifecycle, per-file ignore_only, 8-file race matrix
- inert contract bindings in lint_model.go (rename-map header,
  LinkedFileInfo/LintRule/ModuleRule/Resolution/LinkedRuleName)
- additive Options.LinkedRules/Core.linkedRules/parsedImports in core.go
- RED evidence machine-validated: RED_EVIDENCE_OK (target_test_failed)
- LintLinked: walk -> parallel read pass -> linkSources -> linkedFiles
  wrap -> windowed (256) model build from linked trees via internal/
  parallel -> indexed serial drain in walk order -> ModuleRule.Finish
  -> D-01 total sort by (path, rule, line, col)
- lint_linked_read.go: readSource/protoInfoFromSource/
  protoInfoFromLinked (tree dropped after build)/linkedFilesFromImport/
  linkedFileFromImport/importCacheKey/cacheLintedOutline/parseOnTheirOwn
- lint_suppressions.go: protoast Comments/Owner walk + main-verbatim
  pairing machine with byte-identical error texts
- link.go additive: linkedFiles/linkedOutline/outline/resolution/
  usesThrough (mutex + sync.Once discipline)
- main-wins drain wrapper pin: fs.WalkDir: c.lintProtoInfoRead: %w
- all 7 TestLintLinked cells green under -race; package green
- fallback_missing_import_command_error: *OpenImportFileError under the
  exact fs.WalkDir: c.lintProtoInfoRead: main-wins prefix
- fallback_syntax_error_wrapper / fallback_read_error: same prefix pin
  for parse and pass-1 read failures, no COMPILE issues on the path
- fallback_rules_still_run: rules run on the parseable files of a
  fell-back corpus (LINT-ENG-03), drain aborts at the missing import
- fallback_outline_cache: sibling import served non-nil through
  linkedFileFromImport/cacheLintedOutline
- 12/12 TestLintLinked cells green under -race
…still_run

- recordingRule.Validate runs inside the parallel window, so observation
  order is scheduler-dependent; only Collect is walk-order serial
- assert.ElementsMatch replaces the order-sensitive assert.Equal that
  failed ~50% of -race runs (4/8 local runs before the fix)
- walk-order guarantee stays pinned by the module Collect assertion
- 16 named rows re-driving main's byte-identical suppression fixtures
  through LintLinked: the 9-cell EOF matrix, byte-exact directive error
  texts (path:line:column shape), policy independence both ways, and all
  three dialects (easyp:disable, nolint:, buf:lint:ignore) with legacy
  name validation
- messagePascalCase double mirrors rules.MessagePascalCase exactly (same
  regexp, top-level messages only) so oracle expectations carry over
- all rows green under -race; no engine divergence found in
  lint_suppressions.go
- config_ignore_walk_filter: Options.Ignore drops sub/ at the walk, rules
  never run there (recording double observes)
- ignore_only_dir_prefix: prefix semantics via IgnoreOnly option, finding
  outside the prefix survives
- ignore_only_finish_refilter: shouldIgnoreLinked applies to Finish output
- finish_comment_refilter: Finish findings on suppressed lines dropped
  under AllowCommentIgnores and kept without it (both sides of the flag)
- tab_directive_position_pin: suppression matches by line with a tab
  before the marker; directive-error column pinned to protoast's
  rune-based value (col 2) with the A4 byte-vs-rune divergence documented
  as a Phase 5 observable
- 21 parity rows green under -race
- repeated_runs_byte_identical: 5 in-process runs byte-identical (D-01 + indexed drain, ROADMAP criterion 1)
- race_shared_doubles_identity: shared stateless double instances, exact per-file rule/line counts under -race (criterion 4)
- collect_serial_walk_order: unsynchronized Collect recording slice equals walk order twice (D-03)
- ctx_cancel_surfaces: pre-cancelled context surfaces as context.Canceled
- walk_order_error_precedence: first walk-order syntax error wins (a_bad over z_bad)
- mixed_corpus_compile_isolation: COMPILE isolated to the erroneous file, rules skipped corpus-wide
- dep_file_diagnostic_through_engine: dep semantic error carries b.proto path, verbatim Ghost message
- compile_bypasses_suppression: A6/IN-02 pin — ignoreOnly, comment ignores and directives never filter COMPILE
- compile_deterministic_twice: multi-diagnostic corpus byte-identical across runs, D-03+D-01 sort composed
- TestLintUseValidationParity: 7 named cells pinning main's exact validation chain
- unknown rule/group/except/ignore_only names -> errors.Is core.ErrInvalidRule + exact validateConfigRuleNames: prefixes
- PACKAGE_NO_IMPORT_CYCLE 'is not implemented' special case pinned until Phase 6
- valid config constructs both engines with no second name validation; registry sanity cell
- test-only: zero production files changed
…dency

- Remove the internal/easypc lint path exclusion and its seal comment
- Replace the AGENTS.md sealed-vendor prohibition with the pinned-module rule and add internal/protoast to the Layout table
- Document the pinned github.com/easyp-tech/easyprotoc module and the internal/protoast D-07 seam in .spec/ARCHITECTURE.md and .spec/PACKAGES.md
- Repoint the three stale compiler citations in link_test.go, internal/protoast/build.go and package_no_import_cycle_test.go
- No behavior, schema or dependency changed
- Replace the bare deferred session.Close with t.Cleanup
- Report a non-nil close error through t.Errorf
- Fix the pre-existing errcheck finding at source (D-08)
- ROADMAP collapsed (v1.1 shipped line + backlog); phase artifacts archived under .planning/milestones/v1.1-*
- PROJECT evolved: v1.1 current state, validated capabilities, key decisions (module pin, branch topology, upstream branch deferral)
- MILESTONES records v1.1 with closeout override note (phase 1/2 fingerprints stale due to comment-only/test-only edits; behavior re-proven by Phase 4)
- REQUIREMENTS.md removed (archived as milestones/v1.1-REQUIREMENTS.md); tag v1.1 created locally
@onokonem onokonem changed the title feat(lint): migrate easyp lint to the vendored easypc compiler (milestone lint-easypc-infra) feat(lint): migrate easyp lint to the easyprotoc compiler (milestones lint-easypc-infra + import-easyprotoc) Nov 21, 2026
onokonem and others added 4 commits November 21, 2026 22:47
Upstream easyprotoc's lexer size guard compared len(src) against
math.MaxUint32, which does not fit a 32-bit int — the linux/arm7
cross-build failed to compile. Fix pushed upstream as
easyp-tech/easyprotoc PR #2 (one-line uint64 comparison, no behaviour
change on 64-bit).

Pin: v0.0.0-20261104120806-f378f3f3a05f -> v0.0.0-20261121194146-14f27ad9ce15

Verified: go build ./... (amd64 + linux/arm7), go vet, golangci-lint
0 issues, go mod tidy idempotent, full -race battery 34 ok / 0 FAIL /
0 race / 1 known skip.
TestAcceptanceGates builds the ratified v1.0 baseline binary from commit
1e9a596 and fails, by design, when the commit is absent. actions/checkout
fetches depth 1, so the gate could never pass in CI. Fetch the baseline
explicitly by full SHA (short SHA wants are rejected by upload-pack).

Verified in a depth-1 clone: fetch succeeds and git worktree add at the
baseline works.
…er code

Merge origin/main (easyprotoc v0.1.0, protobuf v1.36.12, bounded sourceview.Session, legacy breaking removal, core.Position) into feat/lint-easypc-infra and clean up the branch before merge:

- Remove temporary planning/agent files (.planning/, .claude/CLAUDE.md, .spec/features/lint-easypc-infra/, .gitignore and .agents/ tweaks)
- Remove branch-pinned oracle test (internal/api/acceptance_gates_test.go) and its shallow-fetch workaround in .github/workflows/tests.yml
- Remove dead go-protoparser helpers and phase-parity tests from internal/core (comment_suppressions.go, proto_comments.go, position_probe_test.go, position_parity_test.go, legacy dom.go and proto_info_read.go code)
- Update TestLinkSources non-local import case for easyprotoc v0.1.0 non-ErrFileNotFound error propagation
- Run go mod tidy against main's dependency pins
@ZergsLaw
ZergsLaw merged commit 42096ea into main Nov 26, 2026
1 check passed
@ZergsLaw
ZergsLaw deleted the feat/lint-easypc-infra branch November 26, 2026 21:51
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.

2 participants