Skip to content

fix(brief): generalize member-surface write-path doctrine - #1137

Closed
ICGNU3 wants to merge 2 commits into
kunchenguid:mainfrom
ICGNU3:lane/brief-doctrine-generalized
Closed

fix(brief): generalize member-surface write-path doctrine#1137
ICGNU3 wants to merge 2 commits into
kunchenguid:mainfrom
ICGNU3:lane/brief-doctrine-generalized

Conversation

@ICGNU3

@ICGNU3 ICGNU3 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Bridges the no-mistakes heredoc parse failure that opened the brief-doctrine-generate-and-repair session, and generalizes fm-brief.sh so the same shape works for member-surface write-path tasks instead of just brief edits.

Sourced from session fm-brief-heredoc-fix-v0 + fm-dispatch-config-review-v0.
Two commits: one for the generalized doctrine (bin/fm-brief.sh supports a member-surface write-path template), one for the heredoc wording fix (apostrophe escape).

ICGNU3 added 2 commits July 26, 2026 22:56
Replaces the possessive 'firstmate's authority check' on bin/fm-brief.sh:328
with neutral wording 'the firstmate authority check'. The possessive apostrophe
sat inside a $(cat <<EOF ... EOF) command substitution; Bash's lexer tracks
quote state through the heredoc body while scanning for the matching ')' of
the command substitution, so the unescaped apostrophe left the lexer in the
wrong quote state and produced an 'unexpected EOF while looking for matching )'
parse error at the file level. The whole script failed to parse, which made
every downstream test in tests/fm-brief.test.sh fail to execute.

This was a pre-existing failure on origin/main commit 34213e6 and on the
post-merge commit a5fe1bc. The lane A doctrine addition did not introduce
it; that diff is text-only and adds no quote/paren/quote-state change.

VERIFICATION
- bash -n bin/fm-brief.sh passes.
- tests/fm-brief.test.sh: 15 ok / 0 not-ok, exit 0 (was 1 before the fix).
- The lane A generalized branch (lane/brief-doctrine-generalized) becomes
  shippable after this fix because its parse failure was the only blocker.
- The two earlier write-path lanes (lane/brief-member-surface-doctrine and
  lane/brief-doctrine-generalized) are unaffected by this wording change;
  they add different lines.

Refs: data/fm-brief-heredoc-fix-v0/report.md scout report
Replaces the project-specific reference (SITE_WRITE_PATH_MANDATE.md when the
project is rhizprotocol) in the doctrine bullet with a project-agnostic hedge
that points to whatever write-path mandate the project defines, if any.

CAPTAIN NOTE
- Resolves the cross-project template boundary concern from the original
  lane A: firstmate's shared template no longer names a single project
  for the write-path mandate. The doctrine is a project-agnostic standing
  rule; each project that wants to bind it documents its own mandate in
  its own tree.
- Standing rule and Acceptance test bullets are unchanged in meaning.

VERIFICATION
- bash -n on bin/fm-brief.sh fails on this branch (and on origin/main)
  because the upstream text 'lanes'' inside the scout-brief heredoc body
  opens an unterminated single-quote context within $(cat <<EOF ...). The
  8 added lines are pure text with no quote/paren/quote-state change, so
  this lane does not introduce the parse failure. A separate scout task
  will characterize the upstream fix.

Refs: firstmate-cleanup 2026-07-26 lane A generalized

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51e5cb30d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/fm-brief.sh
$HERDR_SECTION

# Doctrine (non-negotiable)
- **Standing rule (member surfaces).** Creating a member surface is a call to the product's write path, never a new module, component, route, or seed script. Terminal requests are not an exemption. See the project's own write-path mandate (e.g. docs/operational/SITE_WRITE_PATH_MANDATE.md) if the project defines one.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Scope the member-surface doctrine to matching tasks

Captain, every scout and ship brief now receives this non-negotiable product rule, even when the selected repository has no such write-path mandate or legitimately implements a member-facing feature as a route or component. Because fm-brief.sh cannot inspect the later {TASK} text or project architecture, the unconditional instruction can override the actual task and steer unrelated projects toward an invalid implementation; make this task-specific or opt-in instead of part of both default scaffolds.

AGENTS.md reference: AGENTS.md:L448-L450

Useful? React with 👍 / 👎.

@ICGNU3

ICGNU3 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

Closing this in favor of #1163, which fixes the macOS parse bug without dropping the pinned contract text.

This change breaks the ask-user authority contract test. Verified on this branch:

fm-ask-user-authority.test.sh  8 ok, 1 fail
  not ok - generated implementation brief permits silent ask-user auto-resolution
fm-brief.test.sh              15 ok, 0 fail
fm-tangle-guard.test.sh         6 ok, 0 fail

tests/fm-ask-user-authority.test.sh asserts the generated brief contains the exact sentence:

silently bypass firstmate's authority check and any required captain escalation

This PR rewrites that section and removes the sentence, but touches only bin/fm-brief.sh and no test file, so the assertion fails.

That assertion was added in #945 alongside the text, which reads as deliberate: the brief wording is a contract, not incidental prose.

Side effect worth naming. Removing that line also removes the apostrophe in firstmate's, which happens to fix a separate bug: bash 3.2 mis-scans a bare apostrophe inside a heredoc nested in $( ), so bin/fm-brief.sh has not parsed under stock macOS bash since #945. CI is Linux bash 5, where the file is valid, so it is invisible from CI while brief scaffolding is completely dead on macOS.

#1163 fixes that directly by interpolating the apostrophe through $APOS, leaving the generated text byte-identical and fm-ask-user-authority at 9/9.

If the doctrine generalization here is still wanted, it should land on top of #1163 with the contract assertion updated in the same commit.

@ICGNU3 ICGNU3 closed this Jul 28, 2026
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