Skip to content

Codex/phase1 dev tools - #7

Merged
qwqpap merged 2 commits into
mainfrom
codex/phase1-dev-tools
Aug 1, 2026
Merged

Codex/phase1 dev tools#7
qwqpap merged 2 commits into
mainfrom
codex/phase1-dev-tools

Conversation

@qwqpap

@qwqpap qwqpap commented Aug 1, 2026

Copy link
Copy Markdown
Owner

No description provided.

@qwqpap
qwqpap requested a review from Copilot August 1, 2026 09:28
@qwqpap
qwqpap marked this pull request as ready for review August 1, 2026 09:30
@qwqpap
qwqpap merged commit e8892ce into main Aug 1, 2026
1 of 2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces Phase 0/1 “formal contracts + pattern runtime” developer tooling: typed authoring resource envelopes/registry/migrations, a compiled immutable PatternProgram + fixed-tick PatternRunner that batch-spawns into the data-oriented bullet pool, and editor workbench infrastructure (plugin registry + asset browser) backed by new schemas and test coverage.

Changes:

  • Add pystg.pattern v1: PatternDocument validation, content-hashed compilation to immutable IR, and a deterministic fixed-tick PatternRunner that spawns via StageContext.create_bullets_batch.
  • Extend the formal runtime path with batch spawn + owner-tag operations (create_bullets_batch, translate_by_tag, clear_by_tag) and add benchmark + parity/runtime tests.
  • Add Phase 0 authoring contracts: typed resource header, resource references, registry/migrations, coordinate & time contracts; wire editor workbench plugins and a resource browser panel.

Reviewed changes

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/benchmark_pattern_runtime.py Adds a benchmark script for PatternRunner batch-spawn throughput (M1 gate measurement).
tests/test_pattern_runtime.py Adds unit tests for PatternRunner lifecycle, scheduling, determinism, owner isolation, and runtime errors.
tests/test_pattern_parity.py Adds parity tests ensuring preview and gameplay consume identical compiled programs and traces.
tests/test_pattern_document.py Adds PatternDocument schema/round-trip/resource-store tests and compile budget checks.
tests/test_pattern_compiler.py Adds compiler parity, caching, resource resolution, diagnostics, and alias dependency tests.
tests/test_editor_workbench.py Adds tests for plugin registry behavior and external plugin constraints.
tests/test_editor_scene_commands.py Updates undo/redo expectations for new coordinate defaults.
tests/test_editor_resource_browser.py Adds tests for asset list model filtering/drag payload and viewport drops / resource assignment.
tests/test_editor_node_registry.py Adds tests for the new NodeTypeRegistry registration/validation/compiler hooks.
tests/test_editor_documents.py Updates scene document tests for symbol_name + coordinate/timebase properties.
tests/test_editor_asset_index.py Adds tests for asset indexing, atlas subresources, typed resource classification, and error reporting.
tests/test_editor_app_smoke.py Updates smoke test expectations for new default positions/undo behavior.
tests/test_devtools_pattern_lab.py Switches preview runtime to PatternPlayback (formal runner) and adds batch-spawn enforcement test.
tests/test_authoring_resources.py Adds typed authoring resource envelope/registry/migration/reference tests across initial resource types.
tests/test_authoring_coordinates.py Adds CoordinateSpace and Timebase contract tests (round-trip + viewport scaling invariance).
tests/conftest.py Adds session-scoped QApplication guard to stabilize Qt teardown across tests.
src/pattern/runtime.py Implements PatternRunner, tick/advance lifecycle, owner-tag operations, and batch spawn integration.
src/pattern/ir.py Defines immutable PatternProgram and BurstTemplate IR consumed by the runtime.
src/pattern/document.py Implements PatternDocument v1 with strict validation, dict serialization, and PatternSpec import.
src/pattern/compiler.py Implements PatternCompiler: resource resolution, deterministic template precompute, diagnostics, and caching.
src/pattern/init.py Exposes the new pattern authoring/compiler/runtime API surface.
src/game/stage/context.py Adds StageContext batch bullet spawning and owner-tag clear/translate helpers.
src/game/bullet/optimized_pool.py Adds OptimizedBulletPool batch spawn + owner-tag clear/translate and tracking for batch spawn calls.
src/editor/workbench.py Introduces editor workbench plugin descriptors + registry, including external plugin definitions.
src/editor/resource_browser.py Implements the resource browser panel (thumbnails, filtering, drag payload export).
src/editor/node_types.py Reworks node/property/type definitions into registries with viewport specs, constraints, and metadata.
src/editor/document.py Aligns scene document validation/migration with typed resource headers and adds coordinate/timebase helpers.
src/editor/asset_index.py Adds project asset scanning/indexing including atlas sprite/animation subresources and typed resource validation.
src/editor/app.py Wires workbench plugins, resource drag/drop into viewport, subresource previews, and central/bottom tab workbench.
src/editor/init.py Exports new node type registry types (NodeTypeRegistry/NodeTypeSpec/ViewportSpec).
src/devtools/pattern_runtime.py Updates PatternPlayback to run the formal PatternRunner instead of per-burst per-bullet spawning.
src/authoring/storage.py Adds ResourceStore for typed authoring resources with atomic persistence.
src/authoring/resources.py Adds typed resource envelope contracts, reference parsing/resolution, and common validation helpers.
src/authoring/registry.py Adds ResourceTypeRegistry and default resource type registration (including pattern compiler contribution).
src/authoring/migrations.py Adds MigrationRegistry with explicit step-by-step schema routing and legacy scene v0→v1 migration.
src/authoring/coordinates.py Adds CoordinateSpace and Timebase conversion contracts for editor/runtime parity.
src/authoring/init.py Exposes authoring contracts API (resources/registry/migrations/coordinates/storage).
README.md Links new authoring and pattern resource contract documentation + editor roadmap.
docs/schemas/pystg-scene-v1.schema.json Extends scene schema with symbol_name validation.
docs/schemas/pystg-resource-envelope-v1.schema.json Adds shared authoring resource envelope schema (draft 2020-12).
docs/schemas/pystg-pattern-v1.schema.json Adds PatternDocument v1 JSON schema.
docs/PATTERN_RESOURCE_CONTRACT.md Documents the M1 pattern data flow, v1 fields, compilation diagnostics, and runner behavior.
docs/EDITOR_ROADMAP_TODO.md Adds detailed phased editor roadmap and completion log (M0/M1 gates).
docs/EDITOR_ARCHITECTURE.md Updates architecture notes to reflect typed authoring contracts, registries, and coordinate/time rules.
docs/AUTHORING_RESOURCE_CONTRACTS.md Documents M0 authoring resource envelope/reference/migration/coordinate/time/registry contracts.
AGENTS.md Adds repository-wide agent working rules aligned with the editor roadmap and verification baseline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/game/stage/context.py
Comment on lines +378 to 381
def clear_bullets_by_tag(self, tag: int) -> int:
"""按标签消除所有子弹"""
self.bullet_pool.clear_by_tag(tag)

Comment thread src/authoring/storage.py
Comment on lines +29 to +32
def load(self, path: str | Path) -> Any:
source = self._path(path)
data = json.loads(source.read_text(encoding="utf-8"))
return self.registry.load(data)
Comment on lines +472 to +478
# Formal pattern batches never install per-bullet callbacks. Clear any
# stale sparse state defensively if a legacy path reused these slots.
for idx in use_indices.tolist():
self.death_handlers.pop(int(idx), None)
self.polar_motions.pop(int(idx), None)
self.emitter_callbacks.pop(int(idx), None)
return use_indices
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