feat: add entrypoint interface type to skip conformance symbol check (#1458)#1509
feat: add entrypoint interface type to skip conformance symbol check (#1458)#1509prompt-driven-github[bot] wants to merge 13 commits into
Conversation
…1458) Files that legitimately export nothing (e.g. React main.tsx, server entrypoints) were incorrectly failing architecture conformance with "declared symbols missing". This adds `entrypoint` as a first-class interface type that bypasses symbol validation, mirrors the existing page/component pattern, and updates docs and TypeScript types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
af62aae to
9e9bd42
Compare
The validator accepts six <pdd-interface> types (module, cli, command, frontend, config, entrypoint) but both prompting guides still said "five" and listed no Config example. Step 10 can emit `config` metadata, so the included guide must show that `config.keys` is required or the model produces metadata the validator rejects. - Bump "five" -> "six interface types" (format line + section intro). - Add a Config Interface example in validator order (between Frontend and Entrypoint) in both the root and packaged guides; bare-string keys match what step5/step10 emit for prompt configs, with a note that keys may be an empty array. Verified against validate_interface_structure and the step5/step10 include-preprocessing tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The PR added `entrypoint` to the frontend interface source prompt
(frontend/types_typescript.prompt) but the generated pdd/frontend/types.ts
(architecture.json maps it as generated from that prompt) was not
regenerated, leaving its ArchitectureInterface union stale by one token.
Append 'entrypoint' to match the source prompt's union order.
Also clarify the prompting-guide config example: config.keys are the
prompt's input/configuration variable names as plain strings (e.g.
issue_url), using prompt-variable example keys instead of env-var-looking
names that misread as the application-config schema.
Deliberately NOT changed (review findings assessed as taxonomy
conflation / out of scope):
- config.keys kept as bare strings, not objects. The object schema
({name,type,source}) belongs to the 10-type arch-gen interface system
(README/template/types.ts); the guide documents the 6-type prompt-tag
<pdd-interface> system. Its required source:'env'|'file'|'secret' is
invalid for a prompt input variable. pdd's own arch.json: 0 object,
3 bare-string, 111 empty config interfaces.
- AddModuleModal/ModuleEditModal: hand-written AI Studio scaffold, not
generated (absent from architecture.json), not production PDD Connect.
- examples/template_example architecture template: independent artifact
(335-line-different vocabulary), never a mirror of the packaged template.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Finding 2 (public-surface gate): sync_prompts_to_architecture and validate_architecture_modules are part of architecture_sync's real public API (imported+called by server/routes/architecture.py and commands/maintenance.py) but were absent from the new __all__, so the public-surface regression gate would not catch their removal. Add both to the source <pdd-interface> in architecture_sync_python.prompt (the prompt drives __all__ per requirement 21), to __all__, and to the architecture.json interface entry, with signatures copied verbatim from the definitions so the conformance gate passes. Finding 3 (spurious dependency): code_generator_main listed context/python_preamble.prompt as a <pdd-dependency>, but python_preamble is a context include (10+ prompts <include> it; it is never tracked as a dependency, and parse_prompt_tags deliberately excludes includes from dependencies). The path does not resolve under pdd/prompts, so validate_dependencies reported it missing. The prompt does not even <include> it. Remove it from the prompt and architecture.json. Finding 1 (entrypoint + stray nested object): WON'T FIX. The source prompt deliberately specifies that for entrypoint 'the type string alone is the signal, the nested-key check MUST be skipped'. The 'silent export loss' framing is circular: it treats a stray module.functions block as authoritative when the type field is authoritative, and the guard would not catch the actual mistake (a file wrongly typed entrypoint with no stray block). The validator is uniformly lenient (a module with a stray cli block is also accepted); singling out entrypoint contradicts that design. No generation path emits the contradiction (0 entrypoint entries exist; the template says omit sub-objects). Verified: dependency validation for code_generator_main clean (no missing); the two functions importable and in __all__; prompt/arch.json agree on both new entries (the dry-update drift is pre-existing in 3 other unrelated signatures, not introduced here); 485 passed across test_architecture_sync.py + test_code_generator_main.py. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Verification — full cloud suite green at
|
gltanaka
left a comment
There was a problem hiding this comment.
Blocking merge until the architecture metadata is synced.
The entrypoint change itself looks needed for #1458, but this branch leaves architecture.json stale for architecture_sync_python.prompt. A direct dry-run through the sync function still reports an update is pending:
update_architecture_from_prompt(
'architecture_sync_python.prompt',
prompts_dir=Path('pdd/prompts'),
architecture_path=Path('architecture.json'),
dry_run=True,
)
# success=True, updated=True, changes=['interface']The prompt now declares the current signatures, but the architecture.json entry still has the older interface metadata:
update_architecture_from_promptis missing thestories_dir: Optional[Path] = Noneandtests_dir: Optional[Path] = Noneparameters.sync_all_prompts_to_architecturestill declaresonly_files: Optional[set] = Noneinstead ofOptional[Set[str]] = None.register_untracked_promptsstill declaresonly_files: Optional[set] = Noneinstead ofOptional[Set[str]] = None.
Required change: update/sync the architecture_sync_python.prompt entry in architecture.json so the prompt metadata and architecture metadata agree. After the fix, the same dry-run should return updated=False for architecture_sync_python.prompt.
Verification I ran locally on this PR head:
conda run -n pdd pytest tests/test_architecture_sync.py tests/test_code_generator_main.py -q-> 485 passedconda run -n pdd python -m py_compile pdd/code_generator_main.py pdd/architecture_sync.pygit diff --check origin/main...HEAD
Addresses @gltanaka review: architecture.json's architecture_sync entry carried stale interface signatures, so a dry-run sync reported a pending update (changes=['interface']): update_architecture_from_prompt('architecture_sync_python.prompt', prompts_dir=Path('pdd/prompts'), architecture_path=Path('architecture.json'), dry_run=True) # was: updated=True Synced the entry from the source prompt (the canonical operation): - update_architecture_from_prompt: add stories_dir/tests_dir params - sync_all_prompts_to_architecture: Optional[set] -> Optional[Set[str]] - register_untracked_prompts: Optional[set] -> Optional[Set[str]] The same dry-run now returns updated=False. 3-line diff, no other entries touched. tests/test_architecture_sync.py + tests/test_code_generator_main.py -> 485 passed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@gltanaka addressed — thanks for the catch, you're right. Synced the
Your dry-run now returns update_architecture_from_prompt(
'architecture_sync_python.prompt',
prompts_dir=Path('pdd/prompts'),
architecture_path=Path('architecture.json'),
dry_run=True,
)
# success=True, updated=False3-line diff, no other Re-running the full Cloud Batch suite on the new head to keep the verification SHA current — will follow up with the result. |
|
✅ Cloud Batch re-run on the fixed head — green: (Image rebuild skipped — the metadata sync changed no image deps.) |
Summary
Adds
entrypointas a first-class architecture interface type so bootstrap files that intentionally export nothing, such asmain.tsxor server startup files, no longer fail architecture conformance with missing declared symbols.Closes #1458
Changes Made
entrypointsupport to architecture interface validation, architecture repair, TypeScript interface types, architecture templates, docs, and package docs.code_generator_mainconformance soentrypointfiles skip export-symbol validation like other non-module UI/bootstrap surfaces.<pdd-interface>signature checks with semantic Python annotation comparison, so equivalent spellings likeset/Set[str],Dict/dict, andOptional[T]/T | Nonedo not create false sync failures.code_generator_main, including defaults pluscompress,snapshot_context, andcompressed_context.architecture_syncwith__all__so public-surface regression checks protect real API while ignoring imported implementation helpers.entrypoint, annotation compatibility, prompt/source signature drift, and thearchitecture_syncpublic surface.PDD Sync Completion
The app-side
pdd syncrun did not land a generated commit: it failed while regeneratingcode_generator_mainwith an empty/unparseable public surface (post surface size: 0). I completed the sync work manually in this PR instead:architecture_syncprompt/source contract now dry-runs cleanly with no pending architecture update.code_generator_mainactive prompt interface now matches the runtime Python signature.code_generator_main.pyis non-empty and includescode_generator_main.Verification
PYTHONPATH=/tmp/pdd-empty-readline:. pytest tests/test_code_generator_main.py tests/test_architecture_sync.py tests/test_preprocess.py::test_changed_prompt_selected_includes_resolve -q— 485 passedpylint pdd/architecture_sync.py pdd/code_generator_main.py -Egit diff --check origin/main...HEADupdate_architecture_from_prompt('code_generator_main_python.prompt')reportsupdated=False