Skip to content

refactor(scripts): render the inputs table as a generated region - #509

Merged
Vivswan merged 1 commit into
mainfrom
refactor/inputs-table-region
Oct 6, 2026
Merged

Vivswan merged 1 commit into
mainfrom
refactor/inputs-table-region

Conversation

@Vivswan

@Vivswan Vivswan commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #507.

What this changes

before: <!-- action-docs-inputs source="action.yml" -->      action-docs renders action.yml into the page;
        ## Inputs                                            regionProblem() (60 lines) guards the region by hand
        | name | description | required | default |
        ...
        <!-- action-docs-inputs source="action.yml" -->

after:  ## Inputs
        <!-- BEGIN GENERATED: inputs-table (bun run build:inputs-table; derived from INPUT_DECLS in src/flows/inputs.ts) -->
        | name | description | required | default |          GeneratedRegion.of: render from INPUT_DECLS, parse
        ...                                                  rows back, the round-trip seal refuses anything else
        <!-- END GENERATED: inputs-table -->

How

  • One more region: gen-inputs-table.ts declares inputs-table under ## Inputs and drives it through the region driver, like every other table.
  • Same bytes: every table line is identical to action-docs's output, <p> wrapper and "" default included; only the marker lines changed, and the heading moved above the BEGIN marker.
  • The seal replaces the hand-written guard: a moved marker, an authored row, or a < in a description is refused naming the line.
  • action-docs goes: the region needs a synchronous render and a parse, which the async, file-writing package cannot give, and the table is one renderTable call.

Proof

  • Regenerated output: every generator in generated.ts run, git status clean for every generated path; the build:check runner test passes.
  • Tests: gen-inputs-table and generated test files: 9 pass.
Technical details
  • Marker lines changed on docs/reference/inputs.md, by hand, as the page's own text: two action-docs markers became the BEGIN/END pair, and ## Inputs with its blank line sits above the BEGIN marker.
  • generated.ts: the inputs-table row is unchanged; the dependency note "action.yml feeds the inputs table" goes, since the table reads INPUT_DECLS directly.
  • Deleted tests: the marker-count cases (regionBounds refuses those generically, pinned in generated-regions.test.ts) and the linear-time test over a 5000-cell row (the per-row regex it guarded is gone; rows split with String.split).
  • Kept fixtures: the one-cell line, the two-column table, and the bare four-cell row, each refused by the seal naming its line.
  • New refusal: a < in a description fails the generator naming the input, where test/docs/inputs.test.ts used to catch it after the fact.
  • Deleted test: test/docs/inputs.test.ts restated the generator's rendering; its ASCII pin duplicates the typography gate and its "|" and "<" loop duplicates the generator's refusals.
  • Renamed in prose: docs/README.md's Inputs bullet, the two src/flows/inputs.ts comments, and the auto-fix.yml header comment name the generated region instead of action-docs.
  • Library: action-docs dropped from devDependencies, since it renders asynchronously from a file and writes the page itself, so it cannot give the sync render and parse the region seal needs; the table is one renderTable call, nothing added.
  • Review: two rubber-duck rounds with codex, both clean.
  • Accounting (git diff --numstat): gen-inputs-table.ts +79/-90, its test +45/-67, generated.ts +2/-3, generated.test.ts +4/-7, docs/inputs.test.ts -38, inputs.md +3/-3, docs/README.md +1/-1, src/flows/inputs.ts +5/-6, auto-fix.yml +1/-2, package.json -1, bun.lock +5/-36.

@Vivswan
Vivswan force-pushed the refactor/inputs-table-region branch from ef74db0 to c95ed8d Compare October 6, 2026 11:00
@Vivswan
Vivswan requested a balanced review from Copilot October 6, 2026 11:01

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.

Copilot review overview

🟢 Approval recommended

The focused refactor preserves table contents and regeneration safeguards, with no unresolved defects identified.

Review effort: Balanced
Findings: None

What changed in this PR

Moves the inputs reference table onto the shared generated-region system introduced in #507, preserving table contents while removing action-docs.

Changes:

  • Renders directly from INPUT_DECLS with round-trip validation.
  • Updates markers and tests to use the shared region driver.
  • Removes the dependency and updates explanatory comments.
File Description
test/​scripts/​generated.test.ts Removes special handling for action-docs markers.
test/​scripts/​gen-inputs-table.test.ts Tests regeneration and invalid-content refusals.
test/​docs/​inputs.test.ts Removes redundant rendering checks.
src/​flows/​inputs.ts Updates generation comments only.
package.json Removes action-docs.
docs/​reference/​inputs.md Migrates markers and moves the heading outside the region.
docs/​README.md Documents the table's declaration source.
bun.lock Removes dependency entries and updates resolution paths.
.github/​workflows/​auto-fix.yml Updates the explanatory header comment only.
.github/​scripts/​generated.ts Updates marker and dependency comments only.
.github/​scripts/​gen-inputs-table.ts Implements rendering, parsing, and shared-driver integration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Base automatically changed from refactor/region-driver to main October 6, 2026 20:37
The inputs table on docs/reference/inputs.md was rendered by the action-docs package from action.yml between action-docs's own markers, after a hand-written guard checked that the region held only a rendering. It is now one more GeneratedRegion: the data is INPUT_DECLS, the same source action.yml's inputs region is generated from; the render is a four-cell table through renderTable; the parse reads each row back through tableBody; and the round-trip seal refuses a moved marker, an authored row, or a description holding "<" naming the line.

Every table line is byte-identical to the previous rendering, the paragraph wrapper and the empty-default spelling included. Only the marker lines changed, and the "## Inputs" heading moved above the BEGIN marker so the region sits under it like every other table region. action-docs leaves the devDependencies: the region needs a synchronous render and a parse, which the async, file-writing package cannot give.

The docs README, the input declarations' comments, and the auto-fix workflow comment now name the generated region instead of action-docs. test/docs/inputs.test.ts goes: it restated the generator's rendering, its ASCII pin duplicates the typography gate, and its "|" and "<" checks duplicate the generator's refusals.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 20:42
@Vivswan
Vivswan force-pushed the refactor/inputs-table-region branch from c95ed8d to 8f7947f Compare October 6, 2026 20:42

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.

Copilot review overview

🟢 Approval recommended

The refactor follows the shared regeneration contract, preserves table contents, and has no identified blocking defects.

Review effort: Balanced
Findings: None

@Vivswan
Vivswan marked this pull request as ready for review October 6, 2026 20:50
@Vivswan
Vivswan enabled auto-merge (squash) October 6, 2026 21:00
@Vivswan
Vivswan disabled auto-merge October 6, 2026 21:01
@Vivswan
Vivswan merged commit 17ef440 into main Oct 6, 2026
29 checks passed
@Vivswan
Vivswan deleted the refactor/inputs-table-region branch October 6, 2026 21:01
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