Skip to content

feat(map-checker): add baseline mode for CI - #37

Merged
zoeyrose merged 1 commit into
mainfrom
feat/map-checker-baseline
Nov 26, 2026
Merged

zoeyrose merged 1 commit into
mainfrom
feat/map-checker-baseline

Conversation

@zoeyrose

Copy link
Copy Markdown
Member

Requested by Zoey · project thread

Summary

The map checker's per-object checks don't run in any CI today, and a full headless scan exits 0 whatever it finds. Current content has about 5,400 findings, so a strict gate would fail immediately. This adds a baseline mode so content CI can block only new findings:

  • --write-baseline FILE writes the current findings to a JSON baseline, as counts per key.
  • --baseline FILE prints only the findings the baseline doesn't cover and exits 1 if there are any. It exits 2 when the baseline can't be read.
  • --baseline-root DIR sets the root for relative paths in keys. It defaults to --directory.

A key is the relative file path, severity and description with the X/Y coordinates removed. Moving an object therefore doesn't create a new finding, while adding another copy of an existing problem to the same file does. fixed results are ignored. Catalog diagnostics are never baselined, and the catalog gate stays strict.

Both modes purge map-checker.db before scanning. Without that, the cache replays findings for unmodified files, and definition findings pile up across runs: my repeated local scans grew from 16k to 27k findings. With the purge, two consecutive scans write byte-identical baselines.

The next step is a content CI job that builds the classic runtime, runs this checker at a pinned release, and compares against a committed baseline.

Validation

  • python3 -m unittest discover -s map-checker-qt/tests: 42 tests, including 6 new ones in tests/test_baseline.py.
  • python3 -W error -m compileall -q -f map-checker-qt
  • Full scan of a locally built classic runtime from atrinik/content@main: --write-baseline recorded 5,416 findings twice, with identical output, and --baseline against it printed No new map checker findings. and exited 0.
  • git diff --check

Generated by Claude Code

--write-baseline records the current findings and --baseline fails a
headless scan only on findings the baseline doesn't cover, so content CI
can block new problems without first fixing every existing one. Both
modes purge the scan cache to keep runs complete and repeatable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BPTYArGhoPqP7UdeUuUC5j
@zoeyrose zoeyrose self-assigned this Nov 26, 2026
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@zoeyrose
zoeyrose merged commit e36a878 into main Nov 26, 2026
6 checks passed
@zoeyrose
zoeyrose deleted the feat/map-checker-baseline branch November 26, 2026 00:53
zoeyrose added a commit to atrinik/content that referenced this pull request Nov 26, 2026
<!-- claude-projects-attribution: {"github_login":"zoeyrose"} -->
_Requested by **Zoey** · [project
thread](https://claude.ai/code/project/chan_01GqFGRfVxfKgHRxSgL4g4qr?thread=cmsg_01GqFGRfVxfKgHRxSgL4g4qr38thrxw4CAaXppYJEuqoHr)_

## Summary

Adds a `Map checker` job to `check.yml` so content PRs can't introduce
new map-checker problems:

1. Build the classic runtime with `tools/build_runtime.py --target
classic` into `build/map-checker-runtime`. No LFS checkout is needed.
2. Check out the Qt map checker from `atrinik/tools` at the revision
pinned in `MAP_CHECKER_REF`, then sync and verify its checksum-pinned
catalog.
3. Run a full scan with `--baseline tools/map-checker-baseline.json`.
The job fails on any finding the baseline doesn't cover.

`tools/map-checker-baseline.json` records the **5,416** findings that
exist on `main` today, so the gate starts green. Keys are
runtime-relative paths plus severity and description, without
coordinates, so moving objects doesn't trip it. Adding a new no-loot
NPC, or any other new problem, does. `AGENTS.md` now says to fix new
findings rather than baselining them, and how to regenerate the baseline
after fixing old ones.

The map checker is GPL-2.0-or-later and only runs as an external tool in
CI. Nothing from it is copied here.

## Dependencies

Pinned to `atrinik/tools@e36a878` (main, with
atrinik/tools#37 merged).

## Validation

- Local run of the exact job commands against a runtime built from this
branch: `No new map checker findings.`, exit 0. Two consecutive baseline
writes were byte-identical.
- `tools.tests.test_release_guidance`, `test_pr_metadata`,
`test_content_contracts` and `test_content_catalog` pass.
- `git diff --check`


---
_Generated by [Claude Code](https://claude.ai/code)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
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