LearnNewsExamplesServices
Frontmatter
id13896
titleCatch block-format drift in same-line declarations
stateClosed
labels
bugdeveloper-experienceaibuildmodel-experience
assigneesneo-gpt
createdAtJun 23, 2026, 1:21 AM
updatedAtJun 23, 2026, 1:52 AM
githubUrlhttps://github.com/neomjs/neo/issues/13896
authorneo-gpt
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtJun 23, 2026, 1:52 AM

Catch block-format drift in same-line declarations

Closed v13.1.0/archive-v13-1-0-chunk-5 bugdeveloper-experienceaibuildmodel-experience
neo-gpt
neo-gpt commented on Jun 23, 2026, 1:21 AM

Context

Follow-up from operator review on PRs #13885 and #13888. The requested changes were formatting-only, and the operator explicitly asked to use the repo linter/formatter rather than manually hand-align the blocks. Running the existing block-alignment tool on every changed .mjs file in both PRs produced no changes and check mode stayed clean.

Release classification: boardless - tooling follow-up from formatting-only review feedback; non-release-blocking unless the operator explicitly elevates it.

Live latest-open sweep: checked the latest 20 open issues at 2026-06-22T23:20Z; no equivalent open ticket found. Scope-specific live sweeps for check-block-alignment declaration formatting and block alignment linter same-line declaration returned no open duplicates. A2A in-flight sweep checked the latest 30 messages; no competing claim for this linter gap. Local/KB duplicate sweep found the existing formatter lineage (#13556, #13563, #13670, #13720) but no ticket for this missed same-line declaration/call formatting shape.

The Problem

buildScripts/util/check-block-alignment.mjs successfully covers the already-mechanized basics: import from alignment, object-literal colon alignment, and = alignment inside the explicit lone-keyword comma-block shape. It does not currently catch at least one formatting shape that still blocks PR review: same-line declaration/call expressions and block-opening declarations that the house style expects to be normalized but the tool treats as clean.

Empirical reproduction from this session:

  • On branch codex/13886-sunset-handover-boot, ran node ./buildScripts/util/check-block-alignment.mjs --fix ai/daemons/orchestrator/scheduling/summary.mjs ai/daemons/wake/queries.mjs test/playwright/unit/ai/daemons/orchestrator/scheduling/summary.spec.mjs test/playwright/unit/ai/daemons/wake/queries.spec.mjs; exit 0, no diff.
  • Then ran check mode on the same files; exit 0.
  • On branch codex/13879-ollama-residency-convergence, ran node ./buildScripts/util/check-block-alignment.mjs --fix ai/services/graph/providerReadinessHelper.mjs test/playwright/unit/ai/scripts/runners/runSandman.spec.mjs; exit 0, no diff.
  • Then ran check mode on the same files; exit 0.
  • Both PRs remained under operator CHANGES_REQUESTED for block-formatting issues, while Grace had approved the content.

This recreates the original #13556 friction pattern in a narrower form: a human still has to catch formatting drift the tool is supposed to mechanize, and agents are explicitly forbidden from resolving it by hand when the formatter contract should own it.

The Architectural Reality

buildScripts/util/check-block-alignment.mjs documents its supported alignment groups at lines 14-22 and implements the declaration alignment only for a lone const / let / var comma-block. collectAssignmentRuns() intentionally ignores separate same-line declarations and excludes block-opening values from = alignment.

.github/CODING_GUIDELINES.md rule 2 points to block formatting via colon alignment, rule 7 applies block formatting to imports, and rule 32 says variables use block formatting. The current script only covers a conservative subset of that house style, so review feedback can still identify valid formatting drift that the tool cannot see.

The Fix

Extend the existing block-alignment lint/formatter rather than hand-formatting individual PRs:

  • Add a narrowly-scoped detector/fixer for the same-line declaration/call formatting shape that appeared in #13885 and #13888, or explicitly codify why that shape is outside the formatter contract and create the smaller enforceable contract.
  • Preserve the existing conservative grouping principle: no broad reflow, no unrelated statement alignment, no template-string rewrites, and no false-open behavior in staged mode.
  • Add focused unit coverage that fails on the current missed shape and passes after the new rule.
  • Keep --fix and check-mode behavior symmetric: if review expects the shape to be corrected mechanically, check mode must report it and --fix must repair it.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
check-block-alignment.mjs --fix .github/CODING_GUIDELINES.md block-formatting rules + #13556/#13563 formatter lineage Mechanically repairs the review-blocking same-line declaration/call formatting drift If the shape is intentionally out of scope, document that boundary and keep PR feedback out of formatter expectations JSDoc / tests Unit fixture reproducing #13885/#13888 drift
Check mode / lint-staged package.json lint-staged block-alignment hook Reports the same drift that --fix can repair, scoped to staged-added lines under --staged Fail closed on diff detection failure, matching #13720 Test names / PR body Unit + staged-mode coverage
Template/string safety #13670 template-literal mask fix New rule must not touch template literal content or prompt JSON Existing mask remains authoritative Regression test Template literal non-rewrite test

Decision Record impact

None. This extends an existing build utility and formatter contract; no ADR impact expected.

Acceptance Criteria

  • A focused fixture representing the PR #13885 / #13888 missed formatting shape fails under the current checker and passes after the fix.
  • node buildScripts/util/check-block-alignment.mjs --fix <fixture-or-temp-file> rewrites the missed shape into the accepted block-format form.
  • Check mode reports the same drift when --fix is omitted.
  • --staged mode still scopes reports to staged-added lines and fails closed when added-line detection fails.
  • Existing import from, object-colon, comma-block =, and template-literal safety coverage remains green.
  • The PR body names the exact shape that was added to the formatter contract, or explicitly narrows the formatter contract if the accepted style requires a different follow-up.

Out of Scope

  • Manual formatting in PR #13885 or #13888.
  • A broad pretty-printer or whole-file reflow tool.
  • Replacing Neo's block-formatting style with Prettier/ESLint defaults.
  • Changing the semantic content of the blocked PRs.

Avoided Traps

  • Do not make the formatter align unrelated consecutive declarations just because they are adjacent.
  • Do not reintroduce the #13670 template-string corruption class.
  • Do not make --staged silently pass when git diff parsing fails.
  • Do not solve this by adding review-only prose; the point is to remove hand-formatting from the loop.

Related

Related: #13556, #13563, #13670, #13720, PR #13885, PR #13888

Origin Session ID: db5b2ecf-db91-4b7d-9498-ccef00426a1c

Handoff Retrieval Hints: check-block-alignment same-line declaration call formatting linter gap; PR 13885 13888 block formatting request changes formatter no diff

tobiu referenced in commit d00662f - "fix(build): catch declaration alignment drift (#13896) (#13897)" on Jun 23, 2026, 1:52 AM
tobiu closed this issue on Jun 23, 2026, 1:52 AM