Skip to content

Tier 2 deploy hardening + Save-a-Copy converter fix#42

Open
kirkabowman wants to merge 6 commits into
petrowsky:mainfrom
kirkabowman:feat/tier2-deploy-hardening
Open

Tier 2 deploy hardening + Save-a-Copy converter fix#42
kirkabowman wants to merge 6 commits into
petrowsky:mainfrom
kirkabowman:feat/tier2-deploy-hardening

Conversation

@kirkabowman
Copy link
Copy Markdown

Summary

  • Hardens agent/scripts/deploy.py --tier 2 against silent failure modes that surface during real-world bulk deploys: hidden target files, prefix-collision in file names (A2X_GeneralA2X_General_data), cross-file Script Workspace context, missing fmextscriptaccess privilege, tabs not switching after MBS OpenScript, locked sibling files aborting AppleScript probes.
  • Adds a pre-flight privilege probe that surfaces -10004 with an actionable message, and a post-deploy verification step that confirms the paste landed in the right SW + tab + step count.
  • Adds a Show-Window submenu fallback so hidden target files are unhid before deploy, anchored window-title matching (no more prefix collisions), and a fail-fast tab-click guard that aborts when no SW tab matches the target script.
  • Fixes a silent data-loss bug in agent/scripts/fm_xml_to_snippet.py: Save a Copy as XML was dropping its destination path (UniversalPathList) and the analysis-tools flag (flagBoolean). Adds hand-coded tx_save_copy_as_xml translator.
  • Patches the install template (filemaker/agentic-fm.xml) so new installs ship with the corrected Agentic-fm Paste (Open Script Workspace + 3× ExpandScriptFolders before OpenScript). Without this, fresh installs hit the collapsed-folder bug whenever the target script lives in a folder.
  • New agent/docs/TIER2_DEPLOY.md documents prerequisites, real-vs-sanitized name resolution, bulk pipefail discipline, the failure-mode table, and AppleScript debug snippets.
  • Updates .claude/CLAUDE.md step 7 to reference TIER2_DEPLOY.md before any Tier 2 deploy.

Compatibility with existing PRs

This PR overlaps two open PRs on this fork:

Test plan

  • Deploy a script to a hidden file via Tier 2 — auto-unhide via Show Window submenu
  • Deploy to A2X_General specifically (not A2X_General_data) — anchored matching prevents prefix collision
  • Deploy to a script in a collapsed folder — ExpandScriptFolders (in patched install template) unblocks it
  • Deploy with a non-Full-Access account in target file — pre-flight returns -10004 with actionable error
  • Deploy with the wrong target script name — fail-fast guard reports "no SW tab matching" instead of clobbering
  • Convert a script using Save a Copy as XML via fm_xml_to_snippet.py — destination path + Option flag preserved
  • Verify post-deploy step count check rejects a misrouted paste

🤖 Generated with Claude Code

Kirk Bowman and others added 6 commits April 24, 2026 16:54
- analyze.py: change glob() to rglob() so folder-nested CFs are found;
  filter out folder separator pseudo-files via stub XML existence check;
  add folder_path to CF data and index loader
- fmcontext.sh: fix sanitized body path lookup to be subfolder-relative
  (flat lookup silently missed nested CFs, misclassifying all as functional);
  add FolderPath as 7th column to custom_functions.index header and output;
  replace mapfile with while-read loop for bash 3.2 compatibility on macOS
- build_cf_names: use rglob instead of iterdir so custom functions
  nested inside folder-group subdirectories are discovered
- parse_scripts: extend bracket guard to include lines with ']' so
  zero-argument CF calls on expression-continuation lines are not skipped

Made-with: Cursor
Hardens deploy.py --tier 2 against the silent failure modes that surface
during real-world bulk deploys (hidden target files, prefix-collision in
file names, cross-file Script Workspace context, missing
fmextscriptaccess privilege, tabs not switching after MBS OpenScript) by
adding a pre-flight privilege probe, a post-deploy verification step, a
Show-Window submenu fallback for hidden files, anchored window-title
matching, and a fail-fast tab-click guard. Fixes a silent data-loss bug
in fm_xml_to_snippet.py where Save a Copy as XML dropped its destination
path and analysis-tools flag, and patches the install template
(filemaker/agentic-fm.xml) so new installs ship with the corrected
Agentic-fm Paste (Open Script Workspace + 3x ExpandScriptFolders before
OpenScript) needed for deploys to scripts in collapsed folders.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The original commit added pre-flight + post-deploy verification but the
fail-fast tab-click guard inside _paste_applescript was missing — when
no Script Workspace tab matched the target script (because MBS OpenScript
silently failed, or the wrong file's SW was frontmost), the AppleScript
silently fell through to the keystroke paste sequence and clobbered
whatever tab had focus. Now Phase 2 returns "ERROR: no SW tab matching"
before any paste keystroke, and _tier2 surfaces it as success=False.

Caught when "Get Text Embedding" deploy clobbered Agentic-fm Paste in
A2X_General because A2X_General_data was hidden and the Show Window
fallback hadn't yet brought it forward when Phase 2 ran.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Same lost-edits pattern as the previous fail-fast commit. The
_switch_to_document helper (and its inline duplicate in _tier3) was
still using `whose name contains "X"` for Window menu matching, which
collides on prefixes (e.g. "A2X_General" matches "A2X_General_data") and
returns nothing for hidden files. Restored:

- Anchored matching: `name is "X" or name starts with "X ("` so
  "A2X_General" never picks "A2X_General_data" or vice versa.
- Excludes "Script Workspace " prefixed entries which sort first and
  would be picked instead of the database window.
- Show Window submenu fallback: when no visible window matches, click
  the matching entry in Window > Show Window submenu to unhide before
  proceeding.

Caught when "Get Text Embedding" deploy to A2X_General_data (hidden)
returned ERROR from the new fail-fast guard — fix here unhides the
target file so MBS OpenScript can route correctly.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Promotes four recurring-mistake rules from Claude-Code-specific personal
memory into project-shared agent-instructions doc, so any AI tool
(Cursor, Copilot, Aider, Codex CLI, etc.) inherits them via the four
agent-instructions symlinks:

- Use FM Script Workspace step row numbers, not HR .txt line numbers
  (with awk one-liner for converting HR line → FM row)
- Always resolve real script names from scripts.index — sanitized
  filenames strip ':' and '|'
- "Perform Script — Specified: From list" is the hardcoded variant
- '# (comment)' steps support multi-line text

Adds a warning to CONVERTERS.md about tx_generic silently dropping
unhandled param types (flagBoolean, text-typed UniversalPathList) — the
class of bug that hid the Save a Copy as XML data loss for years. Bumps
the hand-coded translator count from 48 to 49.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@kirkabowman kirkabowman force-pushed the feat/tier2-deploy-hardening branch from ead9848 to ed53906 Compare April 29, 2026 05:24
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