Skip to content

Minor perf improvements, parsing refactor + bug fixes - #27

Closed
wallstop wants to merge 69 commits into
masterfrom
dev/wallstop/better-docs
Closed

wallstop wants to merge 69 commits into
masterfrom
dev/wallstop/better-docs

Conversation

@wallstop

Copy link
Copy Markdown
Owner

No description provided.

wallstop added a commit that referenced this pull request Sep 9, 2026
…ontent validator (#22, T02) (#41)

## Summary

Aggregated session-002 work advancing
[PLAN.md](https://github.com/wallstop/DxCommandTerminal/blob/master/PLAN.md)
(local modernization action plan; session log:
`progress/session-002-history-dedup-tooling-hygiene-package-validator.md`,
local-only). Six coherent commits on top of #37.

## 1. Issue #20 — better history traversal de-duplication

`CommandHistory.Next/Previous(skipSameCommands)` now skip **any** entry
already shown during the current traversal direction, so non-adjacent
repeats are no longer re-displayed within one sweep (`[a, b, a]` yields
`a, b` instead of `a, b, a`). The seen set resets on
`Push`/`Clear`/`Resize` and on direction flips, so sweeping back replays
the passed entries bash-style. `skipSameCommands=false` traversal is
byte-for-byte unchanged. Data-driven red→green: 2 new tests failed
pre-change (16/18); full PlayMode suite 98/98 post-change on the live
editor.

## 2. Issue #39 — npm tooling under Unity-hidden `tooling~/`

Opening the repo as a local/embedded package no longer imports
`node_modules` or tooling scripts:

- `scripts/` moved wholesale to `tooling~/` (tilde-suffixed = invisible
to Unity); 21 tracked `scripts/**/*.meta` dropped.
- Root `package.json` keeps UPM fields plus **delegating npm scripts**
(`npm --prefix tooling~`), so `npm run unity:mcp:probe` / `npm test`
etc. are unchanged from the repo root.
- Path-resolution fixes for the new depth: linters/generator RepoRoot,
`unity-mcp.mjs` `REPO_ROOT` + `captureScriptSourcePath`,
`test-ai-backends.sh` fixtures, `env-and-capture` test, devcontainer npm
install + `dxt-node-modules` cache mount target, `.editorconfig` LF
group.
- CI/devcontainer/skills/context/docs updated; skills index regenerated.

## 3. Issue #39 — action SHA pinning + IgnoredTypes removal

- `actions/checkout` + `actions/setup-node` pinned to exact v6 SHAs with
version comments (Dependabot policy documented in `dependabot.yml`).
- `CommandShell.IgnoredTypes` (JetBrains.Rider sentinel) removed —
unreachable since the session-001 assembly-reference filter skips Rider
assemblies before any type reflection; equivalence sweep stays green.

## 4. Issue #22 + T02 — package-content validator (clean-install guard)

New Unity-free `tooling~/scripts/release/validate-package-contents.mjs`
packs the package exactly as npm/UPM consumers receive it and asserts:
manifest identity, required artifacts (README/LICENSE/CHANGELOG + metas,
all 3 asmdefs), no tooling/repo-internal leaks, and complete `.meta`
coverage with no orphans.

- **Red evidence**: without an allowlist, `npm pack` shipped
`tooling~/`, `.devcontainer/`, `.github/`, dotfiles, `doc.md`, agent
pointers (100+ errors).
- **Green**: root `package.json` gains the npm `files` allowlist → 1440
entries, all checks pass. Wired as an always-on `package-content` CI
job.
- Issue #22 grounding: the vendored `System.Collections.Immutable.dll`
was already removed by #32; the validator guards the general
clean-install property, not the stale diagnosis.

## 5. PR dispositions (issue #40)

#27 (typed parsers/completers/backend decomposition, rc24.7-era) and #29
(quick-launch bar) predate the approved plan and overlap plan tasks
T06/T08/T09/T10; both recorded in #40 with inventories. **Not closed** —
closing requires wallstop's confirmation (plan §2: no auto-close).

## Validation matrix

| Check | Result |
| --- | --- |
| PlayMode suite (Unity MCP, live editor 6000.4.6f1) | 98/98 passed |
| CommandDiscoveryTests (post sentinel removal) | 5/5 passed |
| node --test (via `tooling~` and root wrapper) | 32/32 passed |
| lint-llm-instructions + 21 regression tests | pass |
| lint-skill-sizes + 8 tests | pass |
| lint-unity-meta | 1616 files, 0 problems |
| test-ai-backends.sh | 106/106 passed |
| package:validate | 1440 entries, all checks pass |
| csharpier (changed C#) | pass |

## Notes for review

- Commit 3e4953f normalizes the last 3 LF-stored C# files to CRLF
(editorconfig convention; 50/52 were already CRLF) so the logic commits
carry no eol churn.
- The npm `files` allowlist is now the shipping truth for `npm pack`;
the new CI job catches drift (also feeds T14's release pipeline).
- Devcontainer note: the `dxt-node-modules` volume now targets
`tooling~/node_modules` — takes effect on next container rebuild.
- Closes nothing automatically; #40 documents the recommended PR
dispositions for #27/#29.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Touches terminal history UX and command discovery error handling; the
`tooling~/` relocation and npm `files` allowlist change how the package
is built and what ships—CI mitigates but devcontainer rebuilds need the
new `node_modules` path.
> 
> **Overview**
> **Runtime:** `CommandHistory` with `skipSameCommands` now tracks
commands already shown in the current up/down sweep and skips all
repeats (not only adjacent duplicates), resetting when direction flips
or history mutates. `CommandShell` drops the JetBrains.Rider
`IgnoredTypes` exception swallowing during command discovery.
> 
> **Packaging & tooling:** Repo npm/Node scripts move under Unity-hidden
**`tooling~/`** (with its own `package.json`); root `package.json` keeps
UPM fields, adds an npm **`files`** allowlist, and delegates scripts via
`npm --prefix tooling~`. Old `scripts/**` Unity `.meta` files are
removed. Devcontainer, pre-commit, CI path filters, and docs/skills
point at `tooling~/`.
> 
> **CI & release guard:** GitHub Actions `checkout`/`setup-node` pin to
commit SHAs (Dependabot note). **Tooling Tests** installs/tests under
`tooling~`; new **`package-content`** job runs `package:validate`, which
`npm pack`s the UPM artifact and asserts allowlist coverage, required
files/asmdefs, no repo-internal leaks, and complete `.meta` hygiene.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
abb8fc8. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@wallstop
wallstop marked this pull request as draft September 10, 2026 03:36
wallstop added a commit that referenced this pull request Sep 11, 2026
…54) (#57)

DISCLOSURE: LLM-GENERATED TEXT

**Why:**
Fresh maintainer asks #55 (warnings as errors, maximum warning level,
zero-dependency
static analyzers, silent console in normal operation) and #54
(user-facing-only
changelog), plus reviewer feedback during this PR. Master CI verified
green before
starting; draft PRs #27/#29 stay superseded per #40.

**What changed:**

- Per-assembly `csc.rsp` (`-warnaserror`, `-warn:4`) beside the Runtime,
Editor, and
Tests.Runtime asmdefs, shipped with the package; a per-assembly response
file replaces
  any project-level `csc.rsp` for these assemblies only.
- `Generator~/Directory.Build.props`: built-in Roslyn analyzers at
`AnalysisMode=All`
with analyzer diagnostics as errors; the generator-tests project keeps a
documented
NoWarn contract list for public-API-shape rules the additive-only plan
forbids changing.
- `CommandArg` parsing is culture-invariant (every culture-sensitive
`TryParse` pins
`NumberStyles` + `InvariantCulture`); same-type `Convert.ChangeType`
became direct
casts. The parsers now live in the new public `CommandArgParsers` class
(review ask).
- Console silence in normal operation: no log on default font/theme
selection; warnings
  only for real misconfiguration; theme persistence progress logs are
  Editor/development-build only.
- New `lint-multiline-comments.mjs` linter (pre-commit + CI + context.md
rule 21,
review ask): stacked `//` comment runs become block comments; 68 runs
swept.
- CHANGELOG purged to user-facing entries; policy in the file header and
context.md (#54).

**How we know:**

- Unity 6000.4.6f1: deliberate-warning drill failed with `CS0414` (rsp
honored), then
clean; PlayMode 192/192 after every change batch; console shows no
package-owned
  warnings in normal paths.
- Generator 0 warnings Debug+Release; 30/30 generator tests; shipped
payload
byte-compare OK. Node tooling 121 pass; meta/llm/csharp-style linters
and the
  package-content validator pass.

**Follow-ups opened:** #56 (caret-test frame timing), #58 (more built-in
argument
types), #59 (table-driven TryGet dispatch refactor).
wallstop added a commit that referenced this pull request Sep 12, 2026
…e hardening (#59 #58 #56) (#60)

DISCLOSURE: LLM-GENERATED TEXT

**Why:**

Closes #59 (table-driven `TryGet` dispatch), closes #58 (new built-in
argument types), addresses #56 (frame-timing-sensitive token-completion
caret tests). Master CI was green at 8917558; draft PRs #27/#29 stay
superseded per #40.

**What changed:**

- `CommandArg.TryGet<T>` dispatches through a static
`Type` -> strongly typed parser-delegate table (36 built-ins).
Precedence
unchanged (per-call override -> registered -> string -> named constants
->
table -> enum); culture invariance from #57 preserved; no public API
change.
- All composite parsers are now public per-type `CommandArgParsers`
methods
(`Vector2`..`RectInt`, `Color`, `Quaternion`) sharing one split helper.
- New built-in types: `Bounds`, `BoundsInt`, `RectOffset`
  (`RectOffset(left, right, top, bottom)` order), `Plane`, `Ray`,
  `System.Numerics.Complex`.
- `TerminalUI.ApplyPendingCaret` consumes the queued caret only once the
  write sticks on a focused pass: the panel can re-clamp a programmatic
caret write, so consume-on-first-write lost that race (fixes a real
caret
  regression found while hardening #56's tests).
- Token-completion UI tests: every post-`CompleteCommand` value/caret
read
  now polls with a bounded helper instead of one `yield return null`;
  unfocused marker behavior is pinned synchronously.
- Generator-test Unity shim gains Bounds/BoundsInt/RectOffset/Plane/Ray
  stubs so the Unity-free lane keeps compiling the real Runtime sources.
- `run-terminal-tests` skill gains UI-test polling rules and the
  domain-reload-clears environment note.

**How we know:**

- PlayMode 199/199 on Unity 6000.4.6f1 (192 prior + 7 new) on a fresh
  domain; filtered caret suites green on consecutive re-runs. The known
  editor poisoned-session mode (#56) still requires a domain reload to
  clear; the runbook is in the skill.
- Generator 30/30; shipped payload byte-compare OK. CSharpier, all three
  C# linters, meta lint, LLM-instructions lint, and node tooling (121)
  pass. CHANGELOG carries one user-facing Added entry.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Broad changes to core `CommandArg` parsing and shell/UI hot paths;
behavior is intended to stay equivalent but regressions would affect
every command argument and completion/caret timing.
> 
> **Overview**
> This PR tightens **runtime/editor performance and parsing** in one
pass: it **bans LINQ under `Runtime/` and `Editor/`** (new
`lint-linq-production` in CI and pre-commit) and rewrites call sites to
explicit loops, `CopyTo`, and caller-owned buffers so hot paths do not
pay for enumerators or throwaway collections.
> 
> **`CommandArg`** now dispatches built-ins through static parser tables
(generic and untyped), removing reflection from `TryGet(Type, out
object)` and folding composite parsing into public
**`CommandArgParsers`** methods. Six new built-ins are added:
**`Bounds`**, **`BoundsInt`**, **`RectOffset`**, **`Plane`**, **`Ray`**,
and **`Complex`**, with Unity `ToString()`-style labels accepted where
documented.
> 
> Supporting allocation work includes **`CachedStringBuilder`** for
repeated string assembly, **`CommandShell.ClearVariables()`** with a
cached key snapshot, **`CommandHistory.CopyHistory`** for completion,
and **`TerminalUIEditor`** caching of inspector popup/font-key arrays
across `OnGUI` redraws. **`TerminalUI.ApplyPendingCaret`** only clears
the pending caret once the write sticks while focused, addressing
frame-coupled completion/caret tests; the run-terminal-tests skill
documents bounded polling for UI reads.
> 
> Docs and **CHANGELOG** record the LINQ policy and parser additions;
the generator Unity shim grows stubs for the new geometry types.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
42f9b37. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@wallstop

Copy link
Copy Markdown
Owner Author

DISCLOSURE: LLM-GENERATED TEXT

Closing as superseded. This draft (Oct-Nov 2025, 514 files, last commit "Stuff") predates the modernization plan; its CI/tooling/docs scaffolding (markdownlint, lychee, prettier, doc-link linters, autofix workflows) was rebuilt differently by the modernization sessions, and its runtime/editor code conflicts with the ~100 commits landed since. Merging is no longer a coherent operation. Salvageable ideas, if wanted, should be re-filed as fresh issues (e.g. the TerminalRuntimeInspectorWindow diagnostics view) rather than resurrected from this branch.

@wallstop wallstop closed this Sep 20, 2026
@wallstop
wallstop deleted the dev/wallstop/better-docs branch September 20, 2026 21:17
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