Skip to content

Commit 5a99ee7

Browse files
authored
Strive to make the spec lock file update clearer, update spec lock file (#30)
* Move most error reporting to file, make note of it * Add summary on affected guidelines * Make FLS differences output even if affecting no guidelines. Pull this into the archive. * Add ability to ignore spec lock file consistency check * Update spec lock file
1 parent fc179e3 commit 5a99ee7

File tree

6 files changed

+10946
-10763
lines changed

6 files changed

+10946
-10763
lines changed

.github/workflows/build-guidelines.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Build
2-
32
on:
43
push:
54
tags:
@@ -17,25 +16,21 @@ on:
1716
# required: false
1817
# type: string
1918
# default: 'default value'
20-
2119
jobs:
2220
build:
2321
runs-on: ubuntu-latest
2422
steps:
2523
- name: Checkout repository
2624
uses: actions/checkout@v3
27-
2825
- name: Install uv
2926
run: |
3027
curl -LsSf https://astral.sh/uv/install.sh | sh
3128
export PATH="/root/.cargo/bin:$PATH"
3229
uv --version
33-
3430
- name: Build documentation
3531
run: |
3632
mkdir -p build
3733
./make.py 2>&1 | tee build/build.log
38-
3934
# Check for a wide range of error indicators in the log
4035
if grep -q -E "Traceback" build/build.log; then
4136
echo "::error::Build errors detected in log"
@@ -46,17 +41,31 @@ jobs:
4641
# Check for the Sphinx temp error file reference and extract it if present
4742
TEMP_ERROR_FILE=$(grep -o '/tmp/sphinx-err-[^ ]*\.log' build/build.log | head -1)
4843
if [ ! -z "$TEMP_ERROR_FILE" ] && [ -f "$TEMP_ERROR_FILE" ]; then
49-
echo "==== SPHINX DETAILED TRACEBACK START ===="
50-
cat "$TEMP_ERROR_FILE"
51-
echo "==== SPHINX DETAILED TRACEBACK END ===="
52-
5344
# Save this traceback for artifacts
45+
echo "=== TRACEBACK ==="
46+
echo "Saving traceback to build/sphinx_traceback.log"
5447
cp "$TEMP_ERROR_FILE" build/sphinx_traceback.log
5548
fi
5649
50+
# Check for FLS differences file reference and extract it if present
51+
FLS_DIFF_FILE=$(grep -o '/tmp/fls_diff_[^ ]*\.txt' build/build.log | head -1)
52+
if [ ! -z "$FLS_DIFF_FILE" ] && [ -f "$FLS_DIFF_FILE" ]; then
53+
# Save this differences file for artifacts
54+
echo "=== SPEC LOCK FILE DIFFERENCES ==="
55+
echo "Saving spec lock file differences to to build/spec_lock_file_differences.log"
56+
cp "$FLS_DIFF_FILE" build/spec_lock_file_differences.txt
57+
fi
58+
5759
exit 1
60+
else
61+
# Even if there's no error, still check for FLS differences file
62+
FLS_DIFF_FILE=$(grep -o '/tmp/fls_diff_[^ ]*\.txt' build/build.log | head -1)
63+
if [ ! -z "$FLS_DIFF_FILE" ] && [ -f "$FLS_DIFF_FILE" ]; then
64+
echo "=== SPEC LOCK FILE DIFFERENCES, NO BUILD ERROR ==="
65+
echo "Saving spec lock file differences to to build/spec_lock_file_differences.log"
66+
cp "$FLS_DIFF_FILE" build/spec_lock_file_differences.txt
67+
fi
5868
fi
59-
6069
- name: Archive build artifacts
6170
uses: actions/upload-artifact@v4
6271
if: always()

README.md

+46
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,52 @@ A machine-parseable artifact will be available at `build/html/needs.json`. (ToDo
2929

3030
A record with checksums of the contents is available at `build/html/guidelines-ids.json`. Users of the coding guidelines can reference this file to determine if there have been changes to coding guidelines contents they should be aware of.
3131

32+
## Build breaking due to out-dated spec lock file
33+
34+
It's a fairly common occurence for the build to break due to an out of date spec lock file, located at:
35+
36+
```
37+
src/spec.lock
38+
```
39+
40+
The `spec.lock` is checked against the current live version of the specification, which means that your local development may go out of date while you are developing a feature.
41+
42+
### Continuing work while on a feature branch
43+
44+
If you run into this while developing a feature, you may ignore this error by running the build with:
45+
46+
```shell
47+
./make.py --ignore-spec-lock-diff
48+
```
49+
50+
### If you need to audit the difference
51+
52+
When the build breaks due to the difference a file is created here:
53+
54+
```
55+
/tmp/fls_diff_<random>.txt
56+
```
57+
58+
which can be used to aid in auditing the differences.
59+
60+
Follow the below steps to ensure that the guidelines remain a representation of the FLS:
61+
62+
1. Check if there are any guidelines currently affected, if no, go to 6.
63+
2. For each affected guideline, audit the previous text and current text of the appropriate paragraph-id in the FLS
64+
3. If the prior and new text of that paragraph in the FLS does not effect the guideline, proceed back to 2. to the next affected guideline
65+
4. If the prior and new text of that paragraph do differ in the FLS, then a rationalization step is required
66+
1. In the rationalization step, either yourself or another coding guidelines member must modify the guideline to comply with the new text
67+
5. If you any affected coding guidelines remain proceed back to 2. to the next affected guideline
68+
6. You are done
69+
70+
Once you have completed the above steps, you will now update the local copy of the `spec.lock` file with the live version:
71+
72+
```shell
73+
./make.py --update-spec-lock-file
74+
```
75+
76+
Open a new PR with only the changes necessary to rationalize the guidelines with the new FLS text.
77+
3278
## Contributing to the coding guidelines
3379

3480
See [CONTRIBUTING.md](CONTRIBUTING.md).

builder/build_cli.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
SPEC_CHECKSUM_URL = "https://spec.ferrocene.dev/paragraph-ids.json"
2121
SPEC_LOCKFILE = "spec.lock"
2222

23-
def build_docs(root, builder, clear, serve, debug):
23+
def build_docs(root, builder, clear, serve, debug, spec_lock_consistency_check):
2424
dest = root / "build"
2525

2626
args = ["-b", builder, "-d", dest / "doctrees"]
@@ -36,6 +36,18 @@ def build_docs(root, builder, clear, serve, debug):
3636
args += ["-j", "auto"]
3737
if clear:
3838
args.append("-E")
39+
40+
# Initialize an empty list for configuration options (without --define)
41+
conf_opt_values = []
42+
# Add configuration options as needed
43+
if not spec_lock_consistency_check:
44+
conf_opt_values.append("enable_spec_lock_consistency=0")
45+
# Only add the --define argument if there are options to define
46+
if conf_opt_values:
47+
args.append("--define")
48+
for opt in conf_opt_values:
49+
args.append(opt)
50+
3951
if serve:
4052
for extra_watch_dir in EXTRA_WATCH_DIRS:
4153
extra_watch_dir = root / extra_watch_dir
@@ -99,6 +111,12 @@ def main(root):
99111
"-c", "--clear", help="disable incremental builds", action="store_true"
100112
)
101113
group = parser.add_mutually_exclusive_group()
114+
parser.add_argument(
115+
"--ignore-spec-lock-diff",
116+
help="ignore fls.lock file differences with live release -- for WIP branches only",
117+
default=False,
118+
action="store_true"
119+
)
102120
parser.add_argument(
103121
"--update-spec-lock-file",
104122
help="update fls.lock file",
@@ -127,6 +145,6 @@ def main(root):
127145
update_spec_lockfile(SPEC_CHECKSUM_URL, root / "src" / SPEC_LOCKFILE)
128146

129147
rendered = build_docs(
130-
root, "xml" if args.xml else "html", args.clear, args.serve, args.debug
148+
root, "xml" if args.xml else "html", args.clear, args.serve, args.debug, not args.ignore_spec_lock_diff
131149
)
132150

exts/coding_guidelines/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def setup(app):
4444
app.add_config_value(name='fls_paragraph_ids_url',
4545
default='https://spec.ferrocene.dev/paragraph-ids.json',
4646
rebuild='env')
47+
app.add_config_value(name='enable_spec_lock_consistency',
48+
default=True,
49+
rebuild='env')
4750

4851
app.connect('env-check-consistency', fls_checks.check_fls)
4952
app.connect('build-finished', write_guidelines_ids.build_finished)

0 commit comments

Comments
 (0)