author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
258,402 | 16.11.2022 13:46:43 | -39,600 | abfaec6a89c7412c2c1899a04b196bdddbef037c | Log statistics about restart/omit trials
As discussed, logging these statistics has two benefits:
1. Help us confirm that all missing data are intended.
2. Give us the statistics needed to find a better solution to missing
data. | [
{
"change_type": "MODIFY",
"old_path": "experiment/scheduler.py",
"new_path": "experiment/scheduler.py",
"diff": "@@ -219,6 +219,8 @@ class TrialInstanceManager: # pylint: disable=too-many-instance-attributes\ndef __init__(self, num_trials, experiment_config):\nself.experiment_config = experiment_config\nself.num_trials = num_trials\n+ self.num_preemptible_restarts = 0\n+ self.num_preemptible_omits = 0\n# Bound for the number of nonpreemptibles we can start if the experiment\n# specified preemptible_runners.\n@@ -334,6 +336,20 @@ class TrialInstanceManager: # pylint: disable=too-many-instance-attributes\nreturn get_started_trials(self.experiment_config['experiment']).filter(\nmodels.Trial.preemptible.is_(False)).count()\n+ def _format_count_info(self, trial: models.Trial, count: int) -> str:\n+ \"\"\"Formats a trial's count and information for logging.\"\"\"\n+ return (f'Trial ID: {trial.id}. '\n+ f'Benchmark-Fuzzer pair: {trial.benchmark}-{trial.fuzzer}. '\n+ f'Accumulating to {count/self.num_trials*100:3.2f}% '\n+ f'({count} / {self.num_trials}) of all trials.')\n+\n+ def _log_restart(self, preemptible: bool, trial: models.Trial,\n+ count: int) -> None:\n+ \"\"\"Logs the count of restarting trials.\"\"\"\n+ logs.info('Restarting a preemptible trial as a %s one: %s',\n+ 'preemptible' if preemptible else 'nonpreemptible',\n+ self._format_count_info(trial, count))\n+\ndef _get_preempted_replacements(self,\npreempted_trials) -> List[models.Trial]:\n\"\"\"Returns a list containing a replacement trial for each trial that can\n@@ -353,7 +369,10 @@ class TrialInstanceManager: # pylint: disable=too-many-instance-attributes\n# trying nonpreemptible to minimize cost.\nif self.can_start_preemptible():\n# See if we can replace with a preemptible.\n+ self.num_preemptible_restarts += 1\nreplacements.append(replace_trial(trial, preemptible=True))\n+\n+ self._log_restart(True, trial, self.num_preemptible_restarts)\ncontinue\nif self.can_start_nonpreemptible(nonpreemptible_starts):\n@@ -361,8 +380,15 @@ class TrialInstanceManager: # pylint: disable=too-many-instance-attributes\n# replace it with a nonpreemptible.\nnonpreemptible_starts += 1\nreplacements.append(replace_trial(trial, preemptible=False))\n+\n+ self._log_restart(False, trial, nonpreemptible_starts)\ncontinue\n+ self.num_preemptible_omits += 1\n+ logs.warning(\n+ 'Omitting a trial to cap cost: %s',\n+ self._format_count_info(trial, self.num_preemptible_omits))\n+\nreturn replacements\ndef _get_started_unfinished_instances(self) -> Dict[str, models.Trial]:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Log statistics about restart/omit trials (#1554)
As discussed, logging these statistics has two benefits:
1. Help us confirm that all missing data are intended.
2. Give us the statistics needed to find a better solution to missing
data. |
258,402 | 19.11.2022 08:50:23 | -39,600 | 8c0ef116f4d2825e6590bd3331574eb1fade2069 | Request a new Entropic experiment
1. Compare Entropic with libFuzzer and Centipede.
2. Potentially trigger the new logs added.
3. Potentially help debug the incomplete experiment. | [
{
"change_type": "MODIFY",
"old_path": "service/experiment-requests.yaml",
"new_path": "service/experiment-requests.yaml",
"diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-11-19-update-libfuzzer\n+ description: \"Compare and consider replacing Entropic with Centipede\"\n+ fuzzers:\n+ - libfuzzer\n+ - entropic\n+ - centipede\n+\n- experiment: 2022-11-12-muttfuzz\ndescription: \"Try out muttfuzz and compare against afl\"\nfuzzers:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Request a new Entropic experiment
1. Compare Entropic with libFuzzer and Centipede.
2. Potentially trigger the new logs added.
3. Potentially help debug the incomplete experiment. |
258,380 | 21.11.2022 18:48:23 | 18,000 | 48350d1e315f49803092258b2f2338ceeb830357 | Fix issues with um_random and um_prioritize_75
Fix issues with copying of files in um_random and um_prioritize_75. Also
handle SIGKILL in muttfuzz experiments.
Adding two new experiments as well, one for comparing um_random and
um_prioritize_75 and the other for comparing muttfuzz against vanilla
afl. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus_muttfuzz/fuzzutil.py",
"new_path": "fuzzers/aflplusplus_muttfuzz/fuzzutil.py",
"diff": "@@ -16,6 +16,7 @@ from datetime import datetime\nimport os\nimport signal\nimport subprocess\n+from subprocess import CalledProcessError\nimport time\nfrom contextlib import contextmanager\n@@ -169,7 +170,7 @@ def fuzz_with_mutants( # pylint: disable=too-many-locals,too-many-arguments\nrestore_executable(executable, executable_code)\n-def fuzz_with_mutants_via_function( # pylint: disable=too-many-locals,too-many-statements,too-many-arguments\n+def fuzz_with_mutants_via_function( # pylint: disable=too-many-locals,too-many-statements,too-many-arguments,too-many-branches\nfuzzer_fn,\nexecutable,\nbudget,\n@@ -237,6 +238,8 @@ def fuzz_with_mutants_via_function( # pylint: disable=too-many-locals,too-many-\nfuzzer_fn()\nexcept TimeoutException:\npass\n+ except CalledProcessError:\n+ pass\nprint(\n\"FINISHED FUZZING IN\",\nround(time.time() - start_run, 2),\n@@ -259,6 +262,8 @@ def fuzz_with_mutants_via_function( # pylint: disable=too-many-locals,too-many-\nfuzzer_fn()\nexcept TimeoutException:\npass\n+ except CalledProcessError:\n+ pass\nprint(\n\"COMPLETED ALL FUZZING AFTER\",\nround(time.time() - start_fuzz, 2),\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus_um_prioritize_75/fuzzer.py",
"new_path": "fuzzers/aflplusplus_um_prioritize_75/fuzzer.py",
"diff": "@@ -232,10 +232,13 @@ def fuzz(input_corpus, output_corpus, target_binary):\ninput_corpus_dir = \"/storage/input_corpus\"\nos.makedirs(input_corpus_dir, exist_ok=True)\n+ crashes_dir = \"/storage/crashes\"\n+ os.makedirs(crashes_dir, exist_ok=True)\nos.environ['AFL_SKIP_CRASHES'] = \"1\"\nfor mutant in mutants[:num_mutants]:\nos.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ os.system(f\"rm -rf {input_corpus_dir}/*\")\nwith utils.restore_directory(input_corpus), utils.restore_directory(\noutput_corpus):\ntry:\n@@ -245,7 +248,12 @@ def fuzz(input_corpus, output_corpus, target_binary):\npass\nexcept CalledProcessError:\npass\n- os.system(f\"cp -r {output_corpus}/* {input_corpus_dir}/*\")\n- os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ os.system(f\"cp {output_corpus}/default/crashes/crashes.*/id* \\\n+ {crashes_dir}/\")\n+ os.system(f\"cp {output_corpus}/default/crashes/crashes.*/id* \\\n+ {input_corpus_dir}/\")\n+ os.system(f\"cp {output_corpus}/default/queue/* {input_corpus_dir}/\")\n+\n+ os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/\")\naflplusplus_fuzzer.fuzz(input_corpus, output_corpus, target_binary)\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/aflplusplus_um_random/fuzzer.py",
"new_path": "fuzzers/aflplusplus_um_random/fuzzer.py",
"diff": "@@ -194,10 +194,13 @@ def fuzz(input_corpus, output_corpus, target_binary):\ninput_corpus_dir = \"/storage/input_corpus\"\nos.makedirs(input_corpus_dir, exist_ok=True)\n+ crashes_dir = \"/storage/crashes\"\n+ os.makedirs(crashes_dir, exist_ok=True)\nos.environ['AFL_SKIP_CRASHES'] = \"1\"\nfor mutant in mutants[:num_mutants]:\nos.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ os.system(f\"rm -rf {input_corpus_dir}/*\")\nwith utils.restore_directory(input_corpus), utils.restore_directory(\noutput_corpus):\ntry:\n@@ -207,7 +210,12 @@ def fuzz(input_corpus, output_corpus, target_binary):\npass\nexcept CalledProcessError:\npass\n- os.system(f\"cp -r {output_corpus}/* {input_corpus_dir}/*\")\n- os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/*\")\n+ os.system(f\"cp {output_corpus}/default/crashes/crashes.*/id* \\\n+ {crashes_dir}/\")\n+ os.system(f\"cp {output_corpus}/default/crashes/crashes.*/id* \\\n+ {input_corpus_dir}/\")\n+ os.system(f\"cp {output_corpus}/default/queue/* {input_corpus_dir}/\")\n+\n+ os.system(f\"cp -r {input_corpus_dir}/* {input_corpus}/\")\naflplusplus_fuzzer.fuzz(input_corpus, output_corpus, target_binary)\n"
},
{
"change_type": "MODIFY",
"old_path": "service/experiment-requests.yaml",
"new_path": "service/experiment-requests.yaml",
"diff": "# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-11-18-um\n+ description: \"Try out um prioritize 75 and random again\"\n+ fuzzers:\n+ - aflplusplus_um_random\n+ - aflplusplus_um_prioritize_75\n+\n+- experiment: 2022-11-18-muttfuzz\n+ description: \"Try out muttfuzz and compare against afl\"\n+ fuzzers:\n+ - aflplusplus\n+ - aflplusplus_muttfuzz\n+\n- experiment: 2022-11-22-aflpp-cmplog\ndescription: \"afl++ cmplog enhancements\"\nfuzzers:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix issues with um_random and um_prioritize_75 (#1557)
Fix issues with copying of files in um_random and um_prioritize_75. Also
handle SIGKILL in muttfuzz experiments.
Adding two new experiments as well, one for comparing um_random and
um_prioritize_75 and the other for comparing muttfuzz against vanilla
afl.
Co-authored-by: jonathanmetzman <[email protected]> |
258,402 | 02.12.2022 11:28:50 | -39,600 | 33167a2a54077a5256874494b1d83aaac9b8e526 | Fix failure when merging previous experiments
1. Exclude benchmarks if they no longer exist (or do not have a
`benchmark.yaml`).
2. Exclude experiments if their types are different from the main
experiment. | [
{
"change_type": "MODIFY",
"old_path": "analysis/data_utils.py",
"new_path": "analysis/data_utils.py",
"diff": "# limitations under the License.\n\"\"\"Utility functions for data (frame) transformations.\"\"\"\nfrom analysis import stat_tests\n+from common import benchmark_utils\nfrom common import environment\n+from common import logs\n+\n+logger = logs.Logger('data_utils')\nclass EmptyDataError(ValueError):\n@@ -97,7 +101,14 @@ def filter_fuzzers(experiment_df, included_fuzzers):\ndef filter_benchmarks(experiment_df, included_benchmarks):\n\"\"\"Returns table with only rows where benchmark is in\n|included_benchmarks|.\"\"\"\n- return experiment_df[experiment_df['benchmark'].isin(included_benchmarks)]\n+ valid_benchmarks = [\n+ benchmark for benchmark in included_benchmarks\n+ if benchmark_utils.validate(benchmark)\n+ ]\n+ logger.warning('Filtered out invalid benchmarks: %s.',\n+ set(included_benchmarks) - set(valid_benchmarks))\n+ logger.debug('Valid benchmarks: %s.', valid_benchmarks)\n+ return experiment_df[experiment_df['benchmark'].isin(valid_benchmarks)]\ndef label_fuzzers_by_experiment(experiment_df):\n"
},
{
"change_type": "MODIFY",
"old_path": "analysis/experiment_results.py",
"new_path": "analysis/experiment_results.py",
"diff": "@@ -22,6 +22,7 @@ from analysis import benchmark_results\nfrom analysis import coverage_data_utils\nfrom analysis import data_utils\nfrom analysis import stat_tests\n+from common import experiment_utils\ndef strip_gs_protocol(url):\n@@ -132,6 +133,7 @@ class ExperimentResults: # pylint: disable=too-many-instance-attributes\nuntil a property is evaluated.\n\"\"\"\nbenchmark_names = self._experiment_df.benchmark.unique()\n+\nreturn [\nbenchmark_results.BenchmarkResults(name, self._experiment_df,\nself._coverage_dict,\n@@ -149,12 +151,8 @@ class ExperimentResults: # pylint: disable=too-many-instance-attributes\nRaises ValueError if the benchmark types are mixed.\n\"\"\"\n- if all(b.type == 'bug' for b in self.benchmarks):\n- return 'bug'\n- if all(b.type == 'code' for b in self.benchmarks):\n- return 'code'\n- raise ValueError(\n- 'Cannot mix bug benchmarks with code coverage benchmarks.')\n+ benchmarks = [benchmark.name for benchmark in self.benchmarks]\n+ return experiment_utils.get_experiment_type(benchmarks)\n@property\ndef _relevant_column(self):\n"
},
{
"change_type": "MODIFY",
"old_path": "analysis/generate_report.py",
"new_path": "analysis/generate_report.py",
"diff": "@@ -127,8 +127,11 @@ def get_arg_parser():\nreturn parser\n-def get_experiment_data(experiment_names, main_experiment_name,\n- from_cached_data, data_path):\n+def get_experiment_data(experiment_names,\n+ main_experiment_name,\n+ from_cached_data,\n+ data_path,\n+ main_experiment_benchmarks=None):\n\"\"\"Helper function that reads data from disk or from the database. Returns a\ndataframe and the experiment description.\"\"\"\nif from_cached_data and os.path.exists(data_path):\n@@ -137,7 +140,8 @@ def get_experiment_data(experiment_names, main_experiment_name,\nlogger.info('Done reading data from %s.', data_path)\nreturn experiment_df, 'from cached data'\nlogger.info('Reading experiment data from db.')\n- experiment_df = queries.get_experiment_data(experiment_names)\n+ experiment_df = queries.get_experiment_data(experiment_names,\n+ main_experiment_benchmarks)\nlogger.info('Done reading experiment data from db.')\ndescription = queries.get_experiment_description(main_experiment_name)\nreturn experiment_df, description\n@@ -151,8 +155,16 @@ def modify_experiment_data_if_requested( # pylint: disable=too-many-arguments\nby the user on the command line (or callers to generate_report).\"\"\"\nif benchmarks:\n# Filter benchmarks if requested.\n+ logger.debug('Filter included benchmarks: %s.', benchmarks)\nexperiment_df = data_utils.filter_benchmarks(experiment_df, benchmarks)\n+ if not experiment_df['benchmark'].empty:\n+ # Filter benchmarks in experiment DataFrame.\n+ unique_benchmarks = experiment_df['benchmark'].unique().tolist()\n+ logger.debug('Filter experiment_df benchmarks: %s.', unique_benchmarks)\n+ experiment_df = data_utils.filter_benchmarks(experiment_df,\n+ unique_benchmarks)\n+\nif fuzzers is not None:\n# Filter fuzzers if requested.\nexperiment_df = data_utils.filter_fuzzers(experiment_df, fuzzers)\n@@ -189,7 +201,8 @@ def generate_report(experiment_names,\nend_time=None,\nmerge_with_clobber=False,\nmerge_with_clobber_nonprivate=False,\n- coverage_report=False):\n+ coverage_report=False,\n+ experiment_benchmarks=None):\n\"\"\"Generate report helper.\"\"\"\nif merge_with_clobber_nonprivate:\nexperiment_names = (\n@@ -204,7 +217,11 @@ def generate_report(experiment_names,\ndata_path = os.path.join(report_directory, DATA_FILENAME)\nexperiment_df, experiment_description = get_experiment_data(\n- experiment_names, main_experiment_name, from_cached_data, data_path)\n+ experiment_names,\n+ main_experiment_name,\n+ from_cached_data,\n+ data_path,\n+ main_experiment_benchmarks=experiment_benchmarks)\n# TODO(metzman): Ensure that each experiment is in the df. Otherwise there\n# is a good chance user misspelled something.\n"
},
{
"change_type": "MODIFY",
"old_path": "analysis/queries.py",
"new_path": "analysis/queries.py",
"diff": "@@ -21,7 +21,7 @@ from database.models import Experiment, Trial, Snapshot, Crash\nfrom database import utils as db_utils\n-def get_experiment_data(experiment_names):\n+def get_experiment_data(experiment_names, main_experiment_benchmarks=None):\n\"\"\"Get measurements (such as coverage) on experiments from the database.\"\"\"\nwith db_utils.session_scope() as session:\nsnapshots_query = session.query(\n@@ -38,6 +38,9 @@ def get_experiment_data(experiment_names):\nSnapshot.trial_id == Crash.trial_id), isouter=True)\\\n.filter(Experiment.name.in_(experiment_names))\\\n.filter(Trial.preempted.is_(False))\n+ if main_experiment_benchmarks:\n+ snapshots_query = snapshots_query.filter(\n+ Trial.benchmark.in_(main_experiment_benchmarks))\nreturn pd.read_sql_query(snapshots_query.statement, db_utils.engine)\n"
},
{
"change_type": "MODIFY",
"old_path": "analysis/test_data_utils.py",
"new_path": "analysis/test_data_utils.py",
"diff": "@@ -46,13 +46,13 @@ def create_experiment_data(experiment='test_experiment',\nexperiment_filestore='gs://fuzzbench-data'):\n\"\"\"Utility function to create test experiment data.\"\"\"\nreturn pd.concat([\n- create_trial_data(0, 'libpng', 'afl', 10, 100, experiment,\n+ create_trial_data(0, 'libpng-1.2.56', 'afl', 10, 100, experiment,\nexperiment_filestore),\n- create_trial_data(1, 'libpng', 'afl', 10, 200, experiment,\n+ create_trial_data(1, 'libpng-1.2.56', 'afl', 10, 200, experiment,\nexperiment_filestore),\n- create_trial_data(2, 'libpng', 'libfuzzer', 10, 200, experiment,\n+ create_trial_data(2, 'libpng-1.2.56', 'libfuzzer', 10, 200, experiment,\nexperiment_filestore),\n- create_trial_data(3, 'libpng', 'libfuzzer', 10, 300, experiment,\n+ create_trial_data(3, 'libpng-1.2.56', 'libfuzzer', 10, 300, experiment,\nexperiment_filestore),\ncreate_trial_data(4, 'libxml', 'afl', 6 if incomplete else 10, 1000,\nexperiment, experiment_filestore),\n@@ -94,7 +94,7 @@ def test_clobber_experiments_data():\ndf.reset_index(inplace=True)\nto_drop = df[(df.experiment == 'experiment-2') &\n- (df.benchmark == 'libpng') & (df.fuzzer == 'afl')].index\n+ (df.benchmark == 'libpng-1.2.56') & (df.fuzzer == 'afl')].index\ndf.drop(to_drop, inplace=True)\nexperiments = list(df['experiment'].drop_duplicates().values)\n@@ -102,10 +102,10 @@ def test_clobber_experiments_data():\ncolumns = ['experiment', 'benchmark', 'fuzzer']\nexpected_result = pd.DataFrame([\n- ['experiment-2', 'libpng', 'libfuzzer'],\n+ ['experiment-2', 'libpng-1.2.56', 'libfuzzer'],\n['experiment-2', 'libxml', 'afl'],\n['experiment-2', 'libxml', 'libfuzzer'],\n- ['experiment-1', 'libpng', 'afl'],\n+ ['experiment-1', 'libpng-1.2.56', 'afl'],\n],\ncolumns=columns)\nexpected_result.sort_index(inplace=True)\n@@ -123,7 +123,7 @@ def test_filter_fuzzers():\ndef test_filter_benchmarks():\nexperiment_df = create_experiment_data()\n- benchmarks_to_keep = ['libpng']\n+ benchmarks_to_keep = ['libpng-1.2.56']\nfiltered_df = data_utils.filter_benchmarks(experiment_df,\nbenchmarks_to_keep)\n@@ -245,7 +245,7 @@ def test_experiment_summary():\nsummary = data_utils.experiment_summary(snapshots_df)\nexpected_summary = pd.DataFrame({\n- 'benchmark': ['libpng', 'libpng', 'libxml', 'libxml'],\n+ 'benchmark': ['libpng-1.2.56', 'libpng-1.2.56', 'libxml', 'libxml'],\n'fuzzer': ['libfuzzer', 'afl', 'afl', 'libfuzzer'],\n'time': [9, 9, 9, 9],\n'count': [2, 2, 2, 2],\n@@ -306,8 +306,8 @@ def test_experiment_pivot_table():\n# yapf: disable\nexpected_data = pd.DataFrame([\n- {'benchmark': 'libpng', 'fuzzer': 'afl', 'median': 150},\n- {'benchmark': 'libpng', 'fuzzer': 'libfuzzer', 'median': 250},\n+ {'benchmark': 'libpng-1.2.56', 'fuzzer': 'afl', 'median': 150},\n+ {'benchmark': 'libpng-1.2.56', 'fuzzer': 'libfuzzer', 'median': 250},\n{'benchmark': 'libxml', 'fuzzer': 'afl', 'median': 1100},\n{'benchmark': 'libxml', 'fuzzer': 'libfuzzer', 'median': 700},\n])\n"
},
{
"change_type": "MODIFY",
"old_path": "common/benchmark_config.py",
"new_path": "common/benchmark_config.py",
"diff": "@@ -17,6 +17,9 @@ import os\nfrom common import utils\nfrom common import yaml_utils\n+from common import logs\n+\n+logger = logs.Logger('benchmark_config')\nBENCHMARKS_DIR = os.path.join(utils.ROOT_DIR, 'benchmarks')\n@@ -29,4 +32,8 @@ def get_config_file(benchmark):\[email protected]_cache(maxsize=None)\ndef get_config(benchmark):\n\"\"\"Returns a dictionary containing the config for a benchmark.\"\"\"\n- return yaml_utils.read(get_config_file(benchmark))\n+ config_file = get_config_file(benchmark)\n+ if os.path.isfile(config_file):\n+ return yaml_utils.read(config_file)\n+ logger.warning('Benchmark config does not exist: %s.', config_file)\n+ return {}\n"
},
{
"change_type": "MODIFY",
"old_path": "common/experiment_utils.py",
"new_path": "common/experiment_utils.py",
"diff": "import os\nimport posixpath\n+from common import benchmark_utils\nfrom common import environment\nfrom common import experiment_path as exp_path\n@@ -55,6 +56,24 @@ def get_experiment_folders_dir():\nreturn exp_path.path('experiment-folders')\n+def get_experiment_type(benchmarks):\n+ \"\"\"Returns the experiment type based on the type of |benchmarks|, i.e.,\n+ 'code' or 'bug'.\n+ Raises ValueError if the benchmark types are mixed.\n+ \"\"\"\n+ for benchmark_type in benchmark_utils.BenchmarkType:\n+ type_value = benchmark_type.value\n+ if all(\n+ benchmark_utils.get_type(benchmark) == type_value\n+ for benchmark in benchmarks):\n+ return type_value\n+\n+ benchmark_types = ';'.join(\n+ [f'{b}: {benchmark_utils.get_type(b)}' for b in benchmarks])\n+ raise ValueError('Cannot mix bug benchmarks with code coverage benchmarks: '\n+ f'{benchmark_types}.')\n+\n+\ndef get_cloud_project():\n\"\"\"Returns the cloud project.\"\"\"\nreturn os.environ['CLOUD_PROJECT']\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/reporter.py",
"new_path": "experiment/reporter.py",
"diff": "@@ -64,9 +64,12 @@ def output_report(experiment_config: dict,\n# Don't merge with nonprivate experiments until the very end as doing it\n# while the experiment is in progress will produce unusable realtime\n# results.\n+ logger.info('In progress: %s.', in_progress)\nmerge_with_nonprivate = (not in_progress and experiment_config.get(\n'merge_with_nonprivate', False))\n+ logger.info('Is merging with nonprivate: %s.', merge_with_nonprivate)\n+ experiment_benchmarks = set(experiment_config['benchmarks'])\ntry:\nlogger.debug('Generating report.')\nfilesystem.recreate_directory(reports_dir)\n@@ -77,7 +80,8 @@ def output_report(experiment_config: dict,\nfuzzers=fuzzers,\nin_progress=in_progress,\nmerge_with_clobber_nonprivate=merge_with_nonprivate,\n- coverage_report=coverage_report)\n+ coverage_report=coverage_report,\n+ experiment_benchmarks=experiment_benchmarks)\nfilestore_utils.rsync(\nstr(reports_dir),\nweb_filestore_path,\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_reporter.py",
"new_path": "experiment/test_reporter.py",
"diff": "@@ -62,6 +62,7 @@ def test_output_report_filestore(experiment_fuzzers, expected_merged_fuzzers,\nfilestore.\"\"\"\nexperiment_config = _setup_experiment_files(fs)\nexperiment_config['fuzzers'] = experiment_fuzzers\n+ experiment_benchmarks = set(experiment_config['benchmarks'])\nwith test_utils.mock_popen_ctx_mgr() as mocked_popen:\nwith mock.patch('analysis.generate_report.generate_report'\n@@ -80,4 +81,5 @@ def test_output_report_filestore(experiment_fuzzers, expected_merged_fuzzers,\nfuzzers=expected_merged_fuzzers,\nin_progress=False,\nmerge_with_clobber_nonprivate=False,\n- coverage_report=False)\n+ coverage_report=False,\n+ experiment_benchmarks=experiment_benchmarks)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix failure when merging previous experiments (#1562)
1. Exclude benchmarks if they no longer exist (or do not have a
`benchmark.yaml`).
2. Exclude experiments if their types are different from the main
experiment. |
258,402 | 04.12.2022 16:38:54 | -39,600 | df94bd75207ad2d23aabafd60bd184a09a6768f1 | Separate line makers from filled markers
Fix `seaborn` marker errors. | [
{
"change_type": "MODIFY",
"old_path": "analysis/plotting.py",
"new_path": "analysis/plotting.py",
"diff": "@@ -90,7 +90,7 @@ class Plotter:\n# We specify 20 markers for the 20 colors above.\n_MARKER_PALETTE = [\n'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd', 'P',\n- 'X', ',', '+', 'x', '|', '_'\n+ 'X', ',', '.'\n]\ndef __init__(self, fuzzers, quick=False, logscale=False):\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Separate line makers from filled markers (#1565)
Fix `seaborn` marker errors. |
258,402 | 05.12.2022 14:15:49 | -39,600 | 608a166acce3ae2c5f934d0baae9c4a2bd5137a3 | Add publication page to nav sidebar in github.io
1. Show the [publication
page](https://google.github.io/fuzzbench/publications.html) on the
navigation sidebar.
2. Define its layout, links, etc. | [
{
"change_type": "MODIFY",
"old_path": "docs/publications.md",
"new_path": "docs/publications.md",
"diff": "+---\n+layout: default\n+title: Publications\n+has_children: false\n+nav_order: 9\n+permalink: /publications/\n+---\n+\n+# Publications\n+\n[FuzzBench](https://dl.acm.org/doi/pdf/10.1145/3468264.3473932)\n[[BibTeX](https://ieeexplore.ieee.org/abstract/document/9787836)]\nhas been widely used by many research works to evaluate fuzzers and will\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add publication page to nav sidebar in github.io (#1567)
1. Show the [publication
page](https://google.github.io/fuzzbench/publications.html) on the
navigation sidebar.
2. Define its layout, links, etc. |
258,402 | 05.12.2022 18:21:15 | -39,600 | 12322ed2280a33a5c6306740c24be462635484e6 | Fix FuzzBench BibTex | [
{
"change_type": "MODIFY",
"old_path": "docs/publications.md",
"new_path": "docs/publications.md",
"diff": "@@ -9,7 +9,7 @@ permalink: /publications/\n# Publications\n[FuzzBench](https://dl.acm.org/doi/pdf/10.1145/3468264.3473932)\n-[[BibTeX](https://ieeexplore.ieee.org/abstract/document/9787836)]\n+[[BibTeX](https://google.github.io/fuzzbench/faq/#how-can-i-cite-fuzzbench-in-my-paper)]\nhas been widely used by many research works to evaluate fuzzers and will\ncontinue to serve on facilitating fuzzing evaluation for both academia and\nthe industry.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix FuzzBench BibTex (#1569) |
258,400 | 06.12.2022 05:21:32 | -28,800 | fc3252203e0ae47928e6d1b4c1d418f26025c0a1 | Request Rerun Wingfuzz
This version contains our miscellaneous tweaks to the original Wingfuzz. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/wingfuzz/builder.Dockerfile",
"new_path": "fuzzers/wingfuzz/builder.Dockerfile",
"diff": "@@ -16,6 +16,6 @@ ARG parent_image\nFROM $parent_image\nRUN git clone https://github.com/WingTecherTHU/wingfuzz\n-RUN cd wingfuzz && git checkout f1a8dd2a49fefb7b85ae42e3d204dec2999fc8eb && \\\n+RUN cd wingfuzz && git checkout 6ef3281f145fa1839df0f46c38b348ec9d93b0e2 && \\\n./build.sh && cd instrument && ./build.sh && clang -c WeakSym.c && \\\ncp ../libFuzzer.a /libWingfuzz.a && cp WeakSym.o / && cp LoadCmpTracer.so /\n"
},
{
"change_type": "MODIFY",
"old_path": "fuzzers/wingfuzz/fuzzer.py",
"new_path": "fuzzers/wingfuzz/fuzzer.py",
"diff": "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n-\"\"\"Integration code for Entropic fuzzer.\"\"\"\n+\"\"\"Integration code for Wingfuzz fuzzer.\"\"\"\nimport os\n@@ -47,8 +47,6 @@ def fuzz(input_corpus, output_corpus, target_binary):\ntarget_binary,\nextra_flags=[\n'-fork=0', '-keep_seed=1',\n- '-cross_over_uniform_dist=1',\n- '-entropic_scale_per_exec_time=1',\n'-jobs=2147483647', '-workers=1',\n'-reload=0'\n])\n"
},
{
"change_type": "MODIFY",
"old_path": "service/experiment-requests.yaml",
"new_path": "service/experiment-requests.yaml",
"diff": "# You can run \"make presubmit\" to do basic validation on this file.\n# Please add new experiment requests towards the top of this file.\n#\n+- experiment: 2022-12-05-rerun\n+ description: \"Wingfuzz coverage experiment (compare against core fuzzers)\"\n+ fuzzers:\n+ - afl\n+ - aflfast\n+ - aflplusplus\n+ - aflsmart\n+ - entropic\n+ - eclipser\n+ - fairfuzz\n+ - honggfuzz\n+ - lafintel\n+ - libfuzzer\n+ - mopt\n+ - wingfuzz\n- experiment: 2022-12-05-aflpp-cmplog\ndescription: \"afl++ cmplog enhancements\"\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Request Rerun Wingfuzz (#1568)
This version contains our miscellaneous tweaks to the original Wingfuzz. |
258,388 | 08.12.2022 14:15:44 | 18,000 | 574943fd91ed5fd62fc39dbbd8d4e3d7921a293c | Declare noninteractive to not wait for prompt | [
{
"change_type": "MODIFY",
"old_path": "docker/base-image/Dockerfile",
"new_path": "docker/base-image/Dockerfile",
"diff": "FROM ubuntu:focal\n+ENV DEBIAN_FRONTEND=noninteractive\n+\n# Python 3.10.8 is not the default version in Ubuntu 20.04 (Focal Fossa).\nENV PYTHON_VERSION 3.10.8\n# Install dependencies required by Python3 or Pip3.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Declare noninteractive to not wait for prompt (#1576) |
258,388 | 10.12.2022 17:01:36 | 18,000 | 1a7a5ca1b1a2a73d66ca48f9952e3b4e720725c1 | Write dispatcher output to log file so we can debug after failure | [
{
"change_type": "MODIFY",
"old_path": "experiment/resources/dispatcher-startup-script-template.sh",
"new_path": "experiment/resources/dispatcher-startup-script-template.sh",
"diff": "@@ -30,4 +30,4 @@ docker run --rm \\\n-e WORKER_POOL_NAME={{worker_pool_name}} \\\n--cap-add=SYS_PTRACE --cap-add=SYS_NICE \\\n-v /var/run/docker.sock:/var/run/docker.sock --name=dispatcher-container \\\n- {{docker_registry}}/dispatcher-image /work/startup-dispatcher.sh\n+ {{docker_registry}}/dispatcher-image /work/startup-dispatcher.sh &> /tmp/dispatcher.log\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Write dispatcher output to log file so we can debug after failure (#1580) |
258,388 | 12.12.2022 10:19:13 | 18,000 | 78afb4e735e05c7ec9523378db653a1d64ae6692 | Build python with sqlite3 support and stop using it unecessarily.
Build it with support so local users can use it instead of postgres. | [
{
"change_type": "MODIFY",
"old_path": "docker/base-image/Dockerfile",
"new_path": "docker/base-image/Dockerfile",
"diff": "@@ -27,7 +27,10 @@ RUN apt-get update && \\\nbuild-essential \\\nzlib1g-dev \\\nlibssl-dev \\\n- libffi-dev\n+ libffi-dev \\\n+ libsqlite3-dev \\\n+ libbz2-dev \\\n+ liblzma-dev\nRUN cd /tmp/ && \\\ncurl -O https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz && \\\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/scheduler.py",
"new_path": "experiment/scheduler.py",
"diff": "@@ -16,7 +16,6 @@ import datetime\nimport math\nimport multiprocessing\nimport os\n-import sqlite3\nimport sys\nimport random\nimport time\n@@ -104,7 +103,7 @@ def all_trials_ended(experiment: str) -> bool:\ntry:\nreturn not get_experiment_trials(experiment).filter(\nmodels.Trial.time_ended.is_(None)).all()\n- except sqlite3.OperationalError:\n+ except RuntimeError:\nlogger.error('Failed to check whether all trials ended.')\nreturn False\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Build python with sqlite3 support and stop using it unecessarily. (#1578)
Build it with support so local users can use it instead of postgres. |
258,402 | 13.12.2022 09:20:01 | -39,600 | 8f44d560456bd255baacdeeebc9ad83b5eff37af | Fix eclipser
1. Update `Eclipser` to a later commit that supports `Ubuntu20.04`.
2. Install and set `python2` as the default `python` to build
`Eclipser`. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/eclipser/runner.Dockerfile",
"new_path": "fuzzers/eclipser/runner.Dockerfile",
"diff": "@@ -27,7 +27,8 @@ RUN apt-get update -y && \\\nautoconf \\\nbison \\\ngit \\\n- gdb\n+ gdb \\\n+ python2\n# Use a copy of\n# https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb\n@@ -41,5 +42,7 @@ RUN wget -q https://storage.googleapis.com/fuzzbench-files/packages-microsoft-pr\n# Build Eclipser.\nRUN git clone https://github.com/SoftSec-KAIST/Eclipser.git /Eclipser && \\\ncd /Eclipser && \\\n- git checkout 310220649a4d790f8bc858ef85873399bba79a8c && \\\n- make\n+ git checkout ba1d7a55c168f7c19ecceb788a81ea07c2625e45 && \\\n+ ln -sf /usr/bin/python2.7 /usr/local/bin/python && \\\n+ make -j && \\\n+ ln -sf /usr/local/bin/python3.10 /usr/local/bin/python\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix eclipser (#1582)
1. Update `Eclipser` to a later commit that supports `Ubuntu20.04`.
2. Install and set `python2` as the default `python` to build
`Eclipser`. |
258,388 | 12.12.2022 18:13:43 | 18,000 | b93cc81777ff44aa9b97660e9c6b11820b1d7b8f | Delete experiment.yaml
DOngge I think you added this by accident right? | [
{
"change_type": "DELETE",
"old_path": "config/experiment.yaml",
"new_path": null,
"diff": "-benchmarks:\n-- curl_curl_fuzzer_http\n-- freetype2-2017\n-- harfbuzz-1.3.2\n-- jsoncpp_jsoncpp_fuzzer\n-- lcms-2017-03-21\n-- libjpeg-turbo-07-2017\n-- libpcap_fuzz_both\n-- libpng-1.2.56\n-- libxml2-v2.9.2\n-- libxslt_xpath\n-- mbedtls_fuzz_dtlsclient\n-- openssl_x509\n-- openthread-2019-12-23\n-- php_php-fuzz-parser\n-- proj4-2017-08-14\n-- re2-2014-12-09\n-- sqlite3_ossfuzz\n-- systemd_fuzz-link-parser\n-- vorbis-2017-12-11\n-- woff2-2016-05-06\n-- zlib_zlib_uncompress_fuzzer\n-cloud_compute_zone: us-central1-b\n-cloud_project: fuzzbench\n-cloud_sql_instance_connection_name: fuzzbench:us-central1:postgres-experiment-db=tcp:5432\n-concurrent_builds: 30\n-custom_seed_corpus_dir: null\n-description: null\n-docker_registry: gcr.io/fuzzbench\n-experiment: 2022-11-22-02-33-15m-dongge\n-experiment_filestore: gs://fuzzbench-data\n-fuzzers:\n-- libfuzzer\n-git_hash: c0608813379f2dce012fcb59d2dd12f581f8bc30\n-local_experiment: false\n-max_total_time: 910\n-measurers_cpus: null\n-merge_with_nonprivate: true\n-no_dictionaries: false\n-no_seeds: false\n-oss_fuzz_corpus: false\n-preemptible_runners: true\n-private: false\n-region_coverage: false\n-report_filestore: gs://www.fuzzbench.com/reports\n-runner_machine_type: n1-standard-1\n-runner_memory: 12GB\n-runner_num_cpu_cores: 1\n-runners_cpus: null\n-snapshot_period: 900\n-trials: 2\n-worker_pool_name: projects/fuzzbench/locations/us-central1/workerPools/buildpool\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Delete experiment.yaml (#1575)
DOngge I think you added this by accident right?
Co-authored-by: Dongge Liu <[email protected]> |
258,402 | 13.12.2022 12:54:51 | -39,600 | 2eebaef64134ab3bd0488245083fdabb49112b63 | Expect mock test to run with 150 concurrent builds
Our earlier commit [fix issue with
service](https://github.com/google/fuzzbench/commit/5ec25663710c9dc20d6623f82e01e79a7630f94c)
did not edit the corresponding test, hence introducing a CI failure.
This PR fixes that failure by adding the new parameter to the expected
call. | [
{
"change_type": "MODIFY",
"old_path": "service/test_automatic_run_experiment.py",
"new_path": "service/test_automatic_run_experiment.py",
"diff": "@@ -36,6 +36,8 @@ EXPERIMENT_REQUESTS = [{\n'oss_fuzz_corpus': True,\n}]\n+SERVICE_CONCURRENT_BUILDS = 150\n+\[email protected]('experiment.run_experiment.start_experiment')\[email protected]('common.logs.warning')\n@@ -125,6 +127,7 @@ def test_run_requested_experiment(mocked_get_requested_experiments,\nexpected_benchmarks,\nexpected_fuzzers,\ndescription='Test experiment',\n+ concurrent_builds=SERVICE_CONCURRENT_BUILDS,\noss_fuzz_corpus=True)\nstart_experiment_call_args = mocked_start_experiment.call_args_list\nassert len(start_experiment_call_args) == 1\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Expect mock test to run with 150 concurrent builds (#1583)
Our earlier commit [fix issue with
service](https://github.com/google/fuzzbench/commit/5ec25663710c9dc20d6623f82e01e79a7630f94c)
did not edit the corresponding test, hence introducing a CI failure.
This PR fixes that failure by adding the new parameter to the expected
call. |
258,402 | 13.12.2022 19:15:46 | -39,600 | 5d7362a6fc6647740abdebd0c7db13beb57809ea | Revive bug benchmarks
Bring back 5 bug-based benchmarks:
1. `arrow_parquet-arrow-fuzz`
2. `aspell_aspell_fuzzer`
3. `ffmpeg_ffmpeg_demuxer_fuzzer`
4. `file_magic_fuzzer`
5. `grok_grk_decompress_fuzzer` | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": ".github/workflows/fuzzers.yml",
"diff": "@@ -112,7 +112,7 @@ jobs:\nbenchmark_type:\n- oss-fuzz\n- standard\n- # - bug\n+ - bug\nsteps:\n- uses: actions/checkout@v2\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/arrow_parquet-arrow-fuzz/Dockerfile",
"new_path": "benchmarks/arrow_parquet-arrow-fuzz/Dockerfile",
"diff": "@@ -28,8 +28,6 @@ RUN apt-get update && \\\npython3\nRUN git clone \\\n- --depth=1 \\\n- --branch apache-arrow-10.0.0 \\\n--recurse-submodules \\\nhttps://github.com/apache/arrow.git \\\n$SRC/arrow\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/arrow_parquet-arrow-fuzz/benchmark.yaml",
"new_path": "benchmarks/arrow_parquet-arrow-fuzz/benchmark.yaml",
"diff": "+commit: 6cfe24633b9fe3c474137571940eca35d7a475dc\nfuzz_target: parquet-arrow-fuzz\nproject: arrow\n+type: bug\nunsupported_fuzzers:\n- honggfuzz # To Be Fixed.\n- libafl # To Be Fixed.\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/aspell_aspell_fuzzer/Dockerfile",
"new_path": "benchmarks/aspell_aspell_fuzzer/Dockerfile",
"diff": "FROM gcr.io/oss-fuzz-base/base-builder@sha256:fb1a9a49752c9e504687448d1f1a048ec1e062e2e40f7e8a23e86b63ff3dad7c\n-RUN apt-get update && apt-get upgrade -y && apt-get install -y pkg-config wget\n-\nRUN git clone \\\n- --depth 1 \\\n- --branch rel-0.60.8 \\\nhttps://github.com/gnuaspell/aspell.git \\\n$SRC/aspell\n@@ -28,8 +24,6 @@ RUN git clone \\\nhttps://github.com/gnuaspell/aspell-fuzz.git \\\n$SRC/aspell-fuzz\n-# Suppress an immediate UBSan violation that prevents fuzzing\n-RUN wget https://github.com/GNUAspell/aspell/commit/a2cd7ffd25e6213f36139cda4a911e2e03ed417c.patch -O $SRC/aspell/fix_aspell_ub.patch\nWORKDIR $SRC/aspell-fuzz\nCOPY build.sh $SRC/\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/aspell_aspell_fuzzer/benchmark.yaml",
"new_path": "benchmarks/aspell_aspell_fuzzer/benchmark.yaml",
"diff": "+commit: e8eb74793bce4fab381cc40f1c60f9572a99fb94\nfuzz_target: aspell_fuzzer\nproject: aspell\n+type: bug\nunsupported_fuzzers:\n- aflcc\n- afl_qemu\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/aspell_aspell_fuzzer/build.sh",
"new_path": "benchmarks/aspell_aspell_fuzzer/build.sh",
"diff": "#\n################################################################################\n-# Suppress an immediate UBSan violation that prevents fuzzing\n-pushd $SRC/aspell\n-git apply fix_aspell_ub.patch\n-popd\n# Run the OSS-Fuzz script in the fuzzer project.\npushd $SRC/aspell-fuzz\n-export LDFLAGS=\"$LDFLAGS -ldl\"\n./ossfuzz.sh\npopd\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/benchmark.yaml",
"new_path": "benchmarks/ffmpeg_ffmpeg_demuxer_fuzzer/benchmark.yaml",
"diff": "+commit: 7adeeff91f974ec5a69967dffe18331f666530eb\nfuzz_target: ffmpeg_DEMUXER_fuzzer\nproject: ffmpeg\n+type: bug\nunsupported_fuzzers:\n- libafl\n- aflcc\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/file_magic_fuzzer/Dockerfile",
"new_path": "benchmarks/file_magic_fuzzer/Dockerfile",
"diff": "@@ -18,8 +18,6 @@ FROM gcr.io/oss-fuzz-base/base-builder@sha256:fb1a9a49752c9e504687448d1f1a048ec1\nMAINTAINER [email protected]\nRUN apt-get update && apt-get install -y make autoconf automake libtool shtool zlib1g-dev\nRUN git clone \\\n- --depth 1 \\\n- --branch FILE5_43 \\\nhttps://github.com/file/file.git\nWORKDIR file\nCOPY build.sh magic_fuzzer.cc $SRC/\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/file_magic_fuzzer/benchmark.yaml",
"new_path": "benchmarks/file_magic_fuzzer/benchmark.yaml",
"diff": "+commit: 87060b287acdc06297bb73e668445e57023f3a75\n+commit_date: 2022-10-20T09:10:15+00:00\nfuzz_target: magic_fuzzer\nproject: file\n+type: bug\nunsupported_fuzzers:\n- aflcc\n- klee\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/grok_grk_decompress_fuzzer/Dockerfile",
"new_path": "benchmarks/grok_grk_decompress_fuzzer/Dockerfile",
"diff": "FROM gcr.io/oss-fuzz-base/base-builder@sha256:fb1a9a49752c9e504687448d1f1a048ec1e062e2e40f7e8a23e86b63ff3dad7c\nRUN git clone \\\n- --depth 1 \\\n- --branch v10.0.4 \\\nhttps://github.com/GrokImageCompression/grok.git \\\ngrok\nRUN git clone https://github.com/GrokImageCompression/grok-test-data.git \\\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/grok_grk_decompress_fuzzer/benchmark.yaml",
"new_path": "benchmarks/grok_grk_decompress_fuzzer/benchmark.yaml",
"diff": "+commit: 9cd001d3bb41e4a24e4fbaea95855110fbf3068a\nfuzz_target: grk_decompress_fuzzer\nproject: grok\n+type: bug\nunsupported_fuzzers:\n- centipede\n- aflcc\n"
},
{
"change_type": "MODIFY",
"old_path": "service/test_automatic_run_experiment.py",
"new_path": "service/test_automatic_run_experiment.py",
"diff": "@@ -85,12 +85,7 @@ def test_run_requested_experiment(mocked_get_requested_experiments,\n'sqlite3_ossfuzz',\n'systemd_fuzz-link-parser',\n'zlib_zlib_uncompress_fuzzer',\n- 'arrow_parquet-arrow-fuzz',\n- 'aspell_aspell_fuzzer',\n- 'ffmpeg_ffmpeg_demuxer_fuzzer',\n- 'file_magic_fuzzer',\n'freetype2-2017',\n- 'grok_grk_decompress_fuzzer',\n'harfbuzz-1.3.2',\n'lcms-2017-03-21',\n'libarchive_libarchive_fuzzer',\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Revive bug benchmarks (#1581)
Bring back 5 bug-based benchmarks:
1. `arrow_parquet-arrow-fuzz`
2. `aspell_aspell_fuzzer`
3. `ffmpeg_ffmpeg_demuxer_fuzzer`
4. `file_magic_fuzzer`
5. `grok_grk_decompress_fuzzer` |
258,402 | 15.12.2022 09:52:09 | -39,600 | e4f4562037c3306b5ce2008991c1504ffb835324 | Fix report generation by replacing all `NaN`s in experiment dataframe with `0`s.
Report generation breaks with error `pandas.errors.IntCastingNaNError:
Cannot convert non-finite values (NA or inf) to integer`, after we
upgrade `pandas` to a newer version.
This PR fixes this error by converting all `NaN` values in the result
data frame to `0`. | [
{
"change_type": "MODIFY",
"old_path": "analysis/data_utils.py",
"new_path": "analysis/data_utils.py",
"diff": "@@ -234,6 +234,9 @@ def experiment_summary(experiment_snapshots_df):\ndef benchmark_rank_by_mean(benchmark_snapshot_df, key='edges_covered'):\n\"\"\"Returns ranking of fuzzers based on mean coverage.\"\"\"\nassert benchmark_snapshot_df.time.nunique() == 1, 'Not a snapshot!'\n+ logger.debug('Mean: %s',\n+ benchmark_snapshot_df.groupby('fuzzer')[key].mean())\n+ benchmark_snapshot_df = benchmark_snapshot_df.fillna(0)\nmeans = benchmark_snapshot_df.groupby('fuzzer')[key].mean().astype(int)\nmeans.rename('mean cov', inplace=True)\nreturn means.sort_values(ascending=False)\n@@ -242,6 +245,9 @@ def benchmark_rank_by_mean(benchmark_snapshot_df, key='edges_covered'):\ndef benchmark_rank_by_median(benchmark_snapshot_df, key='edges_covered'):\n\"\"\"Returns ranking of fuzzers based on median coverage.\"\"\"\nassert benchmark_snapshot_df.time.nunique() == 1, 'Not a snapshot!'\n+ logger.debug('Median: %s',\n+ benchmark_snapshot_df.groupby('fuzzer')[key].median())\n+ benchmark_snapshot_df = benchmark_snapshot_df.fillna(0)\nmedians = benchmark_snapshot_df.groupby('fuzzer')[key].median().astype(int)\nmedians.rename('median cov', inplace=True)\nreturn medians.sort_values(ascending=False)\n@@ -251,6 +257,9 @@ def benchmark_rank_by_percent(benchmark_snapshot_df, key='edges_covered'):\n\"\"\"Returns ranking of fuzzers based on median (normalized/%) coverage.\"\"\"\nassert benchmark_snapshot_df.time.nunique() == 1, 'Not a snapshot!'\nmax_key = f'{key}_percent_max'\n+ logger.debug('Median: %s',\n+ benchmark_snapshot_df.groupby('fuzzer')[max_key].median())\n+ benchmark_snapshot_df = benchmark_snapshot_df.fillna(0)\nmedians = benchmark_snapshot_df.groupby('fuzzer')[max_key].median().astype(\nint)\nreturn medians.sort_values(ascending=False)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix report generation by replacing all `NaN`s in experiment dataframe with `0`s. (#1587)
Report generation breaks with error `pandas.errors.IntCastingNaNError:
Cannot convert non-finite values (NA or inf) to integer`, after we
upgrade `pandas` to a newer version.
This PR fixes this error by converting all `NaN` values in the result
data frame to `0`. |
258,402 | 16.12.2022 08:05:55 | -39,600 | aa6ddd056d7bd40e6308c137ef1f3a86290b176e | Launch 4 experiments
1. Re-run the latest 3 experiments (`2022-12-05-rerun`,
`2022-12-05-aflpp-cmplog`, and `2022-12-01-um`) and suffix their name
with `-c`.
2. Run core fuzzers on the 5 new benchmarks | [
{
"change_type": "MODIFY",
"old_path": "service/experiment-requests.yaml",
"new_path": "service/experiment-requests.yaml",
"diff": "# You can run \"make presubmit\" to do basic validation on this file.\n# Please add new experiment requests towards the top of this file.\n#\n+\n+\n+- experiment: 2022-12-15-bug-based\n+ description: \"Test running core fuzzers on 5 new bug-based benchmarks.\"\n+ fuzzers:\n+ - afl\n+ - aflfast\n+ - aflplusplus\n+ - aflsmart\n+ - centipede\n+ - eclipser\n+ - fairfuzz\n+ - honggfuzz\n+ - libafl\n+ - libfuzzer\n+ - mopt\n+ type: bug\n+ benchmarks:\n+ - arrow_parquet-arrow-fuzz\n+ - aspell_aspell_fuzzer\n+ - ffmpeg_ffmpeg_demuxer_fuzzer\n+ - file_magic_fuzzer\n+ - grok_grk_decompress_fuzzer\n+\n+- experiment: 2022-12-05-rerun-c\n+ description: \"Wingfuzz coverage experiment (compare against core fuzzers)\"\n+ fuzzers:\n+ - afl\n+ - aflfast\n+ - aflplusplus\n+ - aflsmart\n+ - entropic\n+ - eclipser\n+ - fairfuzz\n+ - honggfuzz\n+ - lafintel\n+ - libfuzzer\n+ - mopt\n+ - wingfuzz\n+\n+- experiment: 2022-12-05-rerun-c\n+ description: \"Wingfuzz coverage experiment (compare against core fuzzers)\"\n+ fuzzers:\n+ - afl\n+ - aflfast\n+ - aflplusplus\n+ - aflsmart\n+ - entropic\n+ - eclipser\n+ - fairfuzz\n+ - honggfuzz\n+ - lafintel\n+ - libfuzzer\n+ - mopt\n+ - wingfuzz\n+\n+- experiment: 2022-12-05-aflpp-cmplog-c\n+ description: \"afl++ cmplog enhancements\"\n+ fuzzers:\n+ - aflplusplus_cmplog\n+ - aflplusplus_cmplog_r\n+\n+- experiment: 2022-12-01-um-c\n+ description: \"Try out um prioritize 75 and random again\"\n+ fuzzers:\n+ - aflplusplus_um_random\n+ - aflplusplus_um_prioritize_75\n+\n- experiment: 2022-12-05-rerun-b\ndescription: \"Wingfuzz coverage experiment (compare against core fuzzers)\"\nfuzzers:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Launch 4 experiments (#1589)
1. Re-run the latest 3 experiments (`2022-12-05-rerun`,
`2022-12-05-aflpp-cmplog`, and `2022-12-01-um`) and suffix their name
with `-c`.
2. Run core fuzzers on the 5 new benchmarks
Co-authored-by: jonathanmetzman <[email protected]> |
258,388 | 03.01.2023 14:06:59 | 18,000 | 7311005d1285b1f2162c9e8cde0c9d17251e7a23 | Make build trigger build dispatcher-image. | [
{
"change_type": "MODIFY",
"old_path": "docker/gcb/base-images.yaml",
"new_path": "docker/gcb/base-images.yaml",
"diff": "@@ -42,4 +42,22 @@ steps:\n- DOCKER_BUILDKIT=1\nid: base-image\nname: docker:19.03.12\n+- args:\n+ - build\n+ - --tag\n+ - gcr.io/fuzzbench/dispatcher-image\n+ - --tag\n+ - gcr.io/fuzzbench/dispatcher-image:test-experiment\n+ - --cache-from\n+ - gcr.io/fuzzbench/dispatcher-image\n+ - --build-arg\n+ - BUILDKIT_INLINE_CACHE=1\n+ - --file\n+ - docker/dispatcher-image/Dockerfile\n+ - .\n+ env:\n+ - DOCKER_BUILDKIT=1\n+ id: dispatcher-image\n+ name: docker:19.03.12\n+\ntimeout: '1800s'\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Make build trigger build dispatcher-image. (#1577) |
258,402 | 10.01.2023 01:49:18 | -39,600 | c75f725eb27d23cf17dc316f3f9807eb3c6267be | Ignore `config/`
Launching experiments locally will automatically create a configuration
directory `config/` containing the configure file used by the
experiment.
The `git` repo does not need to keep track of this file, so this PR
removes with `.gitignore`. | [
{
"change_type": "MODIFY",
"old_path": ".gitignore",
"new_path": ".gitignore",
"diff": "# See the License for the specific language governing permissions and\n# limitations under the License.\n+# Ignore the configuration directory created by locally-launched experiments.\n+config/\n+\n# Byte-compiled / optimized / DLL files.\n__pycache__/\n*.py[cod]\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Ignore `config/` (#1603)
Launching experiments locally will automatically create a configuration
directory `config/` containing the configure file used by the
experiment.
The `git` repo does not need to keep track of this file, so this PR
removes with `.gitignore`. |
258,402 | 10.01.2023 11:48:08 | -39,600 | 6b6fdb696f0b1faceebff4db9ebfcfc98908f483 | A quick exp to test aflpp build.
Test if the failure aflpp build failure is flaky. | [
{
"change_type": "MODIFY",
"old_path": "service/experiment-requests.yaml",
"new_path": "service/experiment-requests.yaml",
"diff": "#\n+- experiment: 2023-01-10-aflpp\n+ description: \"Test if the previous aflpp build failure is flaky.\"\n+ fuzzers:\n+ - aflplusplus_tokens\n+ - aflplusplus\n+ trials: 2\n+ max_total_time: 910\n+\n- experiment: 2023-01-05-aflpp\ndescription: \"aflpp token test\"\nfuzzers:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | A quick exp to test aflpp build. (#1605)
Test if the failure aflpp build failure is flaky. |
258,402 | 18.01.2023 22:37:26 | -39,600 | f4decafd4393246c2d955f86401f1ad54b5c94c4 | Fix centipede linker flags
Mirrors [the fixes from
OSS-Fuzz](https://github.com/google/oss-fuzz/pull/9427):
1. Use [`-Wl` on the linker
flags](https://github.com/google/oss-fuzz/pull/9427#issuecomment-1385205488).
2. Use
[`LDFLAGS`](https://github.com/google/oss-fuzz/pull/9427#issuecomment-1385375441). | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/centipede/fuzzer.py",
"new_path": "fuzzers/centipede/fuzzer.py",
"diff": "@@ -24,11 +24,8 @@ def build():\nsan_cflags = ['-fsanitize-coverage=trace-loads']\nlink_cflags = [\n- '-Wno-error=unused-command-line-argument',\n- '-ldl',\n- '-lrt',\n- '-lpthread',\n- '/lib/weak.o',\n+ '-Wno-unused-command-line-argument',\n+ '-Wl,-ldl,-lrt,-lpthread,/lib/weak.o'\n]\n# TODO(Dongge): Build targets with sanitizers.\n@@ -41,6 +38,7 @@ def build():\ncflags = san_cflags + centipede_cflags + link_cflags\nutils.append_flags('CFLAGS', cflags)\nutils.append_flags('CXXFLAGS', cflags)\n+ utils.append_flags('LDFLAGS', ['/lib/weak.o'])\nos.environ['CC'] = '/clang/bin/clang'\nos.environ['CXX'] = '/clang/bin/clang++'\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix centipede linker flags (#1610)
Mirrors [the fixes from
OSS-Fuzz](https://github.com/google/oss-fuzz/pull/9427):
1. Use [`-Wl` on the linker
flags](https://github.com/google/oss-fuzz/pull/9427#issuecomment-1385205488).
2. Use
[`LDFLAGS`](https://github.com/google/oss-fuzz/pull/9427#issuecomment-1385375441). |
258,388 | 23.01.2023 18:16:25 | 18,000 | 0f6ec16d37514d65f435ae8a10e6daad5c991ecf | [xml] Fix bug | [
{
"change_type": "DELETE",
"old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/libxml2_xml_reader_for_file_fuzzer.cc",
"new_path": null,
"diff": "-// Copyright 2018 Google Inc.\n-//\n-// Licensed under the Apache License, Version 2.0 (the \"License\");\n-// you may not use this file except in compliance with the License.\n-// You may obtain a copy of the License at\n-//\n-// http://www.apache.org/licenses/LICENSE-2.0\n-//\n-// Unless required by applicable law or agreed to in writing, software\n-// distributed under the License is distributed on an \"AS IS\" BASIS,\n-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n-// See the License for the specific language governing permissions and\n-// limitations under the License.\n-\n-#include <fuzzer/FuzzedDataProvider.h>\n-\n-#include <cstddef>\n-#include <cstdint>\n-#include <string>\n-\n-#include \"fuzzer_temp_file.h\"\n-\n-#include \"libxml/xmlreader.h\"\n-\n-void ignore (void* ctx, const char* msg, ...) {\n- // Error handler to avoid spam of error messages from libxml parser.\n-}\n-\n-extern \"C\" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {\n- xmlSetGenericErrorFunc(NULL, &ignore);\n-\n- FuzzedDataProvider provider(data, size);\n- const int options = provider.ConsumeIntegral<int>();\n-\n- // libxml does not expect more than 100 characters, let's go beyond that.\n- const std::string encoding = provider.ConsumeRandomLengthString(128);\n- auto file_contents = provider.ConsumeRemainingBytes<uint8_t>();\n-\n- FuzzerTemporaryFile file(file_contents.data(), file_contents.size());\n-\n- xmlTextReaderPtr xmlReader =\n- xmlReaderForFile(file.filename(), encoding.c_str(), options);\n-\n- constexpr int kReadSuccessful = 1;\n- while (xmlTextReaderRead(xmlReader) == kReadSuccessful) {\n- xmlTextReaderNodeType(xmlReader);\n- xmlTextReaderConstValue(xmlReader);\n- }\n-\n- xmlFreeTextReader(xmlReader);\n- return EXIT_SUCCESS;\n-}\n"
},
{
"change_type": "RENAME",
"old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/Dockerfile",
"new_path": "benchmarks/libxml2_xml/Dockerfile",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/benchmark.yaml",
"new_path": "benchmarks/libxml2_xml/benchmark.yaml",
"diff": "-fuzz_target: libxml2_xml_reader_for_file_fuzzer\n+fuzz_target: xml\nproject: libxml2\ntype: bug-draft\nunsupported_fuzzers:\n"
},
{
"change_type": "RENAME",
"old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/build.sh",
"new_path": "benchmarks/libxml2_xml/build.sh",
"diff": "@@ -36,17 +36,15 @@ cd fuzz\nmake clean-corpus\nmake fuzz.o\n-for fuzzer in html regexp schema uri xml xpath; do\n- make $fuzzer.o\n- # Link with $CXX\n+make xml.o\n+# Link with $CXX.\n$CXX $CXXFLAGS \\\n- $fuzzer.o fuzz.o \\\n- -o $OUT/libxml2_xml_reader_for_file_fuzzer \\\n+ xml.o fuzz.o \\\n+ -o $OUT/xml \\\n$LIB_FUZZING_ENGINE \\\n../.libs/libxml2.a -Wl,-Bstatic -lz -llzma -Wl,-Bdynamic\n- [ -e seed/$fuzzer ] || make seed/$fuzzer.stamp\n- zip -j $OUT/${fuzzer}_seed_corpus.zip seed/$fuzzer/*\n-done\n+[ -e seed/xml ] || make seed/xml.stamp\n+zip -j $OUT/xml_seed_corpus.zip seed/xml/*\ncp *.dict *.options $OUT/\n"
},
{
"change_type": "RENAME",
"old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/fuzzer_temp_file.h",
"new_path": "benchmarks/libxml2_xml/fuzzer_temp_file.h",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "benchmarks/libxml2_libxml2_xml_reader_for_file_fuzzer/xml.dict",
"new_path": "benchmarks/libxml2_xml/xml.dict",
"diff": ""
}
] | Python | Apache License 2.0 | google/fuzzbench | [xml] Fix bug (#1592) |
258,388 | 24.01.2023 11:51:52 | 18,000 | e3ecfab2e6920e515cb363f475ef771cf9a57520 | Optimize CI for testing new fuzzer addition.
This removes the ability to test adding new benchmarks easily in CI.
That should be replaced with something in gcb, since mostly maintainers
do this.
Related: | [
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/workflows/benchmarks.yml",
"diff": "+name: Build fuzzers\n+on:\n+ pull_request:\n+ paths:\n+ - 'docker/**' # Base image changes.\n+ - 'fuzzers/**' # Changes to fuzzers themselves.\n+ - 'benchmarks/**' # Changes to benchmarks.\n+ # Changes that affect what gets built.\n+ - 'src_analysis/**'\n+ - '.github/worfkflows/fuzzers.yml'\n+ - '.github/worfkflows/build_and_test_run_fuzzer_benchmarks.py'\n+\n+jobs:\n+ build:\n+ runs-on: ubuntu-latest\n+ strategy:\n+ fail-fast: false\n+ matrix:\n+ benchmark:\n+ arrow_parquet-arrow-fuzz\n+ aspell_aspell_fuzzer\n+ bloaty_fuzz_target\n+ curl_curl_fuzzer_http\n+ ffmpeg_ffmpeg_demuxer_fuzzer\n+ file_magic_fuzzer\n+ freetype2-2017\n+ grok_grk_decompress_fuzzer\n+ harfbuzz-1.3.2\n+ jsoncpp_jsoncpp_fuzzer\n+ lcms-2017-03-21\n+ libarchive_libarchive_fuzzer\n+ libgit2_objects_fuzzer\n+ libhevc_hevc_dec_fuzzer\n+ libhtp_fuzz_htp\n+ libjpeg-turbo-07-2017\n+ libpcap_fuzz_both\n+ libpng-1.6.38\n+ libxml2_libxml2_xml_reader_for_file_fuzzer\n+ libxml2-v2.9.2\n+ libxslt_xpath\n+ matio_matio_fuzzer\n+ mbedtls_fuzz_dtlsclient\n+ mruby-2018-05-23\n+ muparser_set_eval_fuzzer\n+ njs_njs_process_script_fuzzer\n+ openh264_decoder_fuzzer\n+ openssl_x509\n+ openthread-2019-12-23\n+ oss_fuzz_benchmark_integration.py\n+ php_php-fuzz-execute\n+ php_php-fuzz-parser\n+ php_php-fuzz-parser-2020-07-25\n+ poppler_pdf_fuzzer\n+ proj4-2017-08-14\n+ proj4_standard_fuzzer\n+ quickjs_eval-2020-01-05\n+ re2-2014-12-09\n+ sqlite3_ossfuzz\n+ stb_stbi_read_fuzzer\n+ systemd_fuzz-link-parser\n+ systemd_fuzz-varlink\n+ usrsctp_fuzzer_connect\n+ vorbis-2017-12-11\n+ wireshark_fuzzshark_ip\n+ woff2-2016-05-06\n+ zlib_zlib_uncompress_fuzzer\n+ zstd_stream_decompress\n+\n+ steps:\n+ - uses: actions/checkout@v2\n+ - run: | # Needed for git diff to work.\n+ git fetch origin master --unshallow\n+ git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master\n+\n+ - name: Clear unnecessary files\n+ run: |\n+ sudo swapoff -a\n+ sudo rm -f /swapfile\n+ sudo apt clean\n+ docker rmi $(docker images -a -q)\n+ df -h\n+\n+ - name: Setup Python environment\n+ uses: actions/setup-python@v2\n+ with:\n+ python-version: 3.10.8\n+\n+ # Copied from:\n+ # https://docs.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions\n+ - name: Cache pip\n+ uses: actions/cache@v2\n+ with:\n+ # This path is specific to Ubuntu.\n+ path: ~/.cache/pip\n+ # Look to see if there is a cache hit for the corresponding requirements\n+ # file.\n+ key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}\n+ restore-keys: |\n+ ${{ runner.os }}-pip-\n+ ${{ runner.os }}-\n+\n+ - name: Install dependencies\n+ run: |\n+ make install-dependencies\n+\n+ - name: Build Benchmarks\n+ run: |\n+ PATH=.venv/bin/:$PATH PYTHONPATH=. python3 .github/workflows/build_and_test_run_fuzzer_benchmarks.py ${{ matrix.benchmark }}\n"
},
{
"change_type": "MODIFY",
"old_path": ".github/workflows/build_and_test_run_fuzzer_benchmarks.py",
"new_path": ".github/workflows/build_and_test_run_fuzzer_benchmarks.py",
"diff": "@@ -17,13 +17,11 @@ import sys\nimport subprocess\nimport time\n-from common import benchmark_utils\nfrom common import retry\nfrom experiment.build import builder\nfrom src_analysis import change_utils\nfrom src_analysis import diff_utils\n-ALWAYS_BUILD_FUZZER = 'afl'\nNUM_RETRIES = 2\nRETRY_DELAY = 60\n@@ -85,16 +83,16 @@ def run_command(command):\nsubprocess.check_call(command)\n-def make_builds(benchmarks, fuzzer):\n- \"\"\"Use make to test the fuzzer on each benchmark in |benchmarks|.\"\"\"\n- fuzzer_benchmark_pairs = builder.get_fuzzer_benchmark_pairs([fuzzer],\n- benchmarks)\n+def make_builds(benchmark, fuzzers):\n+ \"\"\"Use make to test the |benchmark| on each fuzzer in |fuzzers|.\"\"\"\n+ fuzzer_benchmark_pairs = builder.get_fuzzer_benchmark_pairs(\n+ fuzzers, [benchmark])\n# Sort benchmarks so that they get built in a deterministic order.\nfuzzer_benchmark_pairs = sorted(fuzzer_benchmark_pairs,\nkey=lambda pair: pair[1])\nprint(f'Building fuzzer-benchmark pairs: {fuzzer_benchmark_pairs}')\n- for _, benchmark in fuzzer_benchmark_pairs:\n- make_target = get_make_target(fuzzer, benchmark)\n+ for current_fuzzer, current_benchmark in fuzzer_benchmark_pairs:\n+ make_target = get_make_target(current_fuzzer, current_benchmark)\nmake_command = ['make', 'RUNNING_ON_CI=yes', '-j', make_target]\nrun_command(make_command)\n@@ -107,44 +105,21 @@ def make_builds(benchmarks, fuzzer):\nreturn True\n-def do_build(build_type, fuzzer, always_build):\n- \"\"\"Build fuzzer,benchmark pairs for CI.\"\"\"\n- if build_type == 'oss-fuzz':\n- benchmarks = benchmark_utils.get_oss_fuzz_coverage_benchmarks()\n- elif build_type == 'standard':\n- benchmarks = benchmark_utils.get_standard_coverage_benchmarks()\n- elif build_type == 'bug':\n- benchmarks = benchmark_utils.get_bug_benchmarks()\n- else:\n- raise Exception(f'Invalid build_type: {build_type}')\n-\n- if always_build:\n- # Always do a build if always_build is True.\n- return make_builds(benchmarks, fuzzer)\n-\n+def do_build(benchmark):\n+ \"\"\"Build the benchmark with every changed fuzzer.\"\"\"\nchanged_files = diff_utils.get_changed_files()\nchanged_fuzzers = change_utils.get_changed_fuzzers(changed_files)\n- if fuzzer in changed_fuzzers:\n- # Otherwise if fuzzer is in changed_fuzzers then build it with all\n- # benchmarks, the change could have affected any benchmark.\n- return make_builds(benchmarks, fuzzer)\n-\n- # Otherwise, only build benchmarks that have changed.\n- changed_benchmarks = change_utils.get_changed_benchmarks(changed_files)\n- benchmarks = set(benchmarks).intersection(changed_benchmarks)\n- return make_builds(benchmarks, fuzzer)\n+ # Only build fuzzers that have changed.\n+ return make_builds(benchmark, changed_fuzzers)\ndef main():\n\"\"\"Build OSS-Fuzz or standard benchmarks with a fuzzer.\"\"\"\n- if len(sys.argv) != 3:\n- print(f'Usage: {sys.argv[0]} <build_type> <fuzzer>')\n+ if len(sys.argv) != 2:\n+ print(f'Usage: {sys.argv[0]} <benchmark>')\nreturn 1\n- build_type = sys.argv[1]\n- fuzzer = sys.argv[2]\n- always_build = ALWAYS_BUILD_FUZZER == fuzzer\n- result = do_build(build_type, fuzzer, always_build)\n- return 0 if result else 1\n+ benchmark = sys.argv[1]\n+ return 0 if do_build(benchmark) else 1\nif __name__ == '__main__':\n"
},
{
"change_type": "DELETE",
"old_path": ".github/workflows/fuzzers.yml",
"new_path": null,
"diff": "-name: Build fuzzers\n-on:\n- pull_request:\n- paths:\n- - 'docker/**' # Base image changes.\n- - 'fuzzers/**' # Changes to fuzzers themselves.\n- - 'benchmarks/**' # Changes to benchmarks.\n- # Changes that affect what gets built.\n- - 'src_analysis/**'\n- - '.github/worfkflows/fuzzers.yml'\n- - '.github/worfkflows/build_and_test_run_fuzzer_benchmarks.py'\n-\n-jobs:\n- build:\n- runs-on: ubuntu-latest\n- strategy:\n- fail-fast: false\n- matrix:\n- fuzzer:\n- # Default fuzzers general comparison evaluation.\n- - afl\n- - aflfast\n- - aflplusplus\n- - aflsmart\n- - centipede\n- - eclipser\n- - fairfuzz\n- - honggfuzz\n- - libafl\n- - libfuzzer\n- - mopt\n- # Greybox fuzzers.\n- - wingfuzz\n- - libafl_forkserver\n- # - tortoisefuzz # To Be Fixed.\n- # Symbolic ececution.\n- # - klee # To Be Fixed.\n- # Concolic execution.\n- # - symcc_aflplusplus # To Be Fixed.\n- # Grammar fuzzers.\n- # - nautilus # To Be Fixed.\n- # - gramatron # To Be Fixed.\n- # - token_level # To Be Fixed.\n- # - grimoire # To Be Fixed.\n- # Temporary variants.\n- # - aflplusplus_um_prioritize\n- # - aflplusplus_um_prioritize_75\n- # - aflplusplus_um_random\n- # - aflplusplus_um_random_3\n- # - aflplusplus_um_random_6\n- # - aflplusplus_um_random_75\n- # To be Removed.\n- # - introspector_driven_focus\n- # - centipede_function_filter\n- # - aflplusplus_dict2file\n- # - afl_2_52_b\n- - aflplusplus_cmplog\n- - aflplusplus_cmplog_exp\n- - aflplusplus_cmplog_exp1\n- - aflplusplus_unfuzzed\n- - aflplusplus_faved\n- # - afl_random_favored\n- # - entropic_execute_final\n- # - libfuzzer_exeute_final\n- # - libfuzzer_fork_parallel\n- # - afl_um_prioritize\n- # - afl_um_random\n- # - afl_um_parallel\n- # - aflplusplus_optimal\n- # - aflplusplus_tracepc\n- # - aflplusplus_um_parallel\n- # - honggfuzz_um_random\n- # - honggfuzz_um_random_75\n- # - honggfuzz_um_prioritize\n- # - honggfuzz_um_prioritize_75\n- # - honggfuzz_um_parallel\n- # - libfuzzer_um_random\n- # - libfuzzer_um_random_75\n- # - libfuzzer_um_prioritize\n- # - libfuzzer_um_prioritize_75\n- # - libfuzzer_um_parallel\n- # - libfuzzer_dataflow\n- # - libfuzzer_dataflow_load\n- # - libfuzzer_dataflow_store\n- # - libfuzzer_dataflow_pre\n- # - libafl_text\n- # - pythia_effect_bb\n- ## Binary-only (greybox) fuzzers.\n- # - eclipser_um_prioritize\n- # - eclipser_um_prioritize_75\n- # - eclipser_um_random\n- # - eclipser_um_random_75\n- # - eclipser_um_parallel\n- ## Binary-only (greybox) fuzzers.\n- # - afl_qemu\n- # - honggfuzz_qemu\n- # - weizz_qemu\n- # - aflplusplus_qemu\n- # - aflplusplus_frida\n- ## Concolic fuzzers.\n- # - fuzzolic_aflplusplus_z3\n- # - fuzzolic_aflplusplus_fuzzy\n- # - eclipser_aflplusplus\n- # - symqemu_aflplusplus\n- # - symcc_aflplusplus_single\n- # - symcc_afl\n- ## Concolic execution\n- # - symcc_afl_single\n- ## Deprecated.\n- # - entropic\n- # - lafintel\n- # - neuzz\n- # - pythia_bb\n- # - fafuzz\n-\n- benchmark_type:\n- - oss-fuzz\n- - standard\n- - bug\n-\n- steps:\n- - uses: actions/checkout@v2\n- - run: | # Needed for git diff to work.\n- git fetch origin master --unshallow\n- git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master\n-\n- - name: Clear unnecessary files\n- run: |\n- sudo swapoff -a\n- sudo rm -f /swapfile\n- sudo apt clean\n- docker rmi $(docker images -a -q)\n- df -h\n-\n- - name: Setup Python environment\n- uses: actions/setup-python@v2\n- with:\n- python-version: 3.10.8\n-\n- # Copied from:\n- # https://docs.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions\n- - name: Cache pip\n- uses: actions/cache@v2\n- with:\n- # This path is specific to Ubuntu.\n- path: ~/.cache/pip\n- # Look to see if there is a cache hit for the corresponding requirements\n- # file.\n- key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}\n- restore-keys: |\n- ${{ runner.os }}-pip-\n- ${{ runner.os }}-\n-\n- - name: Install dependencies\n- run: |\n- make install-dependencies\n-\n- - name: Build Benchmarks\n- run: |\n- PATH=.venv/bin/:$PATH PYTHONPATH=. python3 .github/workflows/build_and_test_run_fuzzer_benchmarks.py ${{ matrix.benchmark_type }} ${{ matrix.fuzzer }}\n"
},
{
"change_type": "MODIFY",
"old_path": "common/benchmark_utils.py",
"new_path": "common/benchmark_utils.py",
"diff": "@@ -55,11 +55,6 @@ def get_type(benchmark):\nBenchmarkType.CODE.value)\n-def is_oss_fuzz_benchmark(benchmark):\n- \"\"\"Returns if benchmark is a OSS-Fuzz benchmark.\"\"\"\n- return bool(benchmark_config.get_config(benchmark).get('commit_date'))\n-\n-\ndef get_runner_image_url(experiment, benchmark, fuzzer, docker_registry):\n\"\"\"Get the URL of the docker runner image for fuzzing the benchmark with\nfuzzer.\"\"\"\n@@ -129,25 +124,9 @@ def get_all_benchmarks():\ndef get_coverage_benchmarks():\n\"\"\"Returns the list of all coverage benchmarks.\"\"\"\n- return (get_oss_fuzz_coverage_benchmarks() +\n- get_standard_coverage_benchmarks())\n-\n-\n-def get_oss_fuzz_coverage_benchmarks():\n- \"\"\"Returns the list of OSS-Fuzz coverage benchmarks.\"\"\"\n- return [\n- benchmark for benchmark in get_all_benchmarks()\n- if is_oss_fuzz_benchmark(benchmark) and\n- get_type(benchmark) == BenchmarkType.CODE.value\n- ]\n-\n-\n-def get_standard_coverage_benchmarks():\n- \"\"\"Returns the list of standard coverage benchmarks.\"\"\"\nreturn [\nbenchmark for benchmark in get_all_benchmarks()\n- if not is_oss_fuzz_benchmark(benchmark) and\n- get_type(benchmark) == BenchmarkType.CODE.value\n+ if get_type(benchmark) == BenchmarkType.CODE.value\n]\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/developing-fuzzbench/adding_a_new_benchmark.md",
"new_path": "docs/developing-fuzzbench/adding_a_new_benchmark.md",
"diff": "@@ -218,6 +218,12 @@ make run-$FUZZER_NAME-$BENCHMARK_NAME\n## Submitting the benchmark in a pull request\n+* Add your benchmark to the list in `.github/workflows/benchmarks.yml` so that\n+ our continuous integration will test that your fuzzer can build and briefly\n+ run on all benchmarks once you've submitted a pull request.\n+\n+* Submit the integration in a\n+[GitHub pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).\nIf everything works, submit the integration in a\n[GitHub pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).\n"
},
{
"change_type": "MODIFY",
"old_path": "docs/getting-started/adding_a_new_fuzzer.md",
"new_path": "docs/getting-started/adding_a_new_fuzzer.md",
"diff": "@@ -323,9 +323,5 @@ in order for fuzzing to start.\n## Submitting your integration\n-* Add your fuzzer to the list in `.github/workflows/fuzzers.yml` so that our\n- continuous integration will test that your fuzzer can build and briefly run on\n- all benchmarks once you've submitted a pull request.\n-\n* Submit the integration in a\n[GitHub pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).\n"
},
{
"change_type": "MODIFY",
"old_path": "presubmit.py",
"new_path": "presubmit.py",
"diff": "@@ -98,18 +98,6 @@ def get_benchmark(path: Path) -> Optional[str]:\nreturn get_containing_subdir(path, _SRC_ROOT / 'benchmarks')\n-def is_fuzzer_tested_in_ci(fuzzer: str) -> bool:\n- \"\"\"Returns True if |fuzzer| is in the list of fuzzers tested in\n- fuzzers.yml.\"\"\"\n- yaml_filepath = _SRC_ROOT / '.github' / 'workflows' / 'fuzzers.yml'\n- yaml_contents = yaml_utils.read(yaml_filepath)\n- fuzzer_list = yaml_contents['jobs']['build']['strategy']['matrix']['fuzzer']\n- is_tested = fuzzer in fuzzer_list\n- if not is_tested:\n- print(f'{fuzzer} is not included in fuzzer list in {yaml_filepath}.')\n- return is_tested\n-\n-\nclass FuzzerAndBenchmarkValidator:\n\"\"\"Class that validates the names of fuzzers and benchmarks.\"\"\"\n@@ -129,10 +117,6 @@ class FuzzerAndBenchmarkValidator:\n# We know this is invalid and have already complained about it.\nreturn False\n- if fuzzer != 'coverage' and not is_fuzzer_tested_in_ci(fuzzer):\n- self.invalid_fuzzers.add(fuzzer)\n- return False\n-\nif fuzzer_utils.validate(fuzzer):\nreturn True\n"
},
{
"change_type": "MODIFY",
"old_path": "service/automatic_run_experiment.py",
"new_path": "service/automatic_run_experiment.py",
"diff": "@@ -144,7 +144,7 @@ def _validate_individual_experiment_requests(experiment_requests):\nexperiment_type, benchmark_utils.BENCHMARK_TYPE_STRS)\nvalid = False\n- benchmarks = request.get('benchmarks', [])\n+ benchmarks = sorted(request.get('benchmarks', [])) # Sort for testing.\nfor benchmark in benchmarks:\nbenchmark_type = benchmark_utils.get_type(benchmark)\nif (benchmark_type == benchmark_utils.BenchmarkType.BUG.value and\n"
},
{
"change_type": "MODIFY",
"old_path": "service/test_automatic_run_experiment.py",
"new_path": "service/test_automatic_run_experiment.py",
"diff": "@@ -73,7 +73,7 @@ def test_run_requested_experiment(mocked_get_requested_experiments,\nexpected_config_file = os.path.join(utils.ROOT_DIR, 'service',\n'experiment-config.yaml')\n- expected_benchmarks = [\n+ expected_benchmarks = sorted([\n'bloaty_fuzz_target',\n'curl_curl_fuzzer_http',\n'jsoncpp_jsoncpp_fuzzer',\n@@ -98,7 +98,7 @@ def test_run_requested_experiment(mocked_get_requested_experiments,\n'stb_stbi_read_fuzzer',\n'vorbis-2017-12-11',\n'woff2-2016-05-06',\n- ]\n+ ])\nexpected_call = mock.call(expected_experiment_name,\nexpected_config_file,\nexpected_benchmarks,\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Optimize CI for testing new fuzzer addition. (#1627)
This removes the ability to test adding new benchmarks easily in CI.
That should be replaced with something in gcb, since mostly maintainers
do this.
Related:
https://github.com/google/fuzzbench/issues/1556
https://github.com/google/fuzzbench/issues/1590 |
258,388 | 24.01.2023 14:04:51 | 18,000 | d96a95fe6d0903af129451e04418665ccd14c385 | [zstd] Fix build | [
{
"change_type": "MODIFY",
"old_path": "benchmarks/zstd_stream_decompress/build.sh",
"new_path": "benchmarks/zstd_stream_decompress/build.sh",
"diff": "@@ -25,16 +25,5 @@ make -j seedcorpora\nfor target in \"stream_decompress\"; do\ncp \"$target\" \"$OUT\"\n-\n- options=default.options\n- if [ -f \"$target.options\" ]; then\n- options=\"$target.options\"\n- fi\n- cp \"$options\" \"$OUT/$target.options\"\n-\n- if [ -f \"$target.dict\" ]; then\n- cp \"$target.dict\" \"$OUT\"\n- fi\n-\ncp \"corpora/${target}_seed_corpus.zip\" \"$OUT\"\ndone\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [zstd] Fix build (#1630) |
258,388 | 24.01.2023 18:12:36 | 18,000 | 5127f3dbb71744be7f3f2c3236aadf7f7ac6bef7 | Fix benchmarks.yml
Remove debug code | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/benchmarks.yml",
"new_path": ".github/workflows/benchmarks.yml",
"diff": "@@ -42,7 +42,6 @@ jobs:\n- mbedtls_fuzz_dtlsclient\n- mruby-2018-05-23\n- muparser_set_eval_fuzzer\n- - fake\n- njs_njs_process_script_fuzzer\n- openh264_decoder_fuzzer\n- openssl_x509\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix benchmarks.yml (#1633)
Remove debug code |
258,388 | 24.01.2023 23:52:49 | 18,000 | 33a2631942a5311467a10061d0d5a8c2a64fbdce | Allow running experiments from PRs using GCB
Fixes: | [
{
"change_type": "MODIFY",
"old_path": ".dockerignore",
"new_path": ".dockerignore",
"diff": ".pytest_cache\n.pytype\n.venv\n-__pycache__\n+**__pycache__*\ndocs\nreport*\n\\ No newline at end of file\n-third_party/oss-fuzz/build\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -282,11 +282,16 @@ def check_no_uncommitted_changes():\nraise ValidationError('Local uncommitted changes found, exiting.')\n-def get_git_hash():\n+def get_git_hash(allow_uncommitted_changes):\n\"\"\"Return the git hash for the last commit in the local repo.\"\"\"\n+ try:\noutput = subprocess.check_output(['git', 'rev-parse', 'HEAD'],\ncwd=utils.ROOT_DIR)\nreturn output.strip().decode('utf-8')\n+ except subprocess.CalledProcessError as error:\n+ if not allow_uncommitted_changes:\n+ raise error\n+ return ''\ndef start_experiment( # pylint: disable=too-many-arguments\n@@ -315,7 +320,7 @@ def start_experiment( # pylint: disable=too-many-arguments\nconfig['fuzzers'] = fuzzers\nconfig['benchmarks'] = benchmarks\nconfig['experiment'] = experiment_name\n- config['git_hash'] = get_git_hash()\n+ config['git_hash'] = get_git_hash(allow_uncommitted_changes)\nconfig['no_seeds'] = no_seeds\nconfig['no_dictionaries'] = no_dictionaries\nconfig['oss_fuzz_corpus'] = oss_fuzz_corpus\n@@ -597,7 +602,12 @@ def get_dispatcher(config: Dict) -> BaseDispatcher:\ndef main():\n- \"\"\"Run an experiment in the cloud.\"\"\"\n+ \"\"\"Run an experiment.\"\"\"\n+ return run_experiment_main()\n+\n+\n+def run_experiment_main(args=None):\n+ \"\"\"Run an experiment.\"\"\"\nlogs.initialize()\nparser = argparse.ArgumentParser(\n@@ -687,7 +697,7 @@ def main():\nrequired=False,\ndefault=False,\naction='store_true')\n- args = parser.parse_args()\n+ args = parser.parse_args(args)\nfuzzers = args.fuzzers or all_fuzzers\nconcurrent_builds = args.concurrent_builds\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "service/Dockerfile",
"diff": "+# Copyright 2023 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+################################################################################\n+\n+FROM gcr.io/cloud-builders/gcloud\n+\n+RUN apt-get update && apt-get install python3-pip -y\n+\n+# Do this expensive step before the cache is destroyed.\n+COPY ./requirements.txt /tmp/requirements.txt\n+RUN pip install -r /tmp/requirements.txt\n+RUN pip install PyGithub==1.51\n+\n+ENV FUZZBENCH_DIR /opt/fuzzbench\n+COPY . $FUZZBENCH_DIR\n+\n+WORKDIR $FUZZBENCH_DIR\n+ENV PYTHONPATH=$FUZZBENCH_DIR\n+ENV FORCE_LOCAL=1\n+ENTRYPOINT [\"python3\", \"/opt/fuzzbench/service/gcbrun_experiment.py\"]\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "service/gcbrun_experiment.py",
"diff": "+# Copyright 2023 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+################################################################################\n+\"\"\"Entrypoint for gcbrun into run_experiment. This script will get the command\n+from the last PR comment containing \"/gcbrun\" and pass it to run_experiment.py\n+which will run an experiment.\"\"\"\n+\n+import logging\n+import os\n+import sys\n+\n+# pytype: disable=import-error\n+import github # pylint: disable=import-error\n+\n+from experiment import run_experiment\n+\n+TRIGGER_COMMAND = '/gcbrun'\n+RUN_EXPERIMENT_COMMAND_STR = f'{TRIGGER_COMMAND} run_experiment.py '\n+SKIP_COMMAND_STR = f'{TRIGGER_COMMAND} skip'\n+\n+\n+def get_comments(pull_request_number):\n+ \"\"\"Returns comments on the GitHub Pull request referenced by\n+ |pull_request_number|.\"\"\"\n+ github_obj = github.Github()\n+ repo = github_obj.get_repo('google/fuzzbench')\n+ pull = repo.get_pull(pull_request_number)\n+ pull_comments = list(pull.get_comments())\n+ issue = repo.get_issue(pull_request_number)\n+ issue_comments = list(issue.get_comments())\n+ # Github only returns comments if from the pull object when a pull request\n+ # is open. If it is a draft, it will only return comments from the issue\n+ # object.\n+ return pull_comments + issue_comments\n+\n+\n+def get_latest_gcbrun_command(comments):\n+ \"\"\"Gets the last /gcbrun comment from comments.\"\"\"\n+ for comment in reversed(comments):\n+ # This seems to get comments on code too.\n+ body = comment.body\n+ if body.startswith(SKIP_COMMAND_STR):\n+ return None\n+ if not body.startswith(RUN_EXPERIMENT_COMMAND_STR):\n+ continue\n+ if len(body) == len(RUN_EXPERIMENT_COMMAND_STR):\n+ return None\n+ return body[len(RUN_EXPERIMENT_COMMAND_STR):].strip().split(' ')\n+ return None\n+\n+\n+def exec_command_from_github(pull_request_number):\n+ \"\"\"Executes the gcbrun command for run_experiment.py in the most recent\n+ command on |pull_request_number|.\"\"\"\n+ comments = get_comments(pull_request_number)\n+ print(comments)\n+ command = get_latest_gcbrun_command(comments)\n+ if command is None:\n+ logging.info('Experiment not requested.')\n+ return None\n+ print(command)\n+ logging.info('Command: %s.', command)\n+ return run_experiment.run_experiment_main(command)\n+\n+\n+def main():\n+ \"\"\"Entrypoint for GitHub CI into run_experiment.py\"\"\"\n+ logging.basicConfig(level=logging.INFO)\n+ pull_request_number = int(os.environ['PULL_REQUEST_NUMBER'])\n+ result = exec_command_from_github(pull_request_number)\n+ if result or result is None:\n+ return 0\n+ return 1\n+\n+\n+if __name__ == '__main__':\n+ sys.exit(main())\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "service/run_experiment_cloudbuild.yaml",
"diff": "+steps:\n+- name: 'gcr.io/cloud-builders/docker'\n+ args:\n+ - build\n+ - -t\n+ - gcr.io/fuzzbench/experiment-runner\n+ - --build-arg\n+ - BUILDKIT_INLINE_CACHE=1\n+ - --cache-from\n+ - gcr.io/fuzzbench/experiment-runner\n+ - -f\n+ - service/Dockerfile\n+ - .\n+ env:\n+ - 'DOCKER_BUILDKIT=1'\n+- name: 'gcr.io/fuzzbench/experiment-runner'\n+ args: []\n+ env:\n+ - 'PULL_REQUEST_NUMBER=${_PR_NUMBER}'\n+ - 'POSTGRES_PASSWORD=${_POSTGRES_PASSWORD}'\n+ timeout: 1800s # 30 minutes\n+timeout: 1800s\n+options:\n+ logging: CLOUD_LOGGING_ONLY\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Allow running experiments from PRs using GCB (#1637)
Fixes: #1599 |
258,402 | 27.01.2023 18:32:10 | -39,600 | f8e3972f332412e8070ec92e38c1dbae9b655450 | Request a test experiment
Request an experiment to test the recent changes. | [
{
"change_type": "MODIFY",
"old_path": "service/experiment-requests.yaml",
"new_path": "service/experiment-requests.yaml",
"diff": "# Please add new experiment requests towards the top of this file.\n#\n+\n+- experiment: 2023-01-27-test-request\n+ description: \"Test if the new system can run experiments by online request.\"\n+ fuzzers:\n+ - aflplusplus\n+ - centipede\n+ - honggfuzz\n+ - libfuzzer\n+\n- experiment: 2023-01-25-libafl\ndescription: \"libafl grammar comparison\"\nfuzzers:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Request a test experiment (#1643)
Request an experiment to test the recent changes. |
258,388 | 30.01.2023 13:44:20 | 18,000 | e580cec49636c03e2557515d2df5e8aa65586610 | Don't specify minor version of python | [
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -48,7 +48,7 @@ SHELL := /bin/bash\nVENV_ACTIVATE := .venv/bin/activate\n${VENV_ACTIVATE}: requirements.txt\n- python3.10.8 -m venv .venv || python3 -m venv .venv\n+ python3.10 -m venv .venv || python3 -m venv .venv\nsource ${VENV_ACTIVATE} && python3 -m pip install --upgrade pip setuptools && python3 -m pip install -r requirements.txt\ninstall-dependencies: ${VENV_ACTIVATE}\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Don't specify minor version of python (#1653) |
258,388 | 30.01.2023 13:52:38 | 18,000 | c3a8b96e5a180a76760e1852306ba41a83943f84 | Use POSTGRES_PASSWORD | [
{
"change_type": "MODIFY",
"old_path": "service/Dockerfile",
"new_path": "service/Dockerfile",
"diff": "@@ -19,6 +19,7 @@ FROM gcr.io/cloud-builders/gcloud\nRUN apt-get update && apt-get install python3-pip -y\n# Do this expensive step before the cache is destroyed.\n+RUN pip install pip --upgrade\nCOPY ./requirements.txt /tmp/requirements.txt\nRUN pip install -r /tmp/requirements.txt\nRUN pip install PyGithub==1.51\n"
},
{
"change_type": "MODIFY",
"old_path": "service/gcbrun_experiment.py",
"new_path": "service/gcbrun_experiment.py",
"diff": "@@ -80,7 +80,8 @@ def main():\nlogging.basicConfig(level=logging.INFO)\npull_request_number = int(os.environ['PULL_REQUEST_NUMBER'])\nresult = exec_command_from_github(pull_request_number)\n- if result or result is None:\n+ print('result', result)\n+ if not result:\nreturn 0\nreturn 1\n"
},
{
"change_type": "MODIFY",
"old_path": "service/run_experiment_cloudbuild.yaml",
"new_path": "service/run_experiment_cloudbuild.yaml",
"diff": "@@ -17,8 +17,13 @@ steps:\nargs: []\nenv:\n- 'PULL_REQUEST_NUMBER=${_PR_NUMBER}'\n- - 'POSTGRES_PASSWORD=${_POSTGRES_PASSWORD}'\n+ secretEnv:\n+ - 'POSTGRES_PASSWORD'\ntimeout: 1800s # 30 minutes\ntimeout: 1800s\noptions:\nlogging: CLOUD_LOGGING_ONLY\n+availableSecrets:\n+ secretManager:\n+ - versionName: projects/fuzzbench/secrets/POSTGRES_PASSWORD/versions/1\n+ env: 'POSTGRES_PASSWORD'\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Use POSTGRES_PASSWORD (#1652) |
258,388 | 30.01.2023 15:26:10 | 18,000 | 8f35c5a2c7d19ce1472db90c40951fca4be76c83 | Change build time limit back to 4 hours | [
{
"change_type": "MODIFY",
"old_path": "experiment/build/gcb_build.py",
"new_path": "experiment/build/gcb_build.py",
"diff": "@@ -29,7 +29,7 @@ from experiment.build import generate_cloudbuild\nCONFIG_DIR = 'config'\n# Maximum time to wait for a GCB config to finish build.\n-GCB_BUILD_TIMEOUT = 13 * 60 * 60 # 4 hours.\n+GCB_BUILD_TIMEOUT = 4 * 60 * 60 # 4 hours.\nlogger = logs.Logger() # pylint: disable=invalid-name\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Change build time limit back to 4 hours (#1654) |
258,388 | 30.01.2023 19:06:31 | 18,000 | 823cbfa42d407840e46f5ed9a9758fd84586d632 | Update private registry dispatcher-image | [
{
"change_type": "MODIFY",
"old_path": "docker/gcb/base-images.yaml",
"new_path": "docker/gcb/base-images.yaml",
"diff": "images:\n- gcr.io/fuzzbench/base-image:test-experiment\n+- us-central1-docker.pkg.dev/fuzzbench/fuzzbench-private/base-image\n- gcr.io/fuzzbench/base-image\n+- gcr.io/fuzzbench/dispatcher-image\n+- us-central1-docker.pkg.dev/fuzzbench/fuzzbench-private/dispatcher-image\nsteps:\n- args:\n- pull\n@@ -28,6 +31,8 @@ steps:\n- args:\n- build\n- --tag\n+ - us-central1-docker.pkg.dev/fuzzbench/fuzzbench-private/base-image\n+ - --tag\n- gcr.io/fuzzbench/base-image\n- --tag\n- gcr.io/fuzzbench/base-image:test-experiment\n@@ -48,6 +53,8 @@ steps:\n- gcr.io/fuzzbench/dispatcher-image\n- --tag\n- gcr.io/fuzzbench/dispatcher-image:test-experiment\n+ - --tag\n+ - us-central1-docker.pkg.dev/fuzzbench/fuzzbench-private/dispatcher-image\n- --cache-from\n- gcr.io/fuzzbench/dispatcher-image\n- --build-arg\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Update private registry dispatcher-image (#1657) |
258,388 | 30.01.2023 19:59:37 | 18,000 | 3ca9bf1a1f272a031c9bf6585516038649c510c8 | Fix libpcap_fuzz_both | [
{
"change_type": "MODIFY",
"old_path": "benchmarks/libpcap_fuzz_both/Dockerfile",
"new_path": "benchmarks/libpcap_fuzz_both/Dockerfile",
"diff": "FROM gcr.io/oss-fuzz-base/base-builder@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd\nFROM gcr.io/oss-fuzz-base/base-builder@sha256:87ca1e9e19235e731fac8de8d1892ebe8d55caf18e7aa131346fc582a2034fdd\nRUN apt-get update && \\\n- apt-get install -y make cmake flex bison libdbus-1-dev\n+ apt-get install -y make cmake flex bison\nRUN git clone \\\n--depth 1 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "benchmarks/libpcap_fuzz_both/build.sh",
"new_path": "benchmarks/libpcap_fuzz_both/build.sh",
"diff": "@@ -22,13 +22,8 @@ cd build\ncmake ..\nmake\n-\n-# build fuzz targets\n-for target in pcap filter both\n-do\n- $CC $CFLAGS -I.. -c ../testprogs/fuzz/fuzz_$target.c -o fuzz_$target.o\n- $CXX $CXXFLAGS fuzz_$target.o -o $OUT/fuzz_$target libpcap.a $LIB_FUZZING_ENGINE\n-done\n+$CC $CFLAGS -I.. -c ../testprogs/fuzz/fuzz_both.c -o fuzz_both.o\n+$CXX $CXXFLAGS fuzz_both.o -o $OUT/fuzz_both libpcap.a $LIB_FUZZING_ENGINE\n# export other associated stuff\ncd ..\n"
},
{
"change_type": "DELETE",
"old_path": "benchmarks/libpcap_fuzz_both/patch.diff",
"new_path": null,
"diff": "-diff --git a/optimize.c b/optimize.c\n-index 4afd063f..90e8c571 100644\n---- a/optimize.c\n-+++ b/optimize.c\n-@@ -1888,7 +1888,7 @@ opt_root(struct block **b)\n- static void\n- opt_loop(opt_state_t *opt_state, struct icode *ic, int do_stmts)\n- {\n--\n-+ int loopCounter = 0;\n- #ifdef BDEBUG\n- if (pcap_optimizer_debug > 1 || pcap_print_dot_graph) {\n- printf(\"opt_loop(root, %d) begin\\n\", do_stmts);\n-@@ -1909,6 +1909,10 @@ opt_loop(opt_state_t *opt_state, struct icode *ic, int do_stmts)\n- opt_dump(opt_state, ic);\n- }\n- #endif\n-+ loopCounter++;\n-+ if (loopCounter > 1000) {\n-+ break;\n-+ }\n- } while (!opt_state->done);\n- }\n-\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix libpcap_fuzz_both (#1661) |
258,388 | 30.01.2023 20:00:39 | 18,000 | 01bf72b6f504e6fb6eaaced2fb7e202543120bcf | Log if experiment is private
so we can filter them out of public logs
Fixes: | [
{
"change_type": "MODIFY",
"old_path": "experiment/resources/dispatcher-startup-script-template.sh",
"new_path": "experiment/resources/dispatcher-startup-script-template.sh",
"diff": "@@ -20,7 +20,8 @@ mkdir -p $HOME\ndocker-credential-gcr configure-docker -include-artifact-registry\necho 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope\ndocker run --rm \\\n- -e INSTANCE_NAME={{instance_name}} -e EXPERIMENT={{experiment}} \\\n+ -e INSTANCE_NAME={{instance_name}} \\\n+ -e EXPERIMENT={{experiment}} \\\n-e CLOUD_PROJECT={{cloud_project}} \\\n-e EXPERIMENT_FILESTORE={{experiment_filestore}} \\\n-e POSTGRES_PASSWORD={{postgres_password}} \\\n@@ -28,6 +29,7 @@ docker run --rm \\\n-e DOCKER_REGISTRY={{docker_registry}} \\\n-e CONCURRENT_BUILDS={{concurrent_builds}} \\\n-e WORKER_POOL_NAME={{worker_pool_name}} \\\n+ -e PRIVATE={{private}} \\\n--cap-add=SYS_PTRACE --cap-add=SYS_NICE \\\n-v /var/run/docker.sock:/var/run/docker.sock --name=dispatcher-container \\\n{{docker_registry}}/dispatcher-image /work/startup-dispatcher.sh &> /tmp/dispatcher.log\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/resources/runner-startup-script-template.sh",
"new_path": "experiment/resources/runner-startup-script-template.sh",
"diff": "@@ -52,6 +52,7 @@ docker run \\\n-e EXPERIMENT_FILESTORE={{experiment_filestore}} {% if local_experiment %}-v {{experiment_filestore}}:{{experiment_filestore}} {% endif %}\\\n-e REPORT_FILESTORE={{report_filestore}} {% if local_experiment %}-v {{report_filestore}}:{{report_filestore}} {% endif %}\\\n-e FUZZ_TARGET={{fuzz_target}} \\\n+-e PRIVATE={{private}} \\\n-e LOCAL_EXPERIMENT={{local_experiment}} \\\n{% if not local_experiment %}--name=runner-container {% endif %}\\\n--shm-size=2g \\\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -73,6 +73,7 @@ def _set_default_config_values(config: Dict[str, Union[int, str, bool]],\nconfig['worker_pool_name'] = config.get('worker_pool_name', '')\nconfig['snapshot_period'] = config.get(\n'snapshot_period', experiment_utils.DEFAULT_SNAPSHOT_SECONDS)\n+ config['private'] = config.get('private', False)\ndef _validate_config_parameters(\n@@ -580,7 +581,8 @@ class GoogleCloudDispatcher(BaseDispatcher):\n(cloud_sql_instance_connection_name),\n'docker_registry': self.config['docker_registry'],\n'concurrent_builds': self.config['concurrent_builds'],\n- 'worker_pool_name': self.config['worker_pool_name']\n+ 'worker_pool_name': self.config['worker_pool_name'],\n+ 'private': self.config['private'],\n}\nif 'worker_pool_name' in self.config:\nkwargs['worker_pool_name'] = self.config['worker_pool_name']\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/scheduler.py",
"new_path": "experiment/scheduler.py",
"diff": "@@ -772,6 +772,7 @@ def render_startup_script_template( # pylint: disable=too-many-arguments\n'no_dictionaries': experiment_config['no_dictionaries'],\n'oss_fuzz_corpus': experiment_config['oss_fuzz_corpus'],\n'num_cpu_cores': experiment_config['runner_num_cpu_cores'],\n+ 'private': experiment_config['private'],\n'cpuset': cpuset,\n'custom_seed_corpus_dir': experiment_config['custom_seed_corpus_dir'],\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_data/experiment-config.yaml",
"new_path": "experiment/test_data/experiment-config.yaml",
"diff": "@@ -39,3 +39,4 @@ runners_cpus: null\nmeasurers_cpus: null\nrunner_num_cpu_cores: 1\nrunner_machine_type: 'n1-standard-1'\n+private: false\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_scheduler.py",
"new_path": "experiment/test_scheduler.py",
"diff": "@@ -124,6 +124,7 @@ docker run \\\\\n-e EXPERIMENT_FILESTORE=gs://experiment-data \\\\\n-e REPORT_FILESTORE=gs://web-reports \\\\\n-e FUZZ_TARGET={oss_fuzz_target} \\\\\n+-e PRIVATE=False \\\\\n-e LOCAL_EXPERIMENT=False \\\\\n--name=runner-container \\\\\n--shm-size=2g \\\\\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Log if experiment is private (#1645)
so we can filter them out of public logs
Fixes: #1636 |
258,388 | 30.01.2023 20:34:41 | 18,000 | d9ddb2c635dff13c7ac850cc271734d64efbac95 | Tag builds in GCB
This makes debugging much easier. | [
{
"change_type": "MODIFY",
"old_path": "experiment/build/gcb_build.py",
"new_path": "experiment/build/gcb_build.py",
"diff": "@@ -44,10 +44,9 @@ def build_base_images():\nimage_templates = {\nimage: buildable_images[image] for image in ['base-image', 'worker']\n}\n- config = generate_cloudbuild.create_cloudbuild_spec(\n- image_templates,\n- benchmark='no-benchmark',\n- fuzzer='no-fuzzer',\n+ config = generate_cloudbuild.create_cloudbuild_spec(image_templates,\n+ benchmark=None,\n+ fuzzer=None,\nbuild_base_images=True)\n_build(config, 'base-images')\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/generate_cloudbuild.py",
"new_path": "experiment/build/generate_cloudbuild.py",
"diff": "@@ -81,7 +81,7 @@ def _get_cachable_image_tag(image_specs):\nreturn _get_image_tag(image_specs)\n-def coverage_steps(benchmark):\n+def get_coverage_steps(benchmark: str):\n\"\"\"Returns GCB run steps for coverage builds.\"\"\"\ncoverage_binaries_dir = exp_path.filestore(\nbuild_utils.get_coverage_binaries_dir())\n@@ -117,11 +117,22 @@ def get_docker_registry():\nreturn os.environ['DOCKER_REGISTRY']\n+def get_cloudbuild_tags(fuzzer, benchmark):\n+ \"\"\"Returns cloudbuild tags that are useful for identifying a build.\"\"\"\n+ experiment = os.environ['EXPERIMENT']\n+ tags = [experiment]\n+ if fuzzer:\n+ tags.append(fuzzer)\n+ if benchmark:\n+ tags.append(benchmark)\n+ return tags\n+\n+\ndef create_cloudbuild_spec(image_templates,\nbenchmark,\nfuzzer,\nbuild_base_images=False,\n- cloudbuild_tag=None):\n+ cloudbuild_tags=None):\n\"\"\"Generates Cloud Build specification.\nArgs:\n@@ -133,16 +144,11 @@ def create_cloudbuild_spec(image_templates,\nGCB build steps.\n\"\"\"\ncloudbuild_spec = {'steps': [], 'images': []}\n- if cloudbuild_tag is not None:\n- cloudbuild_spec['tags'] = [f'fuzzer-{fuzzer}', f'benchmark-{benchmark}']\n- # TODO(metzman): Figure out how to do this to solve log length issue.\n- # cloudbuild_spec['steps'].append({\n- # 'id': 'buildx-create',\n- # 'name': DOCKER_IMAGE,\n- # 'args': ['buildx', 'create', '--use', 'buildxbuilder', '--driver-opt',\n- # 'env.BUILDKIT_STEP_LOG_MAX_SIZE=500000000']\n- # })\n+ if cloudbuild_tags is None:\n+ cloudbuild_tags = get_cloudbuild_tags(fuzzer, benchmark)\n+ if cloudbuild_tags:\n+ cloudbuild_spec['tags'] = cloudbuild_tags\nfor image_name, image_specs in image_templates.items():\nstep = {\n@@ -183,7 +189,8 @@ def create_cloudbuild_spec(image_templates,\nif any(image_specs['type'] in 'coverage'\nfor _, image_specs in image_templates.items()):\n- cloudbuild_spec['steps'] += coverage_steps(benchmark)\n+ assert benchmark is not None, 'Coverage build need benchmark'\n+ cloudbuild_spec['steps'] += get_coverage_steps(benchmark)\nreturn cloudbuild_spec\n@@ -195,8 +202,8 @@ def main():\nbase_images_spec = create_cloudbuild_spec(\n{'base-image': image_templates['base-image']},\nbuild_base_images=True,\n- benchmark='no-benchmark',\n- fuzzer='no-fuzzer')\n+ benchmark=None,\n+ fuzzer=None)\nbase_images_spec_file = os.path.join(ROOT_DIR, 'docker', 'gcb',\n'base-images.yaml')\nyaml_utils.write(base_images_spec_file, base_images_spec)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/build/test_generate_cloudbuild.py",
"new_path": "experiment/build/test_generate_cloudbuild.py",
"diff": "@@ -30,10 +30,7 @@ def test_generate_cloudbuild_spec_build_base_image(experiment):\n}\n}\ngenerated_spec = generate_cloudbuild.create_cloudbuild_spec(\n- image_templates,\n- benchmark='no-benchmark',\n- fuzzer='no-fuzzer',\n- build_base_images=True)\n+ image_templates, benchmark=None, fuzzer=None, build_base_images=True)\nexpected_spec = {\n'steps': [{\n@@ -53,7 +50,8 @@ def test_generate_cloudbuild_spec_build_base_image(experiment):\n'images': [\n'gcr.io/fuzzbench/base-image:test-experiment',\n'gcr.io/fuzzbench/base-image'\n- ]\n+ ],\n+ 'tags': ['test-experiment'],\n}\nassert generated_spec == expected_spec\n@@ -73,10 +71,7 @@ def test_generate_cloudbuild_spec_other_registry(experiment):\n}\n}\ngenerated_spec = generate_cloudbuild.create_cloudbuild_spec(\n- image_templates,\n- benchmark='no-benchmark',\n- fuzzer='no-fuzzer',\n- build_base_images=True)\n+ image_templates, benchmark=None, fuzzer=None, build_base_images=True)\nexpected_spec = {\n'steps': [{\n@@ -96,7 +91,8 @@ def test_generate_cloudbuild_spec_other_registry(experiment):\n'images': [\n'gcr.io/not-fuzzbench/base-image:test-experiment',\n'gcr.io/not-fuzzbench/base-image'\n- ]\n+ ],\n+ 'tags': ['test-experiment'],\n}\nassert generated_spec == expected_spec\n@@ -120,8 +116,8 @@ def test_generate_cloudbuild_spec_build_fuzzer_benchmark(experiment):\ngenerated_spec = generate_cloudbuild.create_cloudbuild_spec(\nimage_templates,\n- benchmark='no-benchmark',\n- fuzzer='no-fuzzer',\n+ benchmark='benchmark',\n+ fuzzer='fuzzer',\n)\nexpected_spec = {\n@@ -146,7 +142,8 @@ def test_generate_cloudbuild_spec_build_fuzzer_benchmark(experiment):\n'images': [\n'gcr.io/fuzzbench/builders/afl/zlib-intermediate:test-experiment',\n'gcr.io/fuzzbench/builders/afl/zlib-intermediate'\n- ]\n+ ],\n+ 'tags': ['test-experiment', 'fuzzer', 'benchmark'],\n}\nassert generated_spec == expected_spec\n@@ -186,7 +183,7 @@ def test_generate_cloudbuild_spec_build_benchmark_coverage(experiment):\n}\ngenerated_spec = generate_cloudbuild.create_cloudbuild_spec(\n- image_templates, benchmark='zlib', fuzzer='no-fuzzer')\n+ image_templates, benchmark='zlib', fuzzer='coverage')\nexpected_spec = {\n'steps': [{\n@@ -264,7 +261,8 @@ def test_generate_cloudbuild_spec_build_benchmark_coverage(experiment):\n'gcr.io/fuzzbench/builders/coverage/zlib-intermediate',\n'gcr.io/fuzzbench/builders/coverage/zlib:test-experiment',\n'gcr.io/fuzzbench/builders/coverage/zlib'\n- ]\n+ ],\n+ 'tags': ['test-experiment', 'coverage', 'zlib'],\n}\nassert generated_spec == expected_spec\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Tag builds in GCB (#1655)
This makes debugging much easier. |
258,388 | 30.01.2023 21:36:04 | 18,000 | 9592a94c4f0b699cdaf24c4116bfde8a7c1ed439 | Fix typo affecting CI | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/benchmarks.yml",
"new_path": ".github/workflows/benchmarks.yml",
"diff": "@@ -7,8 +7,8 @@ on:\n- 'benchmarks/**' # Changes to benchmarks.\n# Changes that affect what gets built.\n- 'src_analysis/**'\n- - '.github/worfkflows/benchmarks.yml'\n- - '.github/worfkflows/build_and_test_run_fuzzer_benchmarks.py'\n+ - '.github/workflows/benchmarks.yml'\n+ - '.github/workflows/build_and_test_run_fuzzer_benchmarks.py'\njobs:\nTest:\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix typo affecting CI (#1666) |
258,402 | 31.01.2023 13:51:27 | -39,600 | b2098672d8e31e5b84f1a3014f3ca2e43be4373a | Test higher memory builder
Specify the builder's worker pool machine type to force using
[`e2-standard-32`](https://pantheon.corp.google.com/cloud-build/settings/worker-pool?referrer=search&project=fuzzbench`). | [
{
"change_type": "MODIFY",
"old_path": "service/experiment-config.yaml",
"new_path": "service/experiment-config.yaml",
"diff": "@@ -10,7 +10,7 @@ cloud_compute_zone: us-central1-c\nexperiment_filestore: gs://fuzzbench-data\nreport_filestore: gs://www.fuzzbench.com/reports\ncloud_sql_instance_connection_name: \"fuzzbench:us-central1:postgres-experiment-db=tcp:5432\"\n-worker_pool_name: \"projects/fuzzbench/locations/us-central1/workerPools/buildpool\"\n+worker_pool_name: \"projects/fuzzbench/locations/us-central1/workerPools/buildpool-e2-std-32\" # Mem 128 GB\npreemptible_runners: true\n# This experiment should generate a report that is combined with other public\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Test higher memory builder (#1650)
Specify the builder's worker pool machine type to force using
[`e2-standard-32`](https://pantheon.corp.google.com/cloud-build/settings/worker-pool?referrer=search&project=fuzzbench`).
---------
Co-authored-by: jonathanmetzman <[email protected]> |
258,388 | 30.01.2023 22:15:30 | 18,000 | c52f3637b7d86e69407ded75330540a46e531575 | Add canary project to CI | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/build_and_test_run_fuzzer_benchmarks.py",
"new_path": ".github/workflows/build_and_test_run_fuzzer_benchmarks.py",
"diff": "@@ -25,6 +25,10 @@ from src_analysis import diff_utils\nNUM_RETRIES = 2\nRETRY_DELAY = 60\n+# Use AFL because it is the fastest fuzzer to build. libFuzzer clones all of\n+# LLVM which is super slow. Also tons of fuzzers depend on AFL.\n+CANARY_FUZZER = 'afl'\n+\ndef get_make_target(fuzzer, benchmark):\n\"\"\"Return test target for a fuzzer and benchmark.\"\"\"\n@@ -110,6 +114,8 @@ def do_build(benchmark):\nchanged_files = diff_utils.get_changed_files()\nchanged_fuzzers = change_utils.get_changed_fuzzers(changed_files)\nprint('changed_fuzzers', changed_fuzzers)\n+ if not changed_fuzzers:\n+ changed_fuzzers = [CANARY_FUZZER]\n# Only build fuzzers that have changed.\nreturn make_builds(benchmark, changed_fuzzers)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Add canary project to CI (#1665) |
258,388 | 30.01.2023 22:22:30 | 18,000 | a330a3e9a511d64898af4a364563392208134872 | [CI] Remove failing bug-draft benchmarks | [
{
"change_type": "MODIFY",
"old_path": ".github/workflows/benchmarks.yml",
"new_path": ".github/workflows/benchmarks.yml",
"diff": "@@ -29,7 +29,6 @@ jobs:\n- jsoncpp_jsoncpp_fuzzer\n- lcms-2017-03-21\n- libarchive_libarchive_fuzzer\n- - libgit2_objects_fuzzer\n- libhevc_hevc_dec_fuzzer\n- libhtp_fuzz_htp\n- libjpeg-turbo-07-2017\n@@ -49,7 +48,6 @@ jobs:\n- php_php-fuzz-execute\n- php_php-fuzz-parser\n- php_php-fuzz-parser-2020-07-25\n- - poppler_pdf_fuzzer\n- proj4-2017-08-14\n- proj4_standard_fuzzer\n- quickjs_eval-2020-01-05\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [CI] Remove failing bug-draft benchmarks (#1667) |
258,388 | 30.01.2023 22:26:35 | 18,000 | 6538f3a217b297caa361ed4cdab75c39df7376aa | Remove hack: __init__.py | [
{
"change_type": "MODIFY",
"old_path": "docker/benchmark-builder/Dockerfile",
"new_path": "docker/benchmark-builder/Dockerfile",
"diff": "@@ -58,9 +58,6 @@ RUN pip3 install -r /tmp/requirements.txt\n# Copy the entire fuzzers directory tree to allow for module dependencies.\nCOPY fuzzers $SRC/fuzzers\n-# Create empty __init__.py to allow python deps to work.\n-RUN touch $SRC/__init__.py\n-\n# Disable LeakSanitizer since ptrace is unavailable in Google Cloud build\n# and is not needed during build process.\nENV ASAN_OPTIONS=\"detect_leaks=0\"\n"
},
{
"change_type": "MODIFY",
"old_path": "docker/benchmark-runner/Dockerfile",
"new_path": "docker/benchmark-runner/Dockerfile",
"diff": "@@ -64,8 +64,6 @@ COPY --from=builder /out/ ./\nCOPY benchmarks $ROOT_DIR/benchmarks\n# Copy the fuzzers directory.\nCOPY fuzzers $ROOT_DIR/fuzzers\n-# Create empty __init__.py to allow python deps to work.\n-RUN touch __init__.py\n# Define environment variables used when we run the fuzzer:\n# - Directory to get starting seeds from.\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Remove hack: __init__.py (#1663) |
258,388 | 30.01.2023 22:35:13 | 18,000 | 4f8aa11b9b35996e2398376332c1ae12174226d3 | Don't use echo to create build script. | [
{
"change_type": "MODIFY",
"old_path": "docker/benchmark-builder/Dockerfile",
"new_path": "docker/benchmark-builder/Dockerfile",
"diff": "@@ -68,6 +68,6 @@ RUN mkdir /opt/fuzzbench/\nCOPY docker/benchmark-builder/checkout_commit.py /opt/fuzzbench/\nRUN export CHECKOUT_COMMIT=$(cat /benchmark.yaml | tr -d ' ' | grep 'commit:' | cut -d ':' -f2) && \\\npython3 -u /opt/fuzzbench/checkout_commit.py $CHECKOUT_COMMIT $SRC\n-RUN echo \"#!/bin/bash\\nPYTHONPATH=$SRC python3 -u -c \\\"from fuzzers import utils; utils.initialize_env(); from fuzzers.$FUZZER import fuzzer; fuzzer.build()\\\"\" > /usr/bin/fuzzer_build && \\\n- chmod +x /usr/bin/fuzzer_build\n+\n+COPY docker/benchmark-builder/fuzzer_build /usr/bin/fuzzer_build\nRUN echo \"Run fuzzer_build to build the target\" && if [ -z \"$debug_builder\" ] ; then fuzzer_build; fi\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "docker/benchmark-builder/fuzzer_build",
"diff": "+#!/bin/bash\n+# Copyright 2023 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+PYTHONPATH=$SRC python3 -u -c \"from fuzzers import utils; utils.initialize_env(); from fuzzers.$FUZZER import fuzzer; fuzzer.build()\"\n\\ No newline at end of file\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Don't use echo to create build script. (#1664) |
258,388 | 30.01.2023 22:42:31 | 18,000 | 03f48c4ce0707482792b98284b15731066ad6af2 | Fix dispatcher
Fix libgl issue. | [
{
"change_type": "MODIFY",
"old_path": "docker/dispatcher-image/Dockerfile",
"new_path": "docker/dispatcher-image/Dockerfile",
"diff": "@@ -19,13 +19,14 @@ FROM gcr.io/fuzzbench/base-image\nENV WORK /work\nWORKDIR $WORK\n-# Install runtime dependencies for benchmarks, easy json parsing.\n+# Install runtime dependencies for benchmarks, easy json parsing, and fuzzbench.\nRUN apt-get update -y && apt-get install -y \\\njq \\\nlibglib2.0-0 \\\nlibxml2 \\\nlibarchive13 \\\n- libgss3\n+ libgss3 \\\n+ libgl1\n# Install docker cli.\nRUN DOCKER_VERSION=18.09.7 && \\\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix dispatcher (#1668)
Fix libgl issue. |
258,402 | 31.01.2023 16:26:34 | -39,600 | ca6d9b18868965109055e638ef2be29ddfc4b594 | Fix jsoncpp by correcting its lib path | [
{
"change_type": "MODIFY",
"old_path": "benchmarks/jsoncpp_jsoncpp_fuzzer/build.sh",
"new_path": "benchmarks/jsoncpp_jsoncpp_fuzzer/build.sh",
"diff": "@@ -25,7 +25,7 @@ make\n# Compile fuzzer.\n$CXX $CXXFLAGS -I../include $LIB_FUZZING_ENGINE \\\n../src/test_lib_json/fuzz.cpp -o $OUT/jsoncpp_fuzzer \\\n- src/lib_json/libjsoncpp.a\n+ lib/libjsoncpp.a\n# Add dictionary.\ncp $SRC/jsoncpp/src/test_lib_json/fuzz.dict $OUT/jsoncpp_fuzzer.dict\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Fix jsoncpp by correcting its lib path (#1669) |
258,388 | 03.02.2023 11:19:35 | 18,000 | 393b5735b00f774a12d9c0041d8246afe89bbe4a | Clarify graphs | [
{
"change_type": "MODIFY",
"old_path": "analysis/plotting.py",
"new_path": "analysis/plotting.py",
"diff": "@@ -55,7 +55,7 @@ def _formatted_title(benchmark_snapshot_df):\nstats_string += _formatted_hour_min(snapshot_time)\ntrial_count = benchmark_snapshot_df.fuzzer.value_counts().min()\n- stats_string += f', {trial_count} trials/fuzzer'\n+ stats_string += f', at least {trial_count} trials/fuzzer'\nstats_string += ')'\nreturn stats_string\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Clarify graphs (#1677) |
258,388 | 06.02.2023 11:09:12 | 18,000 | 1ca79526a3c752f63f79089c73e35bc69d505959 | don't log spam | [
{
"change_type": "MODIFY",
"old_path": "experiment/run_experiment.py",
"new_path": "experiment/run_experiment.py",
"diff": "@@ -96,10 +96,6 @@ def _validate_config_parameters(\nfor param in missing_params:\nlogs.error('Config does not contain required parameter \"%s\".', param)\n- # Notify if any optional parameters are missing in config.\n- for param in optional_params:\n- logs.info('Config does not contain optional parameter \"%s\".', param)\n-\nreturn not missing_params\n@@ -173,8 +169,6 @@ def read_and_validate_experiment_config(config_filename: str) -> Dict:\nRequirement(not local_experiment, str, True, ''),\n'worker_pool_name':\nRequirement(not local_experiment, str, False, ''),\n- 'experiment':\n- Requirement(False, str, False, ''),\n'cloud_sql_instance_connection_name':\nRequirement(False, str, True, ''),\n'snapshot_period':\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_run_experiment.py",
"new_path": "experiment/test_run_experiment.py",
"diff": "@@ -52,8 +52,6 @@ class TestReadAndValdiateExperimentConfig(unittest.TestCase):\n'gs://bucket',\n'report_filestore':\n'gs://web-bucket',\n- 'experiment':\n- 'experiment-name',\n'docker_registry':\n'gcr.io/fuzzbench',\n'cloud_project':\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | don't log spam (#1671) |
258,388 | 06.02.2023 11:09:45 | 18,000 | 9c79c5cf2f89447de69669f36d6941ffa5c429e4 | Change format of corpus snapshots to save cost
Don't store every file on each snapshot, just newly modified ones.
Also, get rid of unchanged-cycles, it's no longer as useful and adds
complexity. | [
{
"change_type": "MODIFY",
"old_path": "experiment/measurer/measure_manager.py",
"new_path": "experiment/measurer/measure_manager.py",
"diff": "@@ -25,7 +25,7 @@ import sys\nimport tempfile\nimport tarfile\nimport time\n-from typing import List, Set\n+from typing import List\nimport queue\nimport psutil\n@@ -328,8 +328,7 @@ def get_unmeasured_snapshots(experiment: str,\nreturn unmeasured_first_snapshots + unmeasured_latest_snapshots\n-def extract_corpus(corpus_archive: str, sha_blacklist: Set[str],\n- output_directory: str):\n+def extract_corpus(corpus_archive: str, output_directory: str):\n\"\"\"Extract a corpus from |corpus_archive| to |output_directory|.\"\"\"\npathlib.Path(output_directory).mkdir(exist_ok=True)\nwith tarfile.open(corpus_archive, 'r:gz') as tar:\n@@ -345,11 +344,10 @@ def extract_corpus(corpus_archive: str, sha_blacklist: Set[str],\nlogger.info('Failed to get handle to %s.', member)\ncontinue\n+ # TODO(metzman): Consider removing the hashing. We don't really need\n+ # it anymore.\nmember_contents = member_file_handle.read()\nfilename = utils.string_hash(member_contents)\n- if filename in sha_blacklist:\n- continue\n-\nfile_path = os.path.join(output_directory, filename)\nif os.path.exists(file_path):\n@@ -363,8 +361,6 @@ class SnapshotMeasurer(coverage_utils.TrialCoverage): # pylint: disable=too-man\n\"\"\"Class used for storing details needed to measure coverage of a particular\ntrial.\"\"\"\n- UNIT_BLACKLIST = collections.defaultdict(set)\n-\n# pylint: disable=too-many-arguments\ndef __init__(self, fuzzer: str, benchmark: str, trial_num: int,\ntrial_logger: logs.Logger, region_coverage: bool):\n@@ -377,15 +373,6 @@ class SnapshotMeasurer(coverage_utils.TrialCoverage): # pylint: disable=too-man\nself.trial_dir = os.path.join(self.work_dir, 'experiment-folders',\nself.benchmark_fuzzer_trial_dir)\n- # Stores the files that have already been measured for a trial.\n- self.measured_files_path = os.path.join(self.report_dir,\n- 'measured-files.txt')\n-\n- # Used by the runner to signal that there won't be a corpus archive for\n- # a cycle because the corpus hasn't changed since the last cycle.\n- self.unchanged_cycles_path = os.path.join(self.trial_dir, 'results',\n- 'unchanged-cycles')\n-\n# Store the profraw file containing coverage data for each cycle.\nself.profraw_file_pattern = os.path.join(self.coverage_dir,\n'data-%m.profraw')\n@@ -417,14 +404,10 @@ class SnapshotMeasurer(coverage_utils.TrialCoverage): # pylint: disable=too-man\ndef run_cov_new_units(self):\n\"\"\"Run the coverage binary on new units.\"\"\"\ncoverage_binary = coverage_utils.get_coverage_binary(self.benchmark)\n- crashing_units = run_coverage.do_coverage_run(coverage_binary,\n- self.corpus_dir,\n+ run_coverage.do_coverage_run(coverage_binary, self.corpus_dir,\nself.profraw_file_pattern,\nself.crashes_dir)\n- self.UNIT_BLACKLIST[self.benchmark] = (\n- self.UNIT_BLACKLIST[self.benchmark].union(set(crashing_units)))\n-\ndef generate_summary(self, cycle: int, summary_only=False):\n\"\"\"Transforms the .profdata file into json form.\"\"\"\ncoverage_binary = coverage_utils.get_coverage_binary(self.benchmark)\n@@ -493,54 +476,13 @@ class SnapshotMeasurer(coverage_utils.TrialCoverage): # pylint: disable=too-man\nreturn\nself.generate_summary(cycle)\n- def is_cycle_unchanged(self, cycle: int) -> bool:\n- \"\"\"Returns True if |cycle| is unchanged according to the\n- unchanged-cycles file. This file is written to by the trial's runner.\"\"\"\n-\n- def copy_unchanged_cycles_file():\n- unchanged_cycles_filestore_path = exp_path.filestore(\n- self.unchanged_cycles_path)\n- result = filestore_utils.cp(unchanged_cycles_filestore_path,\n- self.unchanged_cycles_path,\n- expect_zero=False)\n- return result.retcode == 0\n-\n- if not os.path.exists(self.unchanged_cycles_path):\n- if not copy_unchanged_cycles_file():\n- return False\n-\n- def get_unchanged_cycles():\n- return [\n- int(cycle) for cycle in filesystem.read(\n- self.unchanged_cycles_path).splitlines()\n- ]\n-\n- unchanged_cycles = get_unchanged_cycles()\n- if cycle in unchanged_cycles:\n- return True\n-\n- if cycle < max(unchanged_cycles):\n- # If the last/max unchanged cycle is greater than |cycle| then we\n- # don't need to copy the file again.\n- return False\n-\n- if not copy_unchanged_cycles_file():\n- return False\n-\n- unchanged_cycles = get_unchanged_cycles()\n- return cycle in unchanged_cycles\n-\ndef extract_corpus(self, corpus_archive_path) -> bool:\n\"\"\"Extract the corpus archive for this cycle if it exists.\"\"\"\nif not os.path.exists(corpus_archive_path):\nself.logger.warning('Corpus not found: %s.', corpus_archive_path)\nreturn False\n- already_measured_units = self.get_measured_files()\n- crash_blacklist = self.UNIT_BLACKLIST[self.benchmark]\n- unit_blacklist = already_measured_units.union(crash_blacklist)\n-\n- extract_corpus(corpus_archive_path, unit_blacklist, self.corpus_dir)\n+ extract_corpus(corpus_archive_path, self.corpus_dir)\nreturn True\ndef save_crash_files(self, cycle):\n@@ -586,21 +528,6 @@ class SnapshotMeasurer(coverage_utils.TrialCoverage): # pylint: disable=too-man\ncrash_stacktrace=crash.crash_stacktrace))\nreturn crashes\n- def update_measured_files(self):\n- \"\"\"Updates the measured-files.txt file for this trial with\n- files measured in this snapshot.\"\"\"\n- current_files = set(os.listdir(self.corpus_dir))\n- already_measured = self.get_measured_files()\n- filesystem.write(self.measured_files_path,\n- '\\n'.join(current_files.union(already_measured)))\n-\n- def get_measured_files(self):\n- \"\"\"Returns a the set of files that have been measured for this\n- snapshot's trials.\"\"\"\n- if not os.path.exists(self.measured_files_path):\n- return set()\n- return set(filesystem.read(self.measured_files_path).splitlines())\n-\ndef get_fuzzer_stats(self, cycle):\n\"\"\"Get the fuzzer stats for |cycle|.\"\"\"\nstats_filename = experiment_utils.get_stats_filename(cycle)\n@@ -673,16 +600,6 @@ def measure_snapshot_coverage( # pylint: disable=too-many-locals\nmeasuring_start_time = time.time()\nsnapshot_logger.info('Measuring cycle: %d.', cycle)\nthis_time = experiment_utils.get_cycle_time(cycle)\n- if snapshot_measurer.is_cycle_unchanged(cycle):\n- snapshot_logger.info('Cycle: %d is unchanged.', cycle)\n- branches_covered = snapshot_measurer.get_current_coverage()\n- fuzzer_stats_data = snapshot_measurer.get_fuzzer_stats(cycle)\n- return models.Snapshot(time=this_time,\n- trial_id=trial_num,\n- edges_covered=branches_covered,\n- fuzzer_stats=fuzzer_stats_data,\n- crashes=[])\n-\ncorpus_archive_dst = os.path.join(\nsnapshot_measurer.trial_dir, 'corpus',\nexperiment_utils.get_corpus_archive_name(cycle))\n@@ -721,9 +638,6 @@ def measure_snapshot_coverage( # pylint: disable=too-many-locals\nfuzzer_stats=fuzzer_stats_data,\ncrashes=crashes)\n- # Record the new corpus files.\n- snapshot_measurer.update_measured_files()\n-\nmeasuring_time = round(time.time() - measuring_start_time, 2)\nsnapshot_logger.info('Measured cycle: %d in %f seconds.', cycle,\nmeasuring_time)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer/run_coverage.py",
"new_path": "experiment/measurer/run_coverage.py",
"diff": "@@ -38,20 +38,9 @@ UNIT_TIMEOUT = 10\nMAX_TOTAL_TIME = experiment_utils.get_snapshot_seconds()\n-def find_crashing_units(artifacts_dir: str) -> List[str]:\n- \"\"\"Returns the crashing unit in coverage_binary_output.\"\"\"\n- return [\n- # This assumes the artifacts are named {crash,oom,timeout,*}-$SHA1_HASH\n- # and that input units are also named with their hash.\n- filename.split('-')[1]\n- for filename in os.listdir(artifacts_dir)\n- if os.path.isfile(os.path.join(artifacts_dir, filename))\n- ]\n-\n-\ndef do_coverage_run( # pylint: disable=too-many-locals\ncoverage_binary: str, new_units_dir: List[str],\n- profraw_file_pattern: str, crashes_dir: str) -> List[str]:\n+ profraw_file_pattern: str, crashes_dir: str):\n\"\"\"Does a coverage run of |coverage_binary| on |new_units_dir|. Writes\nthe result to |profraw_file_pattern|.\"\"\"\nwith tempfile.TemporaryDirectory() as merge_dir:\n@@ -79,4 +68,3 @@ def do_coverage_run( # pylint: disable=too-many-locals\n'coverage_binary': coverage_binary,\n'output': result.output[-new_process.LOG_LIMIT_FIELD:],\n})\n- return find_crashing_units(crashes_dir)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer/test_measure_manager.py",
"new_path": "experiment/measurer/test_measure_manager.py",
"diff": "@@ -212,82 +212,6 @@ def test_measure_all_trials_no_more(mocked_directories_have_same_files,\nqueue.Queue(), False)\n-def test_is_cycle_unchanged_doesnt_exist(experiment):\n- \"\"\"Test that is_cycle_unchanged can properly determine if a cycle is\n- unchanged or not when it needs to copy the file for the first time.\"\"\"\n- snapshot_measurer = measure_manager.SnapshotMeasurer(\n- FUZZER, BENCHMARK, TRIAL_NUM, SNAPSHOT_LOGGER, REGION_COVERAGE)\n- this_cycle = 1\n- with test_utils.mock_popen_ctx_mgr(returncode=1):\n- assert not snapshot_measurer.is_cycle_unchanged(this_cycle)\n-\n-\[email protected]('common.filestore_utils.cp')\[email protected]('common.filesystem.read')\n-def test_is_cycle_unchanged_first_copy(mocked_read, mocked_cp, experiment):\n- \"\"\"Test that is_cycle_unchanged can properly determine if a cycle is\n- unchanged or not when it needs to copy the file for the first time.\"\"\"\n- snapshot_measurer = measure_manager.SnapshotMeasurer(\n- FUZZER, BENCHMARK, TRIAL_NUM, SNAPSHOT_LOGGER, REGION_COVERAGE)\n- this_cycle = 100\n- unchanged_cycles_file_contents = (\n- '\\n'.join([str(num) for num in range(10)] + [str(this_cycle)]))\n- mocked_read.return_value = unchanged_cycles_file_contents\n- mocked_cp.return_value = new_process.ProcessResult(0, '', False)\n-\n- assert snapshot_measurer.is_cycle_unchanged(this_cycle)\n- assert not snapshot_measurer.is_cycle_unchanged(this_cycle + 1)\n-\n-\n-def test_is_cycle_unchanged_update(fs, experiment):\n- \"\"\"Test that is_cycle_unchanged can properly determine that a\n- cycle has changed when it has the file but needs to update it.\"\"\"\n- snapshot_measurer = measure_manager.SnapshotMeasurer(\n- FUZZER, BENCHMARK, TRIAL_NUM, SNAPSHOT_LOGGER, REGION_COVERAGE)\n-\n- this_cycle = 100\n- initial_unchanged_cycles_file_contents = (\n- '\\n'.join([str(num) for num in range(10)] + [str(this_cycle)]))\n- fs.create_file(snapshot_measurer.unchanged_cycles_path,\n- contents=initial_unchanged_cycles_file_contents)\n-\n- next_cycle = this_cycle + 1\n- unchanged_cycles_file_contents = (initial_unchanged_cycles_file_contents +\n- '\\n' + str(next_cycle))\n- assert snapshot_measurer.is_cycle_unchanged(this_cycle)\n- with mock.patch('common.filestore_utils.cp') as mocked_cp:\n- with mock.patch('common.filesystem.read') as mocked_read:\n- mocked_cp.return_value = new_process.ProcessResult(0, '', False)\n- mocked_read.return_value = unchanged_cycles_file_contents\n- assert snapshot_measurer.is_cycle_unchanged(next_cycle)\n-\n-\[email protected]('common.filestore_utils.cp')\n-def test_is_cycle_unchanged_skip_cp(mocked_cp, fs, experiment):\n- \"\"\"Check that is_cycle_unchanged doesn't call filestore_utils.cp\n- unnecessarily.\"\"\"\n- snapshot_measurer = measure_manager.SnapshotMeasurer(\n- FUZZER, BENCHMARK, TRIAL_NUM, SNAPSHOT_LOGGER, REGION_COVERAGE)\n- this_cycle = 100\n- initial_unchanged_cycles_file_contents = (\n- '\\n'.join([str(num) for num in range(10)] + [str(this_cycle + 1)]))\n- fs.create_file(snapshot_measurer.unchanged_cycles_path,\n- contents=initial_unchanged_cycles_file_contents)\n- assert not snapshot_measurer.is_cycle_unchanged(this_cycle)\n- mocked_cp.assert_not_called()\n-\n-\[email protected]('common.filestore_utils.cp')\n-def test_is_cycle_unchanged_no_file(mocked_cp, fs, experiment):\n- \"\"\"Test that is_cycle_unchanged returns False when there is no\n- unchanged-cycles file.\"\"\"\n- # Make sure we log if there is no unchanged-cycles file.\n- snapshot_measurer = measure_manager.SnapshotMeasurer(\n- FUZZER, BENCHMARK, TRIAL_NUM, SNAPSHOT_LOGGER, REGION_COVERAGE)\n- mocked_cp.return_value = new_process.ProcessResult(1, '', False)\n- assert not snapshot_measurer.is_cycle_unchanged(0)\n-\n-\[email protected]('common.new_process.execute')\[email protected]('common.benchmark_utils.get_fuzz_target',\nreturn_value='fuzz-target')\n@@ -302,12 +226,6 @@ def test_run_cov_new_units(_, mocked_execute, fs, environ):\nsnapshot_measurer = measure_manager.SnapshotMeasurer(\nFUZZER, BENCHMARK, TRIAL_NUM, SNAPSHOT_LOGGER, REGION_COVERAGE)\nsnapshot_measurer.initialize_measurement_dirs()\n- shared_units = ['shared1', 'shared2']\n- fs.create_file(snapshot_measurer.measured_files_path,\n- contents='\\n'.join(shared_units))\n- for unit in shared_units:\n- fs.create_file(os.path.join(snapshot_measurer.corpus_dir, unit))\n-\nnew_units = ['new1', 'new2']\nfor unit in new_units:\nfs.create_file(os.path.join(snapshot_measurer.corpus_dir, unit))\n@@ -366,10 +284,8 @@ class TestIntegrationMeasurement:\n# portable binary.\[email protected](not os.getenv('FUZZBENCH_TEST_INTEGRATION'),\nreason='Not running integration tests.')\n- @mock.patch('experiment.measurer.measure_manager.SnapshotMeasurer'\n- '.is_cycle_unchanged')\ndef test_measure_snapshot_coverage( # pylint: disable=too-many-locals\n- self, mocked_is_cycle_unchanged, db, experiment, tmp_path):\n+ self, db, experiment, tmp_path):\n\"\"\"Integration test for measure_snapshot_coverage.\"\"\"\n# WORK is set by experiment to a directory that only makes sense in a\n# fakefs. A directory containing necessary llvm tools is also added to\n@@ -377,7 +293,6 @@ class TestIntegrationMeasurement:\nllvm_tools_path = get_test_data_path('llvm_tools')\nos.environ['PATH'] += os.pathsep + llvm_tools_path\nos.environ['WORK'] = str(tmp_path)\n- mocked_is_cycle_unchanged.return_value = False\n# Set up the coverage binary.\nbenchmark = 'freetype2_ftfuzzer'\ncoverage_binary_src = get_test_data_path(\n@@ -428,7 +343,7 @@ class TestIntegrationMeasurement:\ndef test_extract_corpus(archive_name, tmp_path):\n\"\"\"\"Tests that extract_corpus unpacks a corpus as we expect.\"\"\"\narchive_path = get_test_data_path(archive_name)\n- measure_manager.extract_corpus(archive_path, set(), tmp_path)\n+ measure_manager.extract_corpus(archive_path, tmp_path)\nexpected_corpus_files = {\n'5ea57dfc9631f35beecb5016c4f1366eb6faa810',\n'2f1507c3229c5a1f8b619a542a8e03ccdbb3c29c',\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/measurer/test_run_coverage.py",
"new_path": "experiment/measurer/test_run_coverage.py",
"diff": "@@ -66,12 +66,13 @@ class TestIntegrationRunCoverage:\ncoverage_dir = _make_coverage_dir(tmp_path)\nprofraw_file = os.path.join(coverage_dir, 'test_crash.profraw')\ncrashes_dir = _make_crashes_dir(tmp_path)\n- crashing_units = run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH,\n- units, profraw_file,\n- crashes_dir)\n+ run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units,\n+ profraw_file, crashes_dir)\n# Ensure the crashing units are returned.\n- assert crashing_units == ['86f7e437faa5a7fce15d1ddcb9eaeaea377667b8']\n+ assert os.listdir(crashes_dir) == [\n+ 'crash-86f7e437faa5a7fce15d1ddcb9eaeaea377667b8'\n+ ]\n_assert_profraw_files(coverage_dir)\ndef test_integration_do_coverage_run_no_crash(self, tmp_path):\n@@ -81,12 +82,11 @@ class TestIntegrationRunCoverage:\ncoverage_dir = _make_coverage_dir(tmp_path)\nprofraw_file = os.path.join(coverage_dir, 'test_no_crash.profraw')\ncrashes_dir = _make_crashes_dir(tmp_path)\n- crashing_units = run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH,\n- units, profraw_file,\n- crashes_dir)\n+ run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units,\n+ profraw_file, crashes_dir)\n- # Ensure no crashing unit is returned.\n- assert not crashing_units\n+ # Assert no crashing units.\n+ assert not os.listdir(crashes_dir)\n_assert_profraw_files(coverage_dir)\[email protected]('common.logs.error')\n@@ -98,10 +98,9 @@ class TestIntegrationRunCoverage:\ncoverage_dir = _make_coverage_dir(tmp_path)\nprofraw_file = os.path.join(coverage_dir, 'test_max_time.profraw')\ncrashes_dir = _make_crashes_dir(tmp_path)\n- crashing_units = run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH,\n- units, profraw_file,\n- crashes_dir)\n+ run_coverage.do_coverage_run(self.COVERAGE_BINARY_PATH, units,\n+ profraw_file, crashes_dir)\nassert mocked_log_error.call_count\n- # Ensure no crashing unit is returned.\n- assert not crashing_units\n+ # Assert no crashing units\n+ assert not os.listdir(crashes_dir)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "# limitations under the License.\n\"\"\"Runs fuzzer for trial.\"\"\"\n-from collections import namedtuple\nimport importlib\nimport json\nimport os\n@@ -64,10 +63,11 @@ EXCLUDE_PATHS = set([\nCORPUS_ELEMENT_BYTES_LIMIT = 1 * 1024 * 1024\nSEED_CORPUS_ARCHIVE_SUFFIX = '_seed_corpus.zip'\n-File = namedtuple('File', ['path', 'modified_time', 'change_time'])\n-\nfuzzer_errored_out = False # pylint:disable=invalid-name\n+RESULTS_DIRNAME = 'results'\n+CORPUS_DIRNAME = 'corpus'\n+\ndef _clean_seed_corpus(seed_corpus_dir):\n\"\"\"Prepares |seed_corpus_dir| for the trial. This ensures that it can be\n@@ -250,14 +250,12 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nself.gcs_sync_dir = None\nself.cycle = 0\n- self.corpus_dir = 'corpus'\n- self.corpus_archives_dir = 'corpus-archives'\n- self.results_dir = 'results'\n- self.unchanged_cycles_path = os.path.join(self.results_dir,\n- 'unchanged-cycles')\n+ self.corpus_dir = os.path.abspath(CORPUS_DIRNAME)\n+ self.corpus_archives_dir = os.path.abspath('corpus-archives')\n+ self.results_dir = os.path.abspath(RESULTS_DIRNAME)\nself.log_file = os.path.join(self.results_dir, 'fuzzer-log.txt')\nself.last_sync_time = None\n- self.corpus_dir_contents = set()\n+ self.last_archive_time = -float('inf')\ndef initialize_directories(self):\n\"\"\"Initialize directories needed for the trial.\"\"\"\n@@ -304,7 +302,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nself.do_sync()\nlogs.info('Doing final sync.')\n- self.do_sync(final_sync=True)\n+ self.do_sync()\nfuzz_thread.join()\ndef sleep_until_next_sync(self):\n@@ -328,55 +326,11 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\n# roughly get_snapshot_seconds() after each other.\nself.last_sync_time = time.time()\n- def _set_corpus_dir_contents(self):\n- \"\"\"Set |self.corpus_dir_contents| to the current contents of\n- |self.corpus_dir|. Don't include files or directories excluded by\n- |EXCLUDE_PATHS|.\"\"\"\n- self.corpus_dir_contents = set()\n- corpus_dir = os.path.abspath(self.corpus_dir)\n- for root, _, files in os.walk(corpus_dir):\n- # Check if root is excluded.\n- relpath = os.path.relpath(root, corpus_dir)\n- if _is_path_excluded(relpath):\n- continue\n-\n- for filename in files:\n- # Check if filename is excluded first.\n- if _is_path_excluded(filename):\n- continue\n-\n- file_path = os.path.join(root, filename)\n- try:\n- stat_info = os.stat(file_path)\n- last_modified_time = stat_info.st_mtime\n- # Warning: ctime means creation time on Win and\n- # may not work as expected.\n- last_changed_time = stat_info.st_ctime\n- file_tuple = File(file_path, last_modified_time,\n- last_changed_time)\n- self.corpus_dir_contents.add(file_tuple)\n- except Exception: # pylint: disable=broad-except\n- pass\n-\n- def is_corpus_dir_same(self):\n- \"\"\"Sets |self.corpus_dir_contents| to the current contents and returns\n- True if it is the same as the previous contents.\"\"\"\n- logs.debug('Checking if corpus dir is the same.')\n- prev_contents = self.corpus_dir_contents.copy()\n- self._set_corpus_dir_contents()\n- return prev_contents == self.corpus_dir_contents\n-\n- def do_sync(self, final_sync=False):\n+ def do_sync(self):\n\"\"\"Save corpus archives and results to GCS.\"\"\"\ntry:\n- if not final_sync and self.is_corpus_dir_same():\n- logs.debug('Cycle: %d unchanged.', self.cycle)\n- filesystem.append(self.unchanged_cycles_path, str(self.cycle))\n- else:\n- logs.debug('Cycle: %d changed.', self.cycle)\nself.archive_and_save_corpus()\n-\n- self.record_stats()\n+ # TODO(metzman): Enable stats.\nself.save_results()\nlogs.debug('Finished sync.')\nexcept Exception: # pylint: disable=broad-except\n@@ -421,9 +375,30 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nself.corpus_archives_dir,\nexperiment_utils.get_corpus_archive_name(self.cycle))\n- directories = [self.corpus_dir]\n+ corpus_dir_name = os.path.basename(self.corpus_dir)\n+ with tarfile.open(archive, 'w:gz') as tar:\n+ new_archive_time = self.last_archive_time\n+ for file_path in get_corpus_elements(self.corpus_dir):\n+ stat_info = os.stat(file_path)\n+ last_modified_time = stat_info.st_mtime\n+ if last_modified_time <= self.last_archive_time:\n+ continue # We've saved this file already.\n+ new_archive_time = max(new_archive_time, last_modified_time)\n- archive_directories(directories, archive)\n+ arcname = os.path.join(\n+ corpus_dir_name, os.path.relpath(file_path,\n+ corpus_dir_name))\n+ try:\n+ tar.add(file_path, arcname=arcname)\n+ except (FileNotFoundError, OSError):\n+ # We will get these errors if files or directories are being\n+ # deleted from |directory| as we archive it. Don't bother\n+ # rescanning the directory, new files will be archived in\n+ # the next sync.\n+ pass\n+ except Exception: # pylint: disable=broad-except\n+ logs.error('Unexpected exception occurred when archiving.')\n+ self.last_archive_time = new_archive_time\nreturn archive\ndef save_corpus_archive(self, archive):\n@@ -432,7 +407,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nreturn\nbasename = os.path.basename(archive)\n- gcs_path = posixpath.join(self.gcs_sync_dir, self.corpus_dir, basename)\n+ gcs_path = posixpath.join(self.gcs_sync_dir, CORPUS_DIRNAME, basename)\n# Don't use parallel to avoid stability issues.\nfilestore_utils.cp(archive, gcs_path)\n@@ -459,7 +434,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\n# directory and can be written to by the fuzzer at any time.\nresults_copy = filesystem.make_dir_copy(self.results_dir)\nfilestore_utils.rsync(\n- results_copy, posixpath.join(self.gcs_sync_dir, self.results_dir))\n+ results_copy, posixpath.join(self.gcs_sync_dir, RESULTS_DIRNAME))\ndef get_fuzzer_module(fuzzer):\n@@ -471,14 +446,6 @@ def get_fuzzer_module(fuzzer):\nreturn fuzzer_module\n-def archive_directories(directories, archive_path):\n- \"\"\"Create a tar.gz file named |archive_path| containing the contents of each\n- directory in |directories|.\"\"\"\n- with tarfile.open(archive_path, 'w:gz') as tar:\n- for directory in directories:\n- tar_directory(directory, tar)\n-\n-\ndef tar_directory(directory, tar):\n\"\"\"Add the contents of |directory| to |tar|. Note that this should not\nexception just because files and directories are being deleted from\n@@ -502,6 +469,20 @@ def tar_directory(directory, tar):\nlogs.error('Unexpected exception occurred when archiving.')\n+def get_corpus_elements(corpus_dir):\n+ \"\"\"Returns a list of absolute paths to corpus elements in |corpus_dir|.\n+ Excludes certain elements.\"\"\"\n+ corpus_dir = os.path.abspath(corpus_dir)\n+ corpus_elements = []\n+ for root, _, files in os.walk(corpus_dir):\n+ for filename in files:\n+ file_path = os.path.join(root, filename)\n+ if _is_path_excluded(file_path):\n+ continue\n+ corpus_elements.append(file_path)\n+ return corpus_elements\n+\n+\ndef _is_path_excluded(path):\n\"\"\"Is any part of |path| in |EXCLUDE_PATHS|.\"\"\"\npath_parts = path.split(os.sep)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_runner.py",
"new_path": "experiment/test_runner.py",
"diff": "@@ -217,106 +217,57 @@ def test_archive_corpus_name_correct(_, trial_runner):\[email protected]('common.logs.debug')\[email protected]('experiment.runner.TrialRunner.is_corpus_dir_same')\n-def test_do_sync_unchanged(mocked_is_corpus_dir_same, mocked_debug,\n- trial_runner, fuzzer_module):\n+def test_do_sync_unchanged(mocked_debug, trial_runner, fuzzer_module):\n\"\"\"Test that do_sync records if there was no corpus change since last\ncycle.\"\"\"\ntrial_runner.cycle = 1337\n- mocked_is_corpus_dir_same.return_value = True\nwith test_utils.mock_popen_ctx_mgr() as mocked_popen:\ntrial_runner.do_sync()\n- assert mocked_popen.commands == [[\n- 'gsutil', 'rsync', '-d', '-r', 'results-copy',\n+ assert mocked_popen.commands == [\n+ [\n+ 'gsutil', 'cp', '/corpus-archives/corpus-archive-1337.tar.gz',\n+ ('gs://bucket/experiment-name/experiment-folders/'\n+ 'benchmark-1-fuzzer_a/trial-1/corpus/'\n+ 'corpus-archive-1337.tar.gz')\n+ ],\n+ [\n+ 'gsutil', 'rsync', '-d', '-r', '/results-copy',\n('gs://bucket/experiment-name/experiment-folders/'\n'benchmark-1-fuzzer_a/trial-1/results')\n- ]]\n- mocked_debug.assert_any_call('Cycle: %d unchanged.', trial_runner.cycle)\n- unchanged_cycles_path = os.path.join(trial_runner.results_dir,\n- 'unchanged-cycles')\n- with open(unchanged_cycles_path, encoding='utf-8') as file_handle:\n- assert str(trial_runner.cycle) == file_handle.read().strip()\n- assert not os.listdir(trial_runner.corpus_archives_dir)\n+ ]\n+ ]\n+ assert not os.listdir(trial_runner.corpus_archives_dir) # !!! make it work\[email protected]('experiment.runner.TrialRunner.is_corpus_dir_same')\[email protected]('common.new_process.execute')\n-def test_do_sync_changed(mocked_execute, mocked_is_corpus_dir_same, fs,\n- trial_runner, fuzzer_module):\n+def test_do_sync_changed(mocked_execute, fs, trial_runner, fuzzer_module):\n\"\"\"Test that do_sync archives and saves a corpus if it changed from the\nprevious one.\"\"\"\nmocked_execute.return_value = new_process.ProcessResult(0, '', False)\ncorpus_file_name = 'corpus-file'\nfs.create_file(os.path.join(trial_runner.corpus_dir, corpus_file_name))\ntrial_runner.cycle = 1337\n- mocked_is_corpus_dir_same.return_value = False\ntrial_runner.do_sync()\nassert mocked_execute.call_args_list == [\nmock.call([\n- 'gsutil', 'cp', 'corpus-archives/corpus-archive-1337.tar.gz',\n+ 'gsutil', 'cp', '/corpus-archives/corpus-archive-1337.tar.gz',\n('gs://bucket/experiment-name/experiment-folders/'\n'benchmark-1-fuzzer_a/trial-1/corpus/'\n'corpus-archive-1337.tar.gz')\n],\nexpect_zero=True),\nmock.call([\n- 'gsutil', 'rsync', '-d', '-r', 'results-copy',\n+ 'gsutil', 'rsync', '-d', '-r', '/results-copy',\n('gs://bucket/experiment-name/experiment-folders/'\n'benchmark-1-fuzzer_a/trial-1/results')\n],\nexpect_zero=True)\n]\n- unchanged_cycles_path = os.path.join(trial_runner.results_dir,\n- 'unchanged-cycles')\n- assert not os.path.exists(unchanged_cycles_path)\n-\n# Archives should get deleted after syncing.\narchives = os.listdir(trial_runner.corpus_archives_dir)\nassert len(archives) == 0\n-def test_is_corpus_dir_same_unchanged(trial_runner, fs):\n- \"\"\"Test is_corpus_dir_same behaves as expected when the corpus is\n- unchanged.\"\"\"\n- file_path = os.path.join(trial_runner.corpus_dir, '1')\n- fs.create_file(file_path)\n- stat_info = os.stat(file_path)\n- last_modified_time = stat_info.st_mtime\n- last_changed_time = stat_info.st_ctime\n- trial_runner.corpus_dir_contents.add(\n- runner.File(os.path.abspath(file_path), last_modified_time,\n- last_changed_time))\n- assert trial_runner.is_corpus_dir_same()\n-\n-\n-EXCLUDED_PATTERN = '.cur_input'\n-EXCLUDED_DIR_FILE = os.path.join(EXCLUDED_PATTERN, 'hello')\n-\n-\[email protected](('new_path', 'expected_result'),\n- [(EXCLUDED_DIR_FILE, True), (EXCLUDED_PATTERN, True),\n- ('other', False)])\n-def test_is_corpus_dir_same_changed(new_path, expected_result, trial_runner,\n- fs):\n- \"\"\"Test is_corpus_dir_same behaves as expected when there actually is a\n- change in the corpus (though some of these changes are excluded from being\n- considered.\"\"\"\n- file_path = os.path.join(trial_runner.corpus_dir, new_path)\n- fs.create_file(file_path)\n- assert bool(trial_runner.is_corpus_dir_same()) == expected_result\n-\n-\n-def test_is_corpus_dir_same_modified(trial_runner, fs):\n- \"\"\"Test is_corpus_dir_same behaves as expected when all of the files in the\n- corpus have the same names but one was modified.\"\"\"\n- file_path = os.path.join(trial_runner.corpus_dir, 'f')\n- fs.create_file(file_path)\n- trial_runner._set_corpus_dir_contents() # pylint: disable=protected-access\n- with open(file_path, 'w', encoding='utf-8') as file_handle:\n- file_handle.write('hi')\n- assert not trial_runner.is_corpus_dir_same()\n-\n-\nclass TestIntegrationRunner:\n\"\"\"Integration tests for the runner.\"\"\"\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Change format of corpus snapshots to save cost (#1626)
Don't store every file on each snapshot, just newly modified ones.
Also, get rid of unchanged-cycles, it's no longer as useful and adds
complexity. |
258,388 | 08.02.2023 10:35:15 | 18,000 | baacfa681ce28503b683b43cc6c0bd6708ca4e8a | Don't build python for no reason. Copy it | [
{
"change_type": "MODIFY",
"old_path": "docker/benchmark-builder/Dockerfile",
"new_path": "docker/benchmark-builder/Dockerfile",
"diff": "ARG parent_image\n+# Using multi-stage build to copy latest Python 3.\n+FROM gcr.io/fuzzbench/base-image AS base-image\n+\nFROM $parent_image\nARG fuzzer\n@@ -24,8 +27,6 @@ ENV FUZZER $fuzzer\nENV BENCHMARK $benchmark\nENV DEBUG_BUILDER $debug_builder\n-# Python 3.10.8 is not the default version in Ubuntu 20.04 (Focal Fossa).\n-ENV PYTHON_VERSION 3.10.8\n# Install dependencies required by Python3 or Pip3.\nRUN apt-get update && \\\n@@ -33,27 +34,19 @@ RUN apt-get update && \\\napt-get install -y \\\ncurl \\\nxz-utils \\\n- build-essential \\\nzlib1g-dev \\\nlibssl-dev \\\nlibffi-dev\n-RUN cd /tmp/ && \\\n- curl -O \\\n- https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tar.xz && \\\n- tar -xvf Python-$PYTHON_VERSION.tar.xz > /dev/null && \\\n- cd Python-$PYTHON_VERSION && \\\n- ./configure \\\n- --enable-loadable-sqlite-extensions \\\n- --enable-optimizations \\\n- > /dev/null && \\\n- make -j install > /dev/null && \\\n- rm -r /tmp/Python-$PYTHON_VERSION.tar.xz /tmp/Python-$PYTHON_VERSION\n-\n-# Install common python dependencies.\n-COPY ./requirements.txt /tmp\n-RUN pip3 install -r /tmp/requirements.txt\n+RUN rm -rf /usr/local/bin/python3.8* /usr/local/bin/pip3 /usr/local/lib/python3.8 \\\n+ /usr/local/include/python3.8 /usr/local/lib/python3.8/site-packages\n+# Copy latest python3 from base-image into local.\n+COPY --from=base-image /usr/local/bin/python3* /usr/local/bin/\n+COPY --from=base-image /usr/local/bin/pip3* /usr/local/bin/\n+COPY --from=base-image /usr/local/lib/python3.10 /usr/local/lib/python3.10\n+COPY --from=base-image /usr/local/include/python3.10 /usr/local/include/python3.10\n+COPY --from=base-image /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages\n# Copy the entire fuzzers directory tree to allow for module dependencies.\nCOPY fuzzers $SRC/fuzzers\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Don't build python for no reason. Copy it (#1690) |
258,388 | 08.02.2023 13:36:44 | 18,000 | 9a4d23ca877712854a8398daea2bbc5b503e36a9 | Make changes for oss-fuzz on demand | [
{
"change_type": "MODIFY",
"old_path": "common/benchmark_utils.py",
"new_path": "common/benchmark_utils.py",
"diff": "@@ -51,6 +51,10 @@ def get_project(benchmark):\ndef get_type(benchmark):\n\"\"\"Returns the type of |benchmark|\"\"\"\n+ # TODO(metzman): Use classes to mock a benchmark config for\n+ # OSS_FUZZ_ON_DEMAND.\n+ if environment.get('OSS_FUZZ_ON_DEMAND'):\n+ return BenchmarkType.CODE.value\nreturn benchmark_config.get_config(benchmark).get('type',\nBenchmarkType.CODE.value)\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "@@ -27,7 +27,7 @@ import threading\nimport time\nimport zipfile\n-from common import benchmark_config\n+from common import benchmark_utils\nfrom common import environment\nfrom common import experiment_utils\nfrom common import filesystem\n@@ -198,7 +198,7 @@ def run_fuzzer(max_total_time, log_filename):\n# benchmark.\nenv = None\nbenchmark = environment.get('BENCHMARK')\n- if benchmark_config.get_config(benchmark).get('type') == 'bug':\n+ if benchmark_utils.get_type(benchmark) == 'bug':\nenv = os.environ.copy()\nsanitizer.set_sanitizer_options(env, is_fuzz_run=True)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Make changes for oss-fuzz on demand (#1639) |
258,388 | 08.02.2023 19:36:34 | 18,000 | c7f1852dbc48516d3acded996384b47cb0769e79 | Refactor runner
Explicitly use OUTPUT_CORPUS_DIR as the corpus, don't assume it's at
/out/corpus | [
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "@@ -27,7 +27,7 @@ import threading\nimport time\nimport zipfile\n-from common import benchmark_utils\n+from common import benchmark_config\nfrom common import environment\nfrom common import experiment_utils\nfrom common import filesystem\n@@ -65,8 +65,9 @@ SEED_CORPUS_ARCHIVE_SUFFIX = '_seed_corpus.zip'\nfuzzer_errored_out = False # pylint:disable=invalid-name\n-RESULTS_DIRNAME = 'results'\nCORPUS_DIRNAME = 'corpus'\n+RESULTS_DIRNAME = 'results'\n+CORPUS_ARCHIVE_DIRNAME = 'corpus-archives'\ndef _clean_seed_corpus(seed_corpus_dir):\n@@ -175,7 +176,7 @@ def run_fuzzer(max_total_time, log_filename):\n\"\"\"Runs the fuzzer using its script. Logs stdout and stderr of the fuzzer\nscript to |log_filename| if provided.\"\"\"\ninput_corpus = environment.get('SEED_CORPUS_DIR')\n- output_corpus = environment.get('OUTPUT_CORPUS_DIR')\n+ output_corpus = os.environ['OUTPUT_CORPUS_DIR']\nfuzz_target_name = environment.get('FUZZ_TARGET')\ntarget_binary = fuzzer_utils.get_fuzz_target_binary(FUZZ_TARGET_DIR,\nfuzz_target_name)\n@@ -183,12 +184,6 @@ def run_fuzzer(max_total_time, log_filename):\nlogs.error('Fuzz target binary not found.')\nreturn\n- if environment.get('CUSTOM_SEED_CORPUS_DIR'):\n- _copy_custom_seed_corpus(input_corpus)\n- else:\n- _unpack_clusterfuzz_seed_corpus(target_binary, input_corpus)\n- _clean_seed_corpus(input_corpus)\n-\nif max_total_time is None:\nlogs.warning('max_total_time is None. Fuzzing indefinitely.')\n@@ -198,7 +193,7 @@ def run_fuzzer(max_total_time, log_filename):\n# benchmark.\nenv = None\nbenchmark = environment.get('BENCHMARK')\n- if benchmark_utils.get_type(benchmark) == 'bug':\n+ if benchmark_config.get_config(benchmark).get('type') == 'bug':\nenv = os.environ.copy()\nsanitizer.set_sanitizer_options(env, is_fuzz_run=True)\n@@ -250,8 +245,8 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nself.gcs_sync_dir = None\nself.cycle = 0\n- self.corpus_dir = os.path.abspath(CORPUS_DIRNAME)\n- self.corpus_archives_dir = os.path.abspath('corpus-archives')\n+ self.output_corpus = environment.get('OUTPUT_CORPUS_DIR')\n+ self.corpus_archives_dir = os.path.abspath(CORPUS_ARCHIVE_DIRNAME)\nself.results_dir = os.path.abspath(RESULTS_DIRNAME)\nself.log_file = os.path.join(self.results_dir, 'fuzzer-log.txt')\nself.last_sync_time = None\n@@ -260,7 +255,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\ndef initialize_directories(self):\n\"\"\"Initialize directories needed for the trial.\"\"\"\ndirectories = [\n- self.corpus_dir,\n+ self.output_corpus,\nself.corpus_archives_dir,\nself.results_dir,\n]\n@@ -268,6 +263,25 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nfor directory in directories:\nfilesystem.recreate_directory(directory)\n+ def set_up_corpus_dirs(self):\n+ \"\"\"Set up corpora for fuzzing. Set up the input corpus for use by the\n+ fuzzer and set up the output corpus for the first sync so the initial\n+ seeds can be measured.\"\"\"\n+ fuzz_target_name = environment.get('FUZZ_TARGET')\n+ target_binary = fuzzer_utils.get_fuzz_target_binary(\n+ FUZZ_TARGET_DIR, fuzz_target_name)\n+ input_corpus = environment.get('SEED_CORPUS_DIR')\n+ os.makedirs(input_corpus, exist_ok=True)\n+ if not environment.get('CUSTOM_SEED_CORPUS_DIR'):\n+ _unpack_clusterfuzz_seed_corpus(target_binary, input_corpus)\n+ else:\n+ _copy_custom_seed_corpus(input_corpus)\n+\n+ _clean_seed_corpus(input_corpus)\n+ # Ensure seeds are in output corpus.\n+ os.rmdir(self.output_corpus)\n+ shutil.copytree(input_corpus, self.output_corpus)\n+\ndef conduct_trial(self):\n\"\"\"Conduct the benchmarking trial.\"\"\"\nself.initialize_directories()\n@@ -277,14 +291,6 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nmax_total_time = environment.get('MAX_TOTAL_TIME')\nargs = (max_total_time, self.log_file)\n- input_corpus = environment.get('SEED_CORPUS_DIR')\n- output_corpus = environment.get('OUTPUT_CORPUS_DIR')\n-\n- # Ensure seeds are in output corpus.\n- os.rmdir(output_corpus)\n- os.makedirs(input_corpus, exist_ok=True)\n- shutil.copytree(input_corpus, output_corpus)\n-\n# Sync initial corpus before fuzzing begins.\nself.do_sync()\n@@ -375,10 +381,10 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nself.corpus_archives_dir,\nexperiment_utils.get_corpus_archive_name(self.cycle))\n- corpus_dir_name = os.path.basename(self.corpus_dir)\n+ corpus_dir_name = os.path.basename(self.output_corpus)\nwith tarfile.open(archive, 'w:gz') as tar:\nnew_archive_time = self.last_archive_time\n- for file_path in get_corpus_elements(self.corpus_dir):\n+ for file_path in get_corpus_elements(self.output_corpus):\nstat_info = os.stat(file_path)\nlast_modified_time = stat_info.st_mtime\nif last_modified_time <= self.last_archive_time:\n"
},
{
"change_type": "MODIFY",
"old_path": "experiment/test_runner.py",
"new_path": "experiment/test_runner.py",
"diff": "@@ -91,7 +91,8 @@ def trial_runner(fs, environ):\n'TRIAL_ID': str(TRIAL_NUM),\n'FUZZER': FUZZER,\n'EXPERIMENT_FILESTORE': EXPERIMENT_FILESTORE,\n- 'MAX_TOTAL_TIME': str(MAX_TOTAL_TIME)\n+ 'MAX_TOTAL_TIME': str(MAX_TOTAL_TIME),\n+ 'OUTPUT_CORPUS_DIR': '/out/corpus',\n})\nwith mock.patch('common.filestore_utils.rm'):\n@@ -245,7 +246,7 @@ def test_do_sync_changed(mocked_execute, fs, trial_runner, fuzzer_module):\nprevious one.\"\"\"\nmocked_execute.return_value = new_process.ProcessResult(0, '', False)\ncorpus_file_name = 'corpus-file'\n- fs.create_file(os.path.join(trial_runner.corpus_dir, corpus_file_name))\n+ fs.create_file(os.path.join(trial_runner.output_corpus, corpus_file_name))\ntrial_runner.cycle = 1337\ntrial_runner.do_sync()\nassert mocked_execute.call_args_list == [\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Refactor runner (#1693)
Explicitly use OUTPUT_CORPUS_DIR as the corpus, don't assume it's at
/out/corpus |
258,388 | 08.02.2023 20:10:10 | 18,000 | cf86138081ec705a47ce0a4bab07b5737292e7e0 | Allow running the measurer outside of experiments | [
{
"change_type": "MODIFY",
"old_path": "common/benchmark_utils.py",
"new_path": "common/benchmark_utils.py",
"diff": "@@ -41,7 +41,11 @@ BENCHMARK_TYPE_STRS = {benchmark_type.value for benchmark_type in BenchmarkType}\ndef get_fuzz_target(benchmark):\n\"\"\"Returns the fuzz target of |benchmark|\"\"\"\n- return benchmark_config.get_config(benchmark)['fuzz_target']\n+ # Do this because of OSS-Fuzz-on-demand.\n+ # TODO(metzman): Use classes to mock a benchmark config for\n+ # OSS_FUZZ_ON_DEMAND.\n+ return benchmark_config.get_config(benchmark).get(\n+ 'fuzz_target', environment.get('FUZZ_TARGET'))\ndef get_project(benchmark):\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "experiment/measurer/standalone.py",
"diff": "+# Copyright 2023 Google LLC\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+# http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"Module for starting a measure manager outside of an experiment. Useful when\n+measuring results in OSS-Fuzz.\"\"\"\n+import os\n+import sys\n+\n+from database import models\n+from database import utils as db_utils\n+from experiment.measurer import measure_manager\n+from experiment import scheduler\n+\n+\n+def _initialize_db():\n+ \"\"\"Initializes |experiment| in the database by creating the experiment\n+ entity. Warning you probably should not be using this method if connected to\n+ anything other than a throwaway sqlite db. Most of this code is copied from\n+ dispatcher.py which usually has the job of setting up an experiment.\"\"\"\n+ # TODO(metzman): Most of the strings in this function should probably be\n+ # configurable.\n+\n+ db_utils.initialize()\n+ # One time set up for any db used by FuzzBench.\n+ models.Base.metadata.create_all(db_utils.engine)\n+\n+ # Now set up the experiment.\n+ with db_utils.session_scope() as session:\n+ experiment_name = 'oss-fuzz-on-demand'\n+ experiment_exists = session.query(models.Experiment).filter(\n+ models.Experiment.name == experiment_name).first()\n+ if experiment_exists:\n+ raise Exception('Experiment already exists in database.')\n+\n+ db_utils.add_all([\n+ db_utils.get_or_create(models.Experiment,\n+ name=experiment_name,\n+ git_hash='none',\n+ private=True,\n+ experiment_filestore='/out/filestore',\n+ description='none'),\n+ ])\n+\n+ # Set up the trial.\n+ trial = models.Trial(fuzzer=os.environ['FUZZER'],\n+ experiment='oss-fuzz-on-demand',\n+ benchmark=os.environ['BENCHMARK'],\n+ preemptible=False,\n+ time_started=scheduler.datetime_now(),\n+ time_ended=scheduler.datetime_now())\n+ db_utils.add_all([trial])\n+\n+\n+def main():\n+ \"\"\"Runs the measurer.\"\"\"\n+ _initialize_db()\n+ return measure_manager.main()\n+\n+\n+if __name__ == '__main__':\n+ sys.exit(main())\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Allow running the measurer outside of experiments (#1694) |
258,388 | 08.02.2023 21:20:56 | 18,000 | 88ea515a556c04e6f116b3849ed8f1ff0e511a76 | Speed up coverage builds by not cloning llvm source
Download a libfuzzer zip instead. | [
{
"change_type": "MODIFY",
"old_path": "fuzzers/coverage/builder.Dockerfile",
"new_path": "fuzzers/coverage/builder.Dockerfile",
"diff": "ARG parent_image\nFROM $parent_image\n-# The patch adds hook to dump clang coverage data when timeout.\n-COPY patch.diff /\n+ENV LF_PATH /tmp/libfuzzer.zip\n# Use a libFuzzer version that supports clang source-based coverage.\n-RUN git clone https://github.com/llvm/llvm-project.git /llvm-project && \\\n- cd /llvm-project && \\\n- git checkout 0b5e6b11c358e704384520dc036eddb5da1c68bf && \\\n- patch -p1 < /patch.diff && \\\n- cd /llvm-project/compiler-rt/lib/fuzzer && \\\n+# This libfuzzer is 0b5e6b11c358e704384520dc036eddb5da1c68bf with\n+# https://github.com/google/fuzzbench/blob/cf86138081ec705a47ce0a4bab07b5737292e7e0/fuzzers/coverage/patch.diff\n+# applied.\n+\n+RUN wget https://storage.googleapis.com/fuzzbench-artifacts/libfuzzer.zip -O $LF_PATH && \\\n+ echo \"cc78179f6096cae4b799d0cc9436f000cc0be9b1fb59500d16b14b1585d46b61 $LF_PATH\" | sha256sum --check --status && \\\n+ mkdir /tmp/libfuzzer && \\\n+ cd /tmp/libfuzzer && \\\n+ unzip $LF_PATH && \\\nbash build.sh && \\\n- cp libFuzzer.a /usr/lib\n+ cp libFuzzer.a /usr/lib && \\\n+ rm -rf /tmp/libfuzzer $LF_PATH /patch.diff\n\\ No newline at end of file\n"
},
{
"change_type": "DELETE",
"old_path": "fuzzers/coverage/patch.diff",
"new_path": null,
"diff": "-diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n-index 306e644277c..26db440ecd7 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n-+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp\n-@@ -737,6 +737,8 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {\n- F->SetMaxInputLen(kDefaultMaxMergeLen);\n- assert(Flags.merge_control_file);\n- F->CrashResistantMergeInternalStep(Flags.merge_control_file);\n-+ if (Options.DumpCoverage)\n-+ TPC.DumpCoverage();\n- exit(0);\n- }\n-\n-diff --git a/compiler-rt/lib/fuzzer/FuzzerExtFunctions.def b/compiler-rt/lib/fuzzer/FuzzerExtFunctions.def\n-index bb15d68e0de..154b6239d53 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerExtFunctions.def\n-+++ b/compiler-rt/lib/fuzzer/FuzzerExtFunctions.def\n-@@ -48,3 +48,6 @@ EXT_FUNC(__sanitizer_dump_coverage, void, (const uintptr_t *, uintptr_t),\n- EXT_FUNC(__msan_scoped_disable_interceptor_checks, void, (), false);\n- EXT_FUNC(__msan_scoped_enable_interceptor_checks, void, (), false);\n- EXT_FUNC(__msan_unpoison, void, (const volatile void *, size_t size), false);\n-+\n-+// Clang source-based coverage functions.\n-+EXT_FUNC(__llvm_profile_dump, int, (), false);\n-diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n-index b6b11f08579..52309df4696 100644\n---- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n-+++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp\n-@@ -323,11 +323,8 @@ void TracePC::PrintCoverage() {\n- }\n-\n- void TracePC::DumpCoverage() {\n-- if (EF->__sanitizer_dump_coverage) {\n-- Vector<uintptr_t> PCsCopy(GetNumPCs());\n-- for (size_t i = 0; i < GetNumPCs(); i++)\n-- PCsCopy[i] = PCs()[i] ? GetPreviousInstructionPc(PCs()[i]) : 0;\n-- EF->__sanitizer_dump_coverage(PCsCopy.data(), PCsCopy.size());\n-+ if (EF->__llvm_profile_dump) {\n-+ EF->__llvm_profile_dump();\n- }\n- }\n-\n-diff --git a/compiler-rt/lib/fuzzer/build.sh b/compiler-rt/lib/fuzzer/build.sh\n-index 504e54e3a81..78191272c68 100755\n---- a/compiler-rt/lib/fuzzer/build.sh\n-+++ b/compiler-rt/lib/fuzzer/build.sh\n-@@ -2,7 +2,7 @@\n- LIBFUZZER_SRC_DIR=$(dirname $0)\n- CXX=\"${CXX:-clang}\"\n- for f in $LIBFUZZER_SRC_DIR/*.cpp; do\n-- $CXX -g -O2 -fno-omit-frame-pointer -std=c++11 $f -c &\n-+ $CXX -stdlib=libc++ -g -O2 -fno-omit-frame-pointer -std=c++11 $f -fPIC -c &\n- done\n- wait\n- rm -f libFuzzer.a\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Speed up coverage builds by not cloning llvm source (#1695)
Download a libfuzzer zip instead. |
258,388 | 08.02.2023 22:08:35 | 18,000 | 3dd04efae948f37ea43241c2802677847c3646c2 | [runner] Fix bug
Actually call the newly factored out function. | [
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "@@ -263,7 +263,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nfor directory in directories:\nfilesystem.recreate_directory(directory)\n- def set_up_corpus_dirs(self):\n+ def set_up_corpus_directories(self):\n\"\"\"Set up corpora for fuzzing. Set up the input corpus for use by the\nfuzzer and set up the output corpus for the first sync so the initial\nseeds can be measured.\"\"\"\n@@ -288,6 +288,8 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nlogs.info('Starting trial.')\n+ self.set_up_corpus_directories()\n+\nmax_total_time = environment.get('MAX_TOTAL_TIME')\nargs = (max_total_time, self.log_file)\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [runner] Fix bug (#1696)
Actually call the newly factored out function. |
258,388 | 08.02.2023 22:32:12 | 18,000 | b7ad334face959bd6a92f2676798a3b0025955db | Make corpus element names less weird in the archives.
Previously they were output-corpus/../../output-corpus/$NAME Instead add
them relative to the corpus dir.
e.g.
Given:
corpus/a
corpus/subdir/b
archive will contain a, subdir/b | [
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "@@ -383,7 +383,6 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nself.corpus_archives_dir,\nexperiment_utils.get_corpus_archive_name(self.cycle))\n- corpus_dir_name = os.path.basename(self.output_corpus)\nwith tarfile.open(archive, 'w:gz') as tar:\nnew_archive_time = self.last_archive_time\nfor file_path in get_corpus_elements(self.output_corpus):\n@@ -392,10 +391,7 @@ class TrialRunner: # pylint: disable=too-many-instance-attributes\nif last_modified_time <= self.last_archive_time:\ncontinue # We've saved this file already.\nnew_archive_time = max(new_archive_time, last_modified_time)\n-\n- arcname = os.path.join(\n- corpus_dir_name, os.path.relpath(file_path,\n- corpus_dir_name))\n+ arcname = os.path.relpath(file_path, self.output_corpus)\ntry:\ntar.add(file_path, arcname=arcname)\nexcept (FileNotFoundError, OSError):\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | Make corpus element names less weird in the archives. (#1697)
Previously they were output-corpus/../../output-corpus/$NAME Instead add
them relative to the corpus dir.
e.g.
Given:
corpus/a
corpus/subdir/b
archive will contain a, subdir/b |
258,388 | 08.02.2023 22:32:28 | 18,000 | 543e1df5440953976b6c2e03355a30b6f6241cc8 | [runner] Remove unused function | [
{
"change_type": "MODIFY",
"old_path": "experiment/runner.py",
"new_path": "experiment/runner.py",
"diff": "@@ -450,29 +450,6 @@ def get_fuzzer_module(fuzzer):\nreturn fuzzer_module\n-def tar_directory(directory, tar):\n- \"\"\"Add the contents of |directory| to |tar|. Note that this should not\n- exception just because files and directories are being deleted from\n- |directory| while this function is being executed.\"\"\"\n- directory = os.path.abspath(directory)\n- directory_name = os.path.basename(directory)\n- for root, _, files in os.walk(directory):\n- for filename in files:\n- file_path = os.path.join(root, filename)\n- arcname = os.path.join(directory_name,\n- os.path.relpath(file_path, directory))\n- try:\n- tar.add(file_path, arcname=arcname)\n- except (FileNotFoundError, OSError):\n- # We will get these errors if files or directories are being\n- # deleted from |directory| as we archive it. Don't bother\n- # rescanning the directory, new files will be archived in the\n- # next sync.\n- pass\n- except Exception: # pylint: disable=broad-except\n- logs.error('Unexpected exception occurred when archiving.')\n-\n-\ndef get_corpus_elements(corpus_dir):\n\"\"\"Returns a list of absolute paths to corpus elements in |corpus_dir|.\nExcludes certain elements.\"\"\"\n"
}
] | Python | Apache License 2.0 | google/fuzzbench | [runner] Remove unused function (#1698) |
288,284 | 09.01.2017 15:01:06 | 18,000 | 03f9c6c076e7691cd579779ae0dc466653811bba | Replaced observer used by inventory-typeahead | [
{
"change_type": "MODIFY",
"old_path": "app/components/inventory-typeahead.js",
"new_path": "app/components/inventory-typeahead.js",
"diff": "@@ -5,6 +5,7 @@ export default TypeAhead.extend({\ndisplayKey: 'name',\nshowQuantity: true,\ni18n: Ember.inject.service(),\n+ store: Ember.inject.service(),\n_mapInventoryItems(item) {\nlet returnObj = {};\n@@ -43,5 +44,19 @@ export default TypeAhead.extend({\nbloodhound.clear();\nbloodhound.add(content.map(this._mapInventoryItems.bind(this)));\n}\n- }.observes('content.[]')\n+ }.observes('content.[]'),\n+\n+ itemSelected(selectedInventoryItem) {\n+ this._super();\n+ let store = this.get('store');\n+ if (!Ember.isEmpty(selectedInventoryItem)) {\n+ store.find('inventory', selectedInventoryItem.id).then((inventoryItem) => {\n+ let model = this.get('model');\n+ model.set('inventoryItem', inventoryItem);\n+ Ember.run.once(this, function() {\n+ model.validate().catch(Ember.K);\n+ });\n+ });\n+ }\n+ }\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/inventory/batch/controller.js",
"new_path": "app/inventory/batch/controller.js",
"diff": "import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';\nimport InventoryId from 'hospitalrun/mixins/inventory-id';\nimport InventoryLocations from 'hospitalrun/mixins/inventory-locations';\n-import InventorySelection from 'hospitalrun/mixins/inventory-selection';\nimport Ember from 'ember';\nimport { translationMacro as t } from 'ember-i18n';\n-export default AbstractEditController.extend(InventoryId, InventoryLocations, InventorySelection, {\n+export default AbstractEditController.extend(InventoryId, InventoryLocations, {\ndoingUpdate: false,\ninventoryController: Ember.inject.controller('inventory'),\ninventoryItems: null,\n"
},
{
"change_type": "MODIFY",
"old_path": "app/inventory/request/controller.js",
"new_path": "app/inventory/request/controller.js",
"diff": "import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';\nimport FulfillRequest from 'hospitalrun/mixins/fulfill-request';\nimport InventoryLocations from 'hospitalrun/mixins/inventory-locations'; // inventory-locations mixin is needed for fulfill-request mixin!\n-import InventorySelection from 'hospitalrun/mixins/inventory-selection';\nimport Ember from 'ember';\n-export default AbstractEditController.extend(FulfillRequest, InventoryLocations, InventorySelection, {\n+export default AbstractEditController.extend(FulfillRequest, InventoryLocations, {\ninventoryController: Ember.inject.controller('inventory'),\ninventoryItems: null,\ncancelAction: 'allRequests',\n"
},
{
"change_type": "MODIFY",
"old_path": "app/inventory/request/template.hbs",
"new_path": "app/inventory/request/template.hbs",
"diff": "</div>\n{{inventory-location-picker label=(t 'inventory.labels.pullFrom') quantityRequested=model.quantity\nlocationList=model.inventoryItem.availableLocations\n- selectedLocations=model.inventoryLocations\n+ selectedLocations=model.inventoryLocations class=\"inventory-location\"\n}}\n<div class=\"form-group\">\n<label class=\"control-label sr-only\">{{t 'inventory.labels.consumePurchases'}}</label>\n"
},
{
"change_type": "MODIFY",
"old_path": "app/medication/edit/controller.js",
"new_path": "app/medication/edit/controller.js",
"diff": "@@ -3,11 +3,10 @@ import AddNewPatient from 'hospitalrun/mixins/add-new-patient';\nimport Ember from 'ember';\nimport FulfillRequest from 'hospitalrun/mixins/fulfill-request';\nimport InventoryLocations from 'hospitalrun/mixins/inventory-locations'; // inventory-locations mixin is needed for fulfill-request mixin!\n-import InventorySelection from 'hospitalrun/mixins/inventory-selection';\nimport PatientSubmodule from 'hospitalrun/mixins/patient-submodule';\nimport UserSession from 'hospitalrun/mixins/user-session';\n-export default AbstractEditController.extend(AddNewPatient, InventorySelection, FulfillRequest, InventoryLocations, PatientSubmodule, UserSession, {\n+export default AbstractEditController.extend(AddNewPatient, FulfillRequest, InventoryLocations, PatientSubmodule, UserSession, {\nmedicationController: Ember.inject.controller('medication'),\nexpenseAccountList: Ember.computed.alias('medicationController.expenseAccountList'),\n"
},
{
"change_type": "MODIFY",
"old_path": "app/medication/edit/template.hbs",
"new_path": "app/medication/edit/template.hbs",
"diff": "{{select-or-typeahead property=\"expenseAccount\" label=(t 'labels.billTo') list=expenseAccountList selection=model.expenseAccount }}\n{{inventory-location-picker label=(t 'labels.pullFrom') quantityRequested=model.quantity\nlocationList= model.inventoryItem.availableLocations\n- selectedLocations=model.inventoryLocations\n+ selectedLocations=model.inventoryLocations class=\"inventory-location\"\n}}\n{{/if}}\n{{/if}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/medication/return/controller.js",
"new_path": "app/medication/return/controller.js",
"diff": "@@ -3,11 +3,10 @@ import AbstractEditController from 'hospitalrun/controllers/abstract-edit-contro\nimport Ember from 'ember';\nimport FulfillRequest from 'hospitalrun/mixins/fulfill-request';\nimport InventoryLocations from 'hospitalrun/mixins/inventory-locations'; // inventory-locations mixin is needed for fulfill-request mixin!\n-import InventorySelection from 'hospitalrun/mixins/inventory-selection';\nimport PatientSubmodule from 'hospitalrun/mixins/patient-submodule';\nimport SelectValues from 'hospitalrun/utils/select-values';\n-export default AbstractEditController.extend(FulfillRequest, InventoryLocations, InventorySelection, PatientSubmodule, {\n+export default AbstractEditController.extend(FulfillRequest, InventoryLocations, PatientSubmodule, {\nmedicationController: Ember.inject.controller('medication'),\nmedicationList: [],\n"
},
{
"change_type": "DELETE",
"old_path": "app/mixins/inventory-selection.js",
"new_path": null,
"diff": "-import Ember from 'ember';\n-export default Ember.Mixin.create({\n- selectedInventoryItem: null,\n-\n- /**\n- * For use with the inventory-type ahead. When an inventory item is selected, resolve the selected\n- * inventory item into an actual model object and set is as inventoryItem.\n- */\n- inventoryItemChanged: function() {\n- let selectedInventoryItem = this.get('selectedInventoryItem') || this.get('model.selectedInventoryItem');\n- if (!Ember.isEmpty(selectedInventoryItem)) {\n- this.store.find('inventory', selectedInventoryItem.id).then(function(inventoryItem) {\n- let model = this.get('model');\n- model.set('inventoryItem', inventoryItem);\n- Ember.run.once(this, function() {\n- model.validate().catch(Ember.K);\n- });\n- }.bind(this));\n- }\n- }.observes('selectedInventoryItem', 'model.selectedInventoryItem')\n-});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/procedures/medication/controller.js",
"new_path": "app/procedures/medication/controller.js",
"diff": "import AbstractEditController from 'hospitalrun/controllers/abstract-edit-controller';\n-import InventorySelection from 'hospitalrun/mixins/inventory-selection';\nimport Ember from 'ember';\n-export default AbstractEditController.extend(InventorySelection, {\n+export default AbstractEditController.extend({\ncancelAction: 'closeModal',\nnewCharge: false,\nrequestingController: Ember.inject.controller('procedures/edit'),\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Replaced observer used by inventory-typeahead |
288,284 | 11.01.2017 16:35:31 | 18,000 | 8cd603d7333e77d982b9b8737fc12a71eb1e9bd4 | Fixed layout of typeahead/select fields. | [
{
"change_type": "MODIFY",
"old_path": "app/templates/components/select-or-typeahead.hbs",
"new_path": "app/templates/components/select-or-typeahead.hbs",
"diff": "{{#if userCanAdd}}\n{{partial 'components/render-typeahead'}}\n{{else}}\n- {{em-select class=className label=label\n+ {{em-select class=(concat 'form-input-group ' className) label=label\nproperty=property content=content\noptionValuePath=optionValuePath optionLabelPath=optionLabelPath\nselected=selection prompt=prompt\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed layout of typeahead/select fields. |
288,284 | 11.01.2017 16:37:12 | 18,000 | 3e8262b5ec9152373159612979cd827c68232753 | Changed setDefaultCustomForms to return model | [
{
"change_type": "MODIFY",
"old_path": "app/services/custom-forms.js",
"new_path": "app/services/custom-forms.js",
"diff": "@@ -56,6 +56,7 @@ export default Ember.Service.extend({\n}\n});\n}\n+ return model;\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/visits/edit/route.js",
"new_path": "app/visits/edit/route.js",
"diff": "@@ -31,9 +31,7 @@ export default AbstractEditRoute.extend(ChargeRoute, PatientListRoute, {\ncustomForms: Ember.Object.create()\n};\nlet customForms = this.get('customForms');\n- return customForms.setDefaultCustomForms(['visit'], newVisitData).then(() => {\n- return newVisitData;\n- });\n+ return customForms.setDefaultCustomForms(['visit'], newVisitData);\n},\ngetScreenTitle(model) {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Changed setDefaultCustomForms to return model |
288,284 | 11.01.2017 17:16:36 | 18,000 | 2d26e7f91b42061d57d6899918d185fab4b4639d | Don't show allergies if there are none and user can't add them | [
{
"change_type": "MODIFY",
"old_path": "app/components/medication-allergy.js",
"new_path": "app/components/medication-allergy.js",
"diff": "import Ember from 'ember';\nconst {\n- computed\n+ computed,\n+ get,\n+ isEmpty\n} = Ember;\nexport default Ember.Component.extend({\n@@ -35,6 +37,14 @@ export default Ember.Component.extend({\n}\n}),\n+ showAllergies: computed('canAddAllergy', 'patient.allergies.[]', {\n+ get() {\n+ let canAddAllergy = get(this, 'canAddAllergy');\n+ let patientAllergies = get(this, 'patient.allergies');\n+ return canAddAllergy || !isEmpty(patientAllergies);\n+ }\n+ }),\n+\nmodalTitle: Ember.computed('currentAllergy', function() {\nlet currentAllergy = this.get('currentAllergy');\nlet i18n = this.get('i18n');\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/medication-allergy.hbs",
"new_path": "app/templates/components/medication-allergy.hbs",
"diff": "+{{#if showAllergies}}\n<label class=\"ps-info-label wide\">{{t 'allergies.labels.patientAllergy'}}</label>\n{{#if canAddAllergy}}\n{{#if canAddAllergy}}\n<a class=\"clickable allergy-button\" {{action \"editAllergy\" allergy}}>{{allergy.name}}</a>\n{{else}}\n- {{allergy.name}}\n+ <span>{{allergy.name}}</span>\n{{/if}}\n{{/each}}\n</div>\n+{{/if}}\n{{#if displayModal}}\n{{#modal-dialog\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Don't show allergies if there are none and user can't add them |
288,284 | 11.01.2017 17:16:52 | 18,000 | 610408b9d3267fb0a381834a02ea686ea4bf6650 | Don't show sex unless field is set | [
{
"change_type": "MODIFY",
"old_path": "app/templates/components/patient-summary.hbs",
"new_path": "app/templates/components/patient-summary.hbs",
"diff": "<label class=\"ps-info-label\">{{t 'labels.name'}}</label>\n<span class=\"ps-info-data\">{{patient.displayName}}</span>\n</div>\n-\n+ {{#if patient.sex}}\n<div class=\"ps-info-group\">\n<label class=\"ps-info-label\">{{t 'labels.sex'}}</label>\n<span class=\"ps-info-data\">{{patient.sex}}</span>\n</div>\n+ {{/if}}\n{{#if patient.dateOfBirth}}\n<div class=\"ps-info-group\">\n<label class=\"ps-info-label\">{{t 'labels.age'}}</label>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Don't show sex unless field is set |
288,284 | 13.01.2017 10:28:29 | 18,000 | 5d05bfc72c3ef5c316d7e3bfb258429b10ea6f42 | New component for operative plan and operation report
Component to add/maintain multiple procedures | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "app/components/operative-procedures.js",
"diff": "+import Ember from 'ember';\n+\n+const {\n+ computed,\n+ isEmpty,\n+ get,\n+ set\n+} = Ember;\n+\n+export function addProcedure(model) {\n+ let procedures = get(model, 'procedures');\n+ let description = get(model, 'procedureDescription');\n+ if (!isEmpty(description)) {\n+ procedures.addObject({\n+ description\n+ });\n+ set(model, 'procedureDescription', null);\n+ }\n+}\n+\n+export default Ember.Component.extend({\n+ model: null,\n+ procedureList: null,\n+ haveProcedures: computed('model.procedures.[]', {\n+ get() {\n+ return !isEmpty(get(this, 'model.procedures'));\n+ }\n+ }),\n+\n+ actions: {\n+ addProcedure() {\n+ let model = get(this, 'model');\n+ addProcedure(model);\n+ },\n+\n+ deleteProcedure(procedureToDelete) {\n+ let model = get(this, 'model');\n+ let procedures = get(model, 'procedures');\n+ procedures.removeObject(procedureToDelete);\n+ model.validate();\n+ }\n+ }\n+\n+});\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "app/templates/components/operative-procedures.hbs",
"diff": "+<div class=\"row\">\n+ {{select-or-typeahead\n+ className=(concat (if (not-eq haveProcedures true) 'required ') 'procedure-description col-sm-10')\n+ property=\"procedureDescription\"\n+ label=(t 'components.operativeProcedures.labels.procedure') list=procedureList\n+ selection=procedureDescription hint=false\n+ }}\n+ <div class=\"col-sm-2\">\n+ <label class=\"control-label\"> </label>\n+ <p class=\" form-control-static\">\n+ <button class=\"btn btn-primary\" {{action 'addProcedure'}}>\n+ <span class=\"octicon octicon-plus\"></span> {{t 'components.operativeProcedures.buttons.addProcedure'}}\n+ </button>\n+ </p>\n+ </div>\n+</div>\n+{{#if haveProcedures}}\n+ <h4>{{t 'components.operativeProcedures.titles.procedures'}}</h4>\n+ <table class=\"table\">\n+ <tr class=\"table-header\">\n+ <th>{{t 'components.operativeProcedures.labels.procedure'}}</th>\n+ <th>{{t 'labels.action'}}</th>\n+ </tr>\n+ {{#each model.procedures as |procedure|}}\n+ <tr>\n+ <td>{{procedure.description}}</td>\n+ <td>\n+ <button type=\"button\" class=\"btn btn-default warning\" {{action \"deleteProcedure\" procedure bubbles=false }}>\n+ <span class=\"octicon octicon-x\"></span>{{t 'buttons.delete'}}\n+ </button>\n+ </td>\n+ </tr>\n+ {{/each}}\n+ </table>\n+{{/if}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | New component for operative plan and operation report
Component to add/maintain multiple procedures |
288,284 | 13.01.2017 16:11:19 | 18,000 | 0ab130643e72a41be5ec843f318c39aadf0dd353 | Test for operative plan and operation report | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/acceptance/operative-test.js",
"diff": "+import Ember from 'ember';\n+import { module, test } from 'qunit';\n+import startApp from 'hospitalrun/tests/helpers/start-app';\n+\n+const ADDITIONAL_NOTES = 'Additional Notes here';\n+const CASE_COMPLEXITY = 7;\n+const OPERATION_DESCRIPTION = 'Operation Description Goes Here';\n+const OPERATION_SURGEON = 'Dr Nick';\n+const PROCEDURE_FIX_ARM = 'fix broken arm';\n+const PROCEDURE_HIP = 'hip adductor release';\n+\n+module('Acceptance | Operative Plan and Operation Report', {\n+ beforeEach() {\n+ this.application = startApp();\n+ },\n+\n+ afterEach() {\n+ Ember.run(this.application, 'destroy');\n+ }\n+});\n+\n+test('Plan and report creation', function(assert) {\n+ runWithPouchDump('patient', function() {\n+ let surgeryDate = new Date();\n+ authenticateUser();\n+ visit('/patients');\n+ andThen(() =>{\n+ assert.equal(currentURL(), '/patients', 'Patients listing url is correct');\n+ click('button:contains(Edit)');\n+ });\n+ andThen(() =>{\n+ assert.equal(currentURL(), '/patients/edit/C87BFCB2-F772-7A7B-8FC7-AD00C018C32A', 'Patient edit URL is correct');\n+ click('a:contains(Add Diagnosis)');\n+ waitToAppear('.modal-dialog');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.modal-title').text(), 'Add Diagnosis', 'Add Diagnosis dialog displays');\n+ fillIn('.diagnosis-text input', 'Broken Arm');\n+ click('.modal-footer button:contains(Add)');\n+ waitToAppear('a.primary-diagnosis');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('a.primary-diagnosis:contains(Broken Arm)').length, 1, 'New primary diagnosis appears');\n+ click('a:contains(Add Diagnosis)');\n+ waitToAppear('.modal-dialog');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.modal-title').text(), 'Add Diagnosis', 'Add Diagnosis dialog displays');\n+ fillIn('.diagnosis-text input', 'Tennis Elbow');\n+ click('.secondary-diagnosis input');\n+ click('.modal-footer button:contains(Add)');\n+ waitToAppear('a.secondary-diagnosis');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('a.secondary-diagnosis:contains(Tennis Elbow)').length, 1, 'New secondary diagnosis appears');\n+ click('a:contains(Add Operative Plan)');\n+ });\n+ andThen(() =>{\n+ assert.equal(currentURL(), '/patients/operative-plan/new', 'New operative plan URL is correct');\n+ assert.equal(find('.patient-name .ps-info-data').text(), 'Joe Bagadonuts', 'Joe Bagadonuts patient header displays');\n+ assert.equal(find('.view-current-title').text(), 'New Operative Plan', 'New operative plan title is correct');\n+ assert.equal(find('span.primary-diagnosis:contains(Broken Arm)').length, 1, 'Primary diagnosis appears as read only');\n+ assert.equal(find('span.secondary-diagnosis:contains(Tennis Elbow)').length, 1, 'Secondary diagnosis appears as read only');\n+ fillIn('.operation-description textarea', OPERATION_DESCRIPTION);\n+ typeAheadFillIn('.procedure-description', PROCEDURE_HIP);\n+ click('button:contains(Add Procedure)');\n+ waitToAppear('.procedure-listing td.procedure-description');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.procedure-listing td.procedure-description').text(), PROCEDURE_HIP, 'Added procedure displays in procedure table');\n+ typeAheadFillIn('.procedure-description', 'Delete Me');\n+ click('button:contains(Add Procedure)');\n+ waitToAppear('.procedure-listing td.procedure-description:contains(Delete Me)');\n+ });\n+ andThen(() =>{\n+ findWithAssert('.procedure-listing td.procedure-description:contains(Delete Me)');\n+ click('.procedure-listing tr:last button:contains(Delete)');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.procedure-listing td.procedure-description:contains(Delete Me)').length, 0, 'Procedure is properly deleted');\n+ typeAheadFillIn('.procedure-description', PROCEDURE_FIX_ARM); // Leave typeahead filled in with value to automatically add on save.\n+ selectDate('.surgery-date input', surgeryDate);\n+ typeAheadFillIn('.plan-surgeon', OPERATION_SURGEON);\n+ assert.equal(find('.plan-status select').val(), 'planned', 'Plan status is set to planned');\n+ fillIn('.case-complexity input', CASE_COMPLEXITY);\n+ fillIn('.admission-instructions textarea', 'Get blood tests done on admission.');\n+ fillIn('.additional-notes textarea', ADDITIONAL_NOTES);\n+ });\n+ andThen(() =>{\n+ click('.panel-footer button:contains(Add)');\n+ waitToAppear('.modal-dialog');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.modal-title').text(), 'Plan Saved', 'Plan saved modal displays');\n+ click('button:contains(Ok)');\n+ });\n+ andThen(() =>{\n+ assert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_FIX_ARM})`).length, 1, 'Procedure from typeahead gets added to procedure list on save');\n+ click('button:contains(Return)');\n+ });\n+ andThen(() =>{\n+ assert.equal(currentURL(), '/patients/edit/C87BFCB2-F772-7A7B-8FC7-AD00C018C32A', 'Return goes back to patient screen');\n+ assert.equal(find('a:contains(Current Operative Plan)').length, 1, 'Link to newly created plan appears');\n+ click('a:contains(Current Operative Plan)');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.view-current-title').text(), 'Edit Operative Plan', 'Edit operative plan title is correct');\n+ assert.equal(find('button:contains(Complete Plan)').length, 1, 'Complete Plan button appears');\n+ click('button:contains(Complete Plan)');\n+ });\n+ andThen(() =>{\n+ assert.equal(currentURL(), '/patients/operation-report/new', 'Operation report url is correct');\n+ assert.equal(find('.view-current-title').text(), 'New Operation Report', 'New Operation Report title is correct');\n+ assert.equal(find('.patient-name .ps-info-data').text(), 'Joe Bagadonuts', 'Joe Bagadonuts patient header displays');\n+ assert.equal(find('a.primary-diagnosis:contains(Broken Arm)').length, 1, 'Primary diagnosis appears as editable');\n+ assert.equal(find('a.secondary-diagnosis:contains(Tennis Elbow)').length, 1, 'Secondary diagnosis appears as editable');\n+ assert.equal(find('.operation-description textarea').val(), OPERATION_DESCRIPTION, 'Operation description is copied from operative plan');\n+ assert.equal(find('.surgery-date input').val(), moment(surgeryDate).format('l'), 'Surgery date is copied from operative plan');\n+ assert.equal(find('.operation-surgeon .tt-input').val(), OPERATION_SURGEON, 'Surgeon is copied from operative plan');\n+ assert.equal(find('.case-complexity input').val(), CASE_COMPLEXITY, 'Case complexity is copied from operative plan');\n+ assert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_HIP})`).length, 1, `Procedure ${PROCEDURE_HIP} is copied from operative plan`);\n+ assert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_FIX_ARM})`).length, 1, `Procedure ${PROCEDURE_FIX_ARM} is copied from operative plan`);\n+ typeAheadFillIn('.operation-assistant', 'Dr Cindy');\n+ click('.panel-footer button:contains(Add)');\n+ waitToAppear('.modal-dialog');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.modal-title').text(), 'Report Saved', 'Report Saved modal displays');\n+ click('button:contains(Ok)');\n+ });\n+ andThen(() =>{\n+ click('button:contains(Return)');\n+ });\n+ andThen(() =>{\n+ assert.equal(currentURL(), '/patients/edit/C87BFCB2-F772-7A7B-8FC7-AD00C018C32A', 'Patient edit URL is correct');\n+ assert.equal(find('a.patient-procedure:contains(fix broken arm)').length, 1, 'Procedure/operative report shows on patient header');\n+ click('a.patient-procedure:contains(fix broken arm)');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.view-current-title').text(), 'Edit Operation Report', 'Operation Report appears for editing');\n+ });\n+ });\n+});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Test for operative plan and operation report |
288,284 | 13.01.2017 16:12:32 | 18,000 | b7c58d4fef7224d33e9c00b6438b53272e03619a | Show preop diagnosis on operation report | [
{
"change_type": "ADD",
"old_path": null,
"new_path": "app/components/patient-diagnosis.js",
"diff": "+import Ember from 'ember';\n+import PatientDiagnosis from 'hospitalrun/mixins/patient-diagnosis';\n+import { translationMacro as t } from 'ember-i18n';\n+import UserSession from 'hospitalrun/mixins/user-session';\n+\n+const {\n+ computed,\n+ get\n+} = Ember;\n+\n+const DIAGNOSIS_KEYS = [\n+ 'diagnosisContainer',\n+ 'hideInActiveDiagnoses',\n+ '[email protected]',\n+ '[email protected]'\n+];\n+\n+export default Ember.Component.extend(PatientDiagnosis, UserSession, {\n+ i18n: Ember.inject.service(),\n+ allowAddDiagnosis: false,\n+ diagnosisContainer: null,\n+ diagnosisProperty: null,\n+ diagnosisList: null,\n+ editDiagnosisAction: 'editDiagnosis',\n+ hideInActiveDiagnoses: true,\n+ showAddDiagnosisAction: 'showAddDiagnosis',\n+ primaryDiagnosisLabel: t('patients.labels.primaryDiagnosis'),\n+ secondaryDiagnosisLabel: t('patients.labels.secondaryDiagnosis'),\n+\n+ canAddDiagnosis: computed('allowAddDiagnosis', {\n+ get() {\n+ let allowAddDiagnosis = get(this, 'allowAddDiagnosis');\n+ return allowAddDiagnosis && this.currentUserCan('add_diagnosis');\n+ }\n+ }),\n+\n+ havePrimaryDiagnoses: computed('primaryDiagnoses.length', {\n+ get() {\n+ let primaryDiagnosesLength = this.get('primaryDiagnoses.length');\n+ return (primaryDiagnosesLength > 0);\n+ }\n+ }),\n+\n+ haveSecondaryDiagnoses: computed('secondaryDiagnoses.length', {\n+ get() {\n+ let secondaryDiagnosesLength = this.get('secondaryDiagnoses.length');\n+ return (secondaryDiagnosesLength > 0);\n+ }\n+ }),\n+\n+ primaryDiagnoses: computed(...DIAGNOSIS_KEYS, {\n+ get() {\n+ let diagnosisContainer = this.get('diagnosisContainer');\n+ let hideInActiveDiagnoses = this.get('hideInActiveDiagnoses');\n+ return this.getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, false);\n+ }\n+ }),\n+\n+ secondaryDiagnoses: computed(...DIAGNOSIS_KEYS, {\n+ get() {\n+ let diagnosisContainer = this.get('diagnosisContainer');\n+ let hideInActiveDiagnoses = this.get('hideInActiveDiagnoses');\n+ return this.getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, true);\n+ }\n+ }),\n+\n+ showPrimaryDiagnoses: computed('canAddDiagnosis', 'havePrimaryDiagnoses', {\n+ get() {\n+ return this.get('canAddDiagnosis') || this.get('havePrimaryDiagnoses');\n+ }\n+ }),\n+\n+ actions: {\n+ editDiagnosis(diagnosis) {\n+ this.sendAction('editDiagnosisAction', diagnosis);\n+ },\n+\n+ showAddDiagnosis() {\n+ this.sendAction('showAddDiagnosisAction');\n+ }\n+ }\n+\n+});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/components/patient-summary.js",
"new_path": "app/components/patient-summary.js",
"diff": "import Ember from 'ember';\n-import PatientDiagnosis from 'hospitalrun/mixins/patient-diagnosis';\nimport UserSession from 'hospitalrun/mixins/user-session';\nconst {\n@@ -9,14 +8,7 @@ const {\nset\n} = Ember;\n-const DIAGNOSIS_KEYS = [\n- 'diagnosisContainer',\n- 'hideInActiveDiagnoses',\n- '[email protected]',\n- '[email protected]'\n-];\n-\n-export default Ember.Component.extend(PatientDiagnosis, UserSession, {\n+export default Ember.Component.extend(UserSession, {\nallowAddAllergy: false,\nallowAddDiagnosis: false,\nallowAddOperativePlan: false,\n@@ -41,13 +33,6 @@ export default Ember.Component.extend(PatientDiagnosis, UserSession, {\n}\n}),\n- canAddDiagnosis: computed('allowAddAllergy', {\n- get() {\n- let allowAddDiagnosis = get(this, 'allowAddDiagnosis');\n- return allowAddDiagnosis && this.currentUserCan('add_diagnosis');\n- }\n- }),\n-\ncanAddOperativePlan: computed('allowAddOperativePlan', {\nget() {\nlet allowAddOperativePlan = get(this, 'allowAddOperativePlan');\n@@ -62,43 +47,16 @@ export default Ember.Component.extend(PatientDiagnosis, UserSession, {\n}\n}),\n- havePrimaryDiagnoses: computed('primaryDiagnoses.length', function() {\n- let primaryDiagnosesLength = this.get('primaryDiagnoses.length');\n- return (primaryDiagnosesLength > 0);\n- }),\n-\nhaveProcedures: computed('patientProcedures.length', function() {\nlet proceduresLength = this.get('patientProcedures.length');\nreturn (proceduresLength > 0);\n}),\n- haveSecondaryDiagnoses: computed('secondaryDiagnoses.length', function() {\n- let secondaryDiagnosesLength = this.get('secondaryDiagnoses.length');\n- return (secondaryDiagnosesLength > 0);\n- }),\n-\n- primaryDiagnoses: computed(...DIAGNOSIS_KEYS, function() {\n- let diagnosisContainer = this.get('diagnosisContainer');\n- let hideInActiveDiagnoses = this.get('hideInActiveDiagnoses');\n- return this.getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, false);\n-\n- }),\n-\n- secondaryDiagnoses: computed(...DIAGNOSIS_KEYS, function() {\n- let diagnosisContainer = this.get('diagnosisContainer');\n- let hideInActiveDiagnoses = this.get('hideInActiveDiagnoses');\n- return this.getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, true);\n- }),\n-\nshouldLinkToPatient: computed('disablePatientLink', function() {\nlet disablePatientLink = this.get('disablePatientLink');\nreturn !disablePatientLink;\n}),\n- showPrimaryDiagnoses: computed('canAddDiagnosis', 'havePrimaryDiagnoses', function() {\n- return this.get('canAddDiagnosis') || this.get('havePrimaryDiagnoses');\n- }),\n-\ndidReceiveAttrs() {\nthis._super(...arguments);\nlet diagnosisContainer = get(this, 'diagnosisContainer');\n@@ -144,6 +102,5 @@ export default Ember.Component.extend(PatientDiagnosis, UserSession, {\nshowAddDiagnosis() {\nthis.sendAction('showAddDiagnosisAction');\n}\n-\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/diagnosis/edit/template.hbs",
"new_path": "app/diagnosis/edit/template.hbs",
"diff": "{{date-picker property=\"date\" label=(t \"diagnosis.labels.date\") class=\"col-sm-4 required\"}}\n</div>\n<div class=\"row\">\n- {{em-checkbox label=(t 'diagnosis.labels.secondaryDiagnosis') property=\"secondaryDiagnosis\" class=\"col-sm-4\"}}\n+ {{em-checkbox label=(t 'diagnosis.labels.secondaryDiagnosis') property=\"secondaryDiagnosis\" class=\"col-sm-4 secondary-diagnosis\"}}\n{{#unless model.isNew}}\n{{em-checkbox label=(t 'diagnosis.labels.activeDiagnosis') property=\"active\" class=\"col-sm-4\"}}\n{{/unless}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/locales/en/translations.js",
"new_path": "app/locales/en/translations.js",
"diff": "@@ -134,6 +134,7 @@ export default {\nincludeOtherOption: 'Include Other Option',\nlabel: 'Label',\nnewForm: 'New Form',\n+ operationReportFormType: 'Operation Report',\noperativePlanFormType: 'Operative Plan',\notherOptionLabel: 'Other Option Label',\npatientFormType: 'Patient',\n@@ -1211,11 +1212,13 @@ export default {\ncaseComplexity: 'Case Complexity',\ncomplications: 'Complications',\noperationDescription: 'Operation Description',\n+ preOpPrimaryDiagnosis: 'Pre-op Primary Diagnosis',\n+ preOpSecondaryDiagnosis: 'Pre-op Secondary Diagnosis',\nsurgeon: 'Surgeon',\nsurgeryDate: 'Surgery Date'\n},\nmessages: {\n- planSaved: 'The operation report has been saved.'\n+ reportSaved: 'The operation report has been saved.'\n},\ntitles: {\neditTitle: 'Edit Operation Report',\n"
},
{
"change_type": "MODIFY",
"old_path": "app/mixins/patient-diagnosis.js",
"new_path": "app/mixins/patient-diagnosis.js",
"diff": "@@ -13,10 +13,10 @@ export default Ember.Mixin.create({\n}\n},\n- getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, secondaryDiagnoses) {\n+ getDiagnoses(diagnosisContainer, hideInActiveDiagnoses, secondaryDiagnoses, diagnosisProperty = 'diagnoses') {\nlet diagnosesList = [];\nif (!isEmpty(diagnosisContainer)) {\n- let diagnoses = diagnosisContainer.get('diagnoses');\n+ let diagnoses = diagnosisContainer.get(diagnosisProperty);\nif (hideInActiveDiagnoses) {\ndiagnoses = diagnoses.filterBy('active', true);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operation-report/controller.js",
"new_path": "app/patients/operation-report/controller.js",
"diff": "import Ember from 'ember';\nimport OperativePlanController from 'hospitalrun/patients/operative-plan/controller';\n-const { computed: { alias } } = Ember;\n+const {\n+ computed: { alias },\n+ get\n+} = Ember;\nexport default OperativePlanController.extend({\nadditionalButtons: null,\n@@ -22,6 +25,13 @@ export default OperativePlanController.extend({\ndiagnosisList: alias('patientController.diagnosisList'),\n+ _finishAfterUpdate() {\n+ let i18n = get(this, 'i18n');\n+ let updateMessage = i18n.t('operationReport.messages.reportSaved');\n+ let updateTitle = i18n.t('operationReport.titles.reportSaved');\n+ this.displayAlert(updateTitle, updateMessage);\n+ },\n+\nactions: {\naddDiagnosis(newDiagnosis) {\nthis.addDiagnosisToModelAndPatient(newDiagnosis);\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operation-report/template.hbs",
"new_path": "app/patients/operation-report/template.hbs",
"diff": "disablePatientLink=true\npatient=model.patient\n}}\n- {{em-text property=\"operationDescription\" label=(t 'operationReport.labels.operationDescription')}}\n+ <div class=\"patient-summary clearfix\">\n+ {{patient-diagnosis\n+ diagnosisContainer=model\n+ diagnosisProperty=\"preOpDiagnoses\"\n+ primaryDiagnosisLabel=(t 'operationReport.labels.preOpPrimaryDiagnosis')\n+ secondaryDiagnosisLabel=(t 'operationReport.labels.preOpSecondaryDiagnosis')\n+ }}\n+ </div>\n+ {{em-text property=\"operationDescription\" label=(t 'operationReport.labels.operationDescription') class=\"operation-description\"}}\n<div class=\"row\">\n- {{date-picker property=\"surgeryDate\" label=(t 'operationReport.labels.surgeryDate') class=\"form-input-group col-sm-4\"}}\n+ {{date-picker property=\"surgeryDate\" label=(t 'operationReport.labels.surgeryDate') class=\"form-input-group col-sm-4 surgery-date\"}}\n{{select-or-typeahead className=\"col-sm-3\" property=\"surgeon\"\nlabel=(t \"operationReport.labels.surgeon\") list=physicianList\nselection=model.surgeon\n+ class=\"operation-surgeon\"\n}}\n{{select-or-typeahead className=\"col-sm-3\" property=\"assistant\"\nlabel=(t \"operationReport.labels.assistant\") list=physicianList\nselection=model.assistant\n+ class=\"operation-assistant\"\n}}\n- {{em-input property=\"caseComplexity\" label=(t 'operationReport.labels.caseComplexity') class=\"col-sm-2\"}}\n+ {{em-input property=\"caseComplexity\" label=(t 'operationReport.labels.caseComplexity') class=\"col-sm-2 case-complexity\"}}\n</div>\n{{operative-procedures model=model procedureList=procedureList}}\n{{em-text property=\"complications\" label=(t 'operationReport.labels.complications')}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operative-plan/controller.js",
"new_path": "app/patients/operative-plan/controller.js",
"diff": "@@ -103,7 +103,7 @@ export default AbstractEditController.extend(OperativePlanStatuses, PatientSubmo\nlet preOpDiagnosis = get(operationReport, 'preOpDiagnoses');\nnewRoute.currentModel.setProperties(propertiesToCopy);\npreOpDiagnosis.addObjects(diagnoses);\n- set(preOpDiagnosis, 'returnToPatient', get(patient, 'id'));\n+ set(newRoute.currentModel, 'returnToPatient', get(patient, 'id'));\nnewRoute.controller.getPatientDiagnoses(patient);\n});\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operative-plan/template.hbs",
"new_path": "app/patients/operative-plan/template.hbs",
"diff": "{{#edit-panel editPanelProps=editPanelProps}}\n{{#em-form model=model submitButton=false }}\n{{patient-summary patient=model.patient disablePatientLink=true diagnosisContainer=model}}\n- {{em-text property=\"operationDescription\" label=(t 'operativePlan.labels.operationDescription')}}\n+ {{em-text property=\"operationDescription\" label=(t 'operativePlan.labels.operationDescription') class=\"operation-description\"}}\n{{operative-procedures model=model procedureList=procedureList}}\n<div class=\"row\">\n- {{date-picker property=\"surgeryDate\" label=(t 'operativePlan.labels.surgeryDate') class=\"form-input-group col-sm-4\"}}\n+ {{date-picker property=\"surgeryDate\" label=(t 'operativePlan.labels.surgeryDate') class=\"form-input-group col-sm-4 surgery-date\"}}\n{{select-or-typeahead className=\"col-sm-4\" property=\"surgeon\"\nlabel=(t \"operativePlan.labels.surgeon\") list=physicianList\nselection=model.surgeon\n+ class=\"plan-surgeon\"\n}}\n{{em-select\nprompt=\" \"\nlabel=(t 'operativePlan.labels.status')\nproperty=\"status\"\ncontent=planStatuses\n- class=\"form-input-group col-sm-2\"\n+ class=\"form-input-group col-sm-2 plan-status\"\n}}\n- {{em-input property=\"caseComplexity\" label=(t 'operativePlan.labels.caseComplexity') class=\"col-sm-2\"}}\n+ {{em-input property=\"caseComplexity\" label=(t 'operativePlan.labels.caseComplexity') class=\"col-sm-2 case-complexity\"}}\n</div>\n- {{em-text property=\"admissionInstructions\" label=(t 'operativePlan.labels.admissionInstructions')}}\n- {{em-text property=\"additionalNotes\" label=(t 'operativePlan.labels.additionalNotes')}}\n+ {{em-text property=\"admissionInstructions\" label=(t 'operativePlan.labels.admissionInstructions') class=\"admission-instructions\"}}\n+ {{em-text property=\"additionalNotes\" label=(t 'operativePlan.labels.additionalNotes') class=\"additional-notes\"}}\n{{custom-form-manager model=model formType=\"operativePlan\"}}\n{{/em-form}}\n{{/edit-panel}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/operative-procedures.hbs",
"new_path": "app/templates/components/operative-procedures.hbs",
"diff": "</div>\n{{#if haveProcedures}}\n<h4>{{t 'components.operativeProcedures.titles.procedures'}}</h4>\n- <table class=\"table\">\n+ <table class=\"table procedure-listing\">\n<tr class=\"table-header\">\n<th>{{t 'components.operativeProcedures.labels.procedure'}}</th>\n<th>{{t 'labels.action'}}</th>\n</tr>\n{{#each model.procedures as |procedure|}}\n<tr>\n- <td>{{procedure.description}}</td>\n+ <td class=\"procedure-description\">{{procedure.description}}</td>\n<td>\n<button type=\"button\" class=\"btn btn-default warning\" {{action \"deleteProcedure\" procedure bubbles=false }}>\n<span class=\"octicon octicon-x\"></span>{{t 'buttons.delete'}}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "app/templates/components/patient-diagnosis.hbs",
"diff": "+ {{#if showPrimaryDiagnoses}}\n+ <div class=\"ps-info-group long-form\">\n+ <label class=\"ps-info-label wide\">{{primaryDiagnosisLabel}}</label>\n+ {{#if canAddDiagnosis}}\n+ <a class=\"clickable\" {{action \"showAddDiagnosis\" bubbles=false }}><span class=\"octicon octicon-plus\"></span> {{t 'visits.buttons.addDiagnosis' }}</a>\n+ {{/if}}\n+ <div class=\"ps-info-data-block\">\n+ {{#each primaryDiagnoses as |diagnosis index|}}\n+ {{#unless (eq index 0)}}, {{/unless}}\n+ {{#if canAddDiagnosis}}\n+ <a class=\"clickable primary-diagnosis\" {{action \"editDiagnosis\" diagnosis bubbles=false}}>\n+ {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n+ </a>\n+ {{else}}\n+ <span class=\"primary-diagnosis\">\n+ {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n+ </span>\n+ {{/if}}\n+ {{/each}}\n+ </div>\n+ </div>\n+ {{/if}}\n+\n+ {{#if haveSecondaryDiagnoses}}\n+ <div class=\"ps-info-group long-form\">\n+ <label class=\"ps-info-label wide\">{{secondaryDiagnosisLabel}}</label>\n+ <div class=\"ps-info-data-block\">\n+ {{#each secondaryDiagnoses as |diagnosis index|}}\n+ {{#unless (eq index 0)}}, {{/unless}}\n+ {{#if canAddDiagnosis}}\n+ <a class=\"clickable secondary-diagnosis\" {{action \"editDiagnosis\" diagnosis bubbles=false}}>\n+ {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n+ </a>\n+ {{else}}\n+ <span class=\"secondary-diagnosis\">\n+ {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n+ </span>\n+ {{/if}}\n+ {{/each}}\n+ </div>\n+ </div>\n+ {{/if}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/patient-summary.hbs",
"new_path": "app/templates/components/patient-summary.hbs",
"diff": "</div>\n{{/if}}\n- {{#if showPrimaryDiagnoses}}\n- <div class=\"ps-info-group long-form\">\n- <label class=\"ps-info-label wide\">{{t 'patients.labels.primaryDiagnosis'}}</label>\n- {{#if canAddDiagnosis}}\n- <a class=\"clickable\" {{action \"showAddDiagnosis\" bubbles=false }}><span class=\"octicon octicon-plus\"></span> {{t 'visits.buttons.addDiagnosis' }}</a>\n- {{/if}}\n- <div class=\"ps-info-data-block\">\n- {{#each primaryDiagnoses as |diagnosis index|}}\n- {{#unless (eq index 0)}}, {{/unless}}\n- {{#if canAddDiagnosis}}\n- <a class=\"clickable primary-diagnosis\" {{action \"editDiagnosis\" diagnosis bubbles=false}}>\n- {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n- </a>\n- {{else}}\n- {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n- {{/if}}\n- {{/each}}\n- </div>\n- </div>\n- {{/if}}\n-\n- {{#if haveSecondaryDiagnoses}}\n- <div class=\"ps-info-group long-form\">\n- <label class=\"ps-info-label wide\">{{t 'patients.labels.secondaryDiagnosis'}}</label>\n- <div class=\"ps-info-data-block\">\n- {{#each secondaryDiagnoses as |diagnosis index|}}\n- {{#unless (eq index 0)}}, {{/unless}}\n- {{#if canAddDiagnosis}}\n- <a class=\"clickable secondary-diagnosis\" {{action \"editDiagnosis\" diagnosis bubbles=false}}>\n- {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n- </a>\n- {{else}}\n- {{diagnosis.diagnosis}} (<strong>{{date-format diagnosis.date}}</strong>)\n- {{/if}}\n- {{/each}}\n- </div>\n- </div>\n- {{/if}}\n+ {{patient-diagnosis\n+ allowAddDiagnosis=allowAddDiagnosis\n+ diagnosisContainer=diagnosisContainer\n+ diagnosisList=diagnosisList\n+ hideInActiveDiagnoses=hideInActiveDiagnoses\n+ }}\n{{#if haveProcedures}}\n<div class=\"ps-info-group long-form\">\n<div class=\"ps-info-data-block\">\n{{#each patientProcedures as |procedure index|}}\n{{#unless (eq index 0)}}, {{/unless}}\n- <a {{action 'editProcedure' procedure}} class=\"clickable\">\n+ <a {{action 'editProcedure' procedure}} class=\"clickable patient-procedure\">\n{{procedure.description}} (<strong>{{date-format procedure.procedureDate}}</strong>)\n</a>\n{{/each}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Show preop diagnosis on operation report |
288,284 | 18.01.2017 09:40:01 | -3,600 | 7d6cba0e5217b49e60d9a2efd83a8a906937d907 | Fixes
Make sure create new patient check box is not checked on new check ins | [
{
"change_type": "MODIFY",
"old_path": "app/visits/edit/controller.js",
"new_path": "app/visits/edit/controller.js",
"diff": "@@ -11,7 +11,8 @@ import VisitTypes from 'hospitalrun/mixins/visit-types';\nconst {\ncomputed,\n- isEmpty\n+ isEmpty,\n+ set\n} = Ember;\nexport default AbstractEditController.extend(AddNewPatient, ChargeActions, DiagnosisActions, PatientSubmodule, PatientNotes, UserSession, VisitTypes, {\n@@ -104,7 +105,6 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn\nallowAddOperativePlan: computed.not('model.isNew'),\nchargePricingCategory: 'Ward',\nchargeRoute: 'visits.charge',\n- createNewPatient: false,\ndiagnosisList: Ember.computed.alias('visitsController.diagnosisList'),\nfindPatientVisits: false,\nhideChargeHeader: true,\n@@ -295,9 +295,9 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn\npatientSelected(patient) {\nif (isEmpty(patient)) {\n- this.set('createNewPatient', true);\n+ set(this, 'model.createNewPatient', true);\n} else {\n- this.set('createNewPatient', false);\n+ set(this, 'model.createNewPatient', false);\nthis.getPatientDiagnoses(patient);\n}\n},\n@@ -392,7 +392,7 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn\n},\nnewPatientChanged(createNewPatient) {\n- this.set('createNewPatient', createNewPatient);\n+ set(this, 'model.createNewPatient', createNewPatient);\nlet model = this.get('model');\nlet patient = model.get('patient');\nif (createNewPatient && !isEmpty(patient)) {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/visits/edit/template.hbs",
"new_path": "app/visits/edit/template.hbs",
"diff": "{{/if}}\n{{#if showPatientSelection}}\n<div class=\"row\">\n- {{#if createNewPatient}}\n+ {{#if model.createNewPatient}}\n{{em-input property=\"patientTypeAhead\" label=(t 'visits.labels.patientToCheckIn')class=\"required patient-name col-sm-9\"}}\n{{else}}\n{{patient-typeahead\n{{/if}}\n<div class=\"checkbox col-sm-3 new-patient-checkbox\">\n<label>\n- <input type=\"checkbox\" checked={{createNewPatient}} onchange={{action \"newPatientChanged\" value=\"target.checked\"}}>\n+ <input type=\"checkbox\" checked={{model.createNewPatient}} onchange={{action \"newPatientChanged\" value=\"target.checked\"}}>\n{{t 'visits.labels.createNewPatient'}}\n</label>\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixes #923
Make sure create new patient check box is not checked on new check ins |
288,284 | 20.01.2017 17:27:39 | -3,600 | 995c67ebb2b25cd0a67b3cc6def97cb6b615c38b | Changed creation of operation report
Addresses issue where operative report gets closed but operation report
does not get created. | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/route.js",
"new_path": "app/appointments/route.js",
"diff": "@@ -24,7 +24,7 @@ export default AbstractModuleRoute.extend(UserSession, {\nvisitProps.returnTo = 'appointments';\nthis.transitionTo('visits.edit', 'checkin').then(function(newRoute) {\nnewRoute.currentModel.setProperties(visitProps);\n- newRoute.controller.getPatientDiagnoses(patient);\n+ newRoute.controller.getPatientDiagnoses(patient, newRoute.currentModel);\n}.bind(this));\n}\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/components/modal-dialog.js",
"new_path": "app/components/modal-dialog.js",
"diff": "@@ -40,6 +40,7 @@ export default Ember.Component.extend({\n$modal.on('hidden.bs.modal', function() {\nthis.sendAction('closeModalAction');\n+ this.sendAction('cancelAction');\n}.bind(this));\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/dialog/controller.js",
"new_path": "app/dialog/controller.js",
"diff": "import Ember from 'ember';\n+\n+const { computed, get, isEmpty } = Ember;\n+\nexport default Ember.Controller.extend({\nshowUpdateButton: true,\nisUpdateDisabled: false,\n+ cancelAction: computed('model.cancelAction', function() {\n+ let cancelAction = get(this, 'model.cancelAction');\n+ if (isEmpty(cancelAction)) {\n+ cancelAction = 'cancel';\n+ }\n+ return cancelAction;\n+ }),\n+\nactions: {\ncancel() {\nthis.send('closeModal');\n@@ -10,14 +21,18 @@ export default Ember.Controller.extend({\nconfirm() {\nlet confirmAction = this.getWithDefault('model.confirmAction', 'model.confirm');\n- this.send(confirmAction, this.get('model'));\n+ this.send(confirmAction, get(this, 'model'));\nthis.send('closeModal');\n},\nok() {\n- let okAction = this.get('model.okAction');\n- if (!Ember.isEmpty(okAction)) {\n- this.send(okAction, this.get('model'));\n+ let okAction = get(this, 'model.okAction');\n+ let okContext = get(this, 'model.okContext');\n+ if (isEmpty(okContext)) {\n+ okContext = get(this, 'model');\n+ }\n+ if (!isEmpty(okAction)) {\n+ this.send(okAction, okContext);\n}\nthis.send('closeModal');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/dialog/template.hbs",
"new_path": "app/dialog/template.hbs",
"diff": "{{#modal-dialog\n+ cancelAction=cancelAction\nhideCancelButton=model.hideCancelButton\nhideUpdateButton=model.hideUpdateButton\nisUpdateDisabled=model.isUpdateDisabled\n"
},
{
"change_type": "MODIFY",
"old_path": "app/locales/en/translations.js",
"new_path": "app/locales/en/translations.js",
"diff": "@@ -1197,11 +1197,13 @@ export default {\nsurgeryDate: 'Surgery Date'\n},\nmessages: {\n- planSaved: 'The operative plan has been saved.'\n+ planSaved: 'The operative plan has been saved.',\n+ planCompleted: 'The operative plan has been completed. You will now be directed to the operation report.'\n},\ntitles: {\neditTitle: 'Edit Operative Plan',\nnewTitle: 'New Operative Plan',\n+ planCompleted: 'Plan Completed',\nplanSaved: 'Plan Saved'\n}\n},\n@@ -1210,7 +1212,6 @@ export default {\nadditionalNotes: 'Additional Notes',\nassistant: 'Assistant',\ncaseComplexity: 'Case Complexity',\n- complications: 'Complications',\noperationDescription: 'Operation Description',\npreOpPrimaryDiagnosis: 'Pre-op Primary Diagnosis',\npreOpSecondaryDiagnosis: 'Pre-op Secondary Diagnosis',\n"
},
{
"change_type": "MODIFY",
"old_path": "app/mixins/modal-helper.js",
"new_path": "app/mixins/modal-helper.js",
"diff": "@@ -4,17 +4,22 @@ export default Ember.Mixin.create({\n* Display a message in a closable modal.\n* @param title string containing the title to display.\n* @param message string containing the message to display.\n+ * @param okAction string containing the optional action to fire when the ok button is clicked.\n+ * @param okContext object containing the context to pass to the okAction.\n+ * @param cancelAction string containing the optional action to fire when the cancel button is clicked or the escape button is pressed.\n*/\n- displayAlert(title, message, okAction) {\n+ displayAlert(title, message, okAction, okContext, cancelAction) {\nlet i18n = this.get('i18n');\nlet modalOptions = Ember.Object.extend({\nupdateButtonText: i18n.t('buttons.ok')\n});\nthis.send('openModal', 'dialog', modalOptions.create({\n- title,\n+ cancelAction,\n+ hideCancelButton: true,\nmessage,\nokAction,\n- hideCancelButton: true,\n+ okContext,\n+ title,\nupdateButtonAction: 'ok'\n}));\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/mixins/patient-submodule.js",
"new_path": "app/mixins/patient-submodule.js",
"diff": "@@ -3,7 +3,7 @@ import Ember from 'ember';\nimport PatientVisits from 'hospitalrun/mixins/patient-visits';\nimport SelectValues from 'hospitalrun/utils/select-values';\n-const { isEmpty } = Ember;\n+const { get, isEmpty } = Ember;\nexport default Ember.Mixin.create(PatientVisits, {\nfindPatientVisits: true, // Override to false if visits shouldn't be set when patient is selected.\n@@ -147,11 +147,11 @@ export default Ember.Mixin.create(PatientVisits, {\n});\n},\n- getPatientDiagnoses(patient) {\n+ getPatientDiagnoses(patient, model) {\nlet diagnoses = patient.get('diagnoses');\n- let visitDiagnoses;\n+ let activeDiagnoses;\nif (!isEmpty(diagnoses)) {\n- visitDiagnoses = diagnoses.filterBy('active', true).map((diagnosis) => {\n+ activeDiagnoses = diagnoses.filterBy('active', true).map((diagnosis) => {\nlet description = diagnosis.get('diagnosis');\nlet newDiagnosisProperties = diagnosis.getProperties('active', 'date', 'diagnosis', 'secondaryDiagnosis');\nnewDiagnosisProperties.diagnosis = description;\n@@ -160,10 +160,10 @@ export default Ember.Mixin.create(PatientVisits, {\n);\n});\n}\n- let currentDiagnoses = this.get('model.diagnoses');\n+ let currentDiagnoses = get(model, 'diagnoses');\ncurrentDiagnoses.clear();\n- if (!isEmpty(visitDiagnoses)) {\n- currentDiagnoses.addObjects(visitDiagnoses);\n+ if (!isEmpty(activeDiagnoses)) {\n+ currentDiagnoses.addObjects(activeDiagnoses);\n}\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/models/operation-report.js",
"new_path": "app/models/operation-report.js",
"diff": "@@ -15,7 +15,6 @@ export default AbstractModel.extend({\n// Attributes\nadditionalNotes: DS.attr('string'),\ncaseComplexity: DS.attr('number'),\n- complications: DS.attr('string'),\ncustomForms: DS.attr('custom-forms'),\nprocedures: DS.attr('operative-procedures', { defaultValue: defaultProcedures }),\noperationDescription: DS.attr('string'),\n@@ -25,6 +24,7 @@ export default AbstractModel.extend({\n// Associations\npreOpDiagnoses: DS.hasMany('diagnosis'),\ndiagnoses: DS.hasMany('diagnosis'), // Post op diagnosis\n+ operativePlan: DS.belongsTo('operative-plan', { async: true }),\npatient: DS.belongsTo('patient', { async: false }),\nvalidations: {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/edit/controller.js",
"new_path": "app/patients/edit/controller.js",
"diff": "@@ -329,7 +329,7 @@ export default AbstractEditController.extend(BloodTypes, DiagnosisActions, Retur\nlet model = operativePlan;\nif (isEmpty(model)) {\nthis._addChildObject('patients.operative-plan', (route) =>{\n- route.controller.getPatientDiagnoses(this.get('model'));\n+ route.controller.getPatientDiagnoses(this.get('model'), route.currentModel);\n});\n} else {\nmodel.set('returnToVisit');\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operation-report/template.hbs",
"new_path": "app/patients/operation-report/template.hbs",
"diff": "disablePatientLink=true\npatient=model.patient\n}}\n- <div class=\"patient-summary clearfix\">\n+ <div class=\"patient-summary\">\n{{patient-diagnosis\ndiagnosisContainer=model\ndiagnosisProperty=\"preOpDiagnoses\"\n{{em-input property=\"caseComplexity\" label=(t 'operationReport.labels.caseComplexity') class=\"col-sm-2 case-complexity\"}}\n</div>\n{{operative-procedures model=model procedureList=procedureList}}\n- {{em-text property=\"complications\" label=(t 'operationReport.labels.complications')}}\n{{em-text property=\"additionalNotes\" label=(t 'operationReport.labels.additionalNotes')}}\n{{custom-form-manager model=model formType=\"operationReport\"}}\n{{/em-form}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operative-plan/controller.js",
"new_path": "app/patients/operative-plan/controller.js",
"diff": "@@ -94,17 +94,23 @@ export default AbstractEditController.extend(OperativePlanStatuses, PatientSubmo\n},\n_createOperationReport() {\n- this.transitionToRoute('patients.operation-report', 'new').then((newRoute) => {\n+ let store = get(this, 'store');\nlet operativePlan = get(this, 'model');\n- let operationReport = newRoute.currentModel;\nlet propertiesToCopy = operativePlan.getProperties(...PLAN_KEYS_TO_COPY);\nlet diagnoses = get(operativePlan, 'diagnoses');\nlet patient = get(operativePlan, 'patient');\n- let preOpDiagnosis = get(operationReport, 'preOpDiagnoses');\n- newRoute.currentModel.setProperties(propertiesToCopy);\n- preOpDiagnosis.addObjects(diagnoses);\n- set(newRoute.currentModel, 'returnToPatient', get(patient, 'id'));\n- newRoute.controller.getPatientDiagnoses(patient);\n+ set(propertiesToCopy, 'operativePlan', operativePlan);\n+ set(propertiesToCopy, 'preOpDiagnosis', diagnoses);\n+ set(propertiesToCopy, 'returnToPatient', get(patient, 'id'));\n+ let operationReport = store.createRecord('operation-report', propertiesToCopy);\n+ this.getPatientDiagnoses(patient, operationReport);\n+ operationReport.save().then((newReport) => {\n+ patient.save().then(()=> {\n+ let i18n = get(this, 'i18n');\n+ let updateMessage = i18n.t('operativePlan.messages.planCompleted');\n+ let updateTitle = i18n.t('operativePlan.titles.planCompleted');\n+ this.displayAlert(updateTitle, updateMessage, 'showOperationReport', newReport, 'ok');\n+ });\n});\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operative-plan/route.js",
"new_path": "app/patients/operative-plan/route.js",
"diff": "@@ -14,5 +14,11 @@ export default AbstractEditRoute.extend({\ncustomForms: Ember.Object.create()\n};\nreturn customForms.setDefaultCustomForms(['operativePlan'], newData);\n+ },\n+\n+ actions: {\n+ showOperationReport(report) {\n+ this.transitionTo('patients.operation-report', report);\n+ }\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/route.js",
"new_path": "app/patients/route.js",
"diff": "@@ -61,7 +61,7 @@ export default AbstractModuleRoute.extend(PatientId, {\n}\nnewRoute.currentModel.set('patient', patient);\nnewRoute.currentModel.set('hidePatientSelection', true);\n- newRoute.controller.getPatientDiagnoses(patient);\n+ newRoute.controller.getPatientDiagnoses(patient, newRoute.currentModel);\n});\n}\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "app/visits/edit/controller.js",
"new_path": "app/visits/edit/controller.js",
"diff": "@@ -11,6 +11,7 @@ import VisitTypes from 'hospitalrun/mixins/visit-types';\nconst {\ncomputed,\n+ get,\nisEmpty,\nset\n} = Ember;\n@@ -298,7 +299,7 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn\nset(this, 'model.createNewPatient', true);\n} else {\nset(this, 'model.createNewPatient', false);\n- this.getPatientDiagnoses(patient);\n+ this.getPatientDiagnoses(patient, get(this, 'model'));\n}\n},\n@@ -383,7 +384,7 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn\nlet model = operativePlan;\nif (isEmpty(model)) {\nthis._addChildObject('patients.operative-plan', (route) =>{\n- route.controller.getPatientDiagnoses(this.get('model.patient'));\n+ route.controller.getPatientDiagnoses(this.get('model.patient'), route.currentModel);\n});\n} else {\nmodel.set('returnToVisit', this.get('model.id'));\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/operative-test.js",
"new_path": "tests/acceptance/operative-test.js",
"diff": "@@ -54,6 +54,7 @@ test('Plan and report creation', function(assert) {\nandThen(() =>{\nassert.equal(find('a.secondary-diagnosis:contains(Tennis Elbow)').length, 1, 'New secondary diagnosis appears');\nclick('a:contains(Add Operative Plan)');\n+ waitToAppear('span.secondary-diagnosis:contains(Tennis Elbow)');\n});\nandThen(() =>{\nassert.equal(currentURL(), '/patients/operative-plan/new', 'New operative plan URL is correct');\n@@ -92,7 +93,7 @@ test('Plan and report creation', function(assert) {\n});\nandThen(() =>{\nassert.equal(find('.modal-title').text(), 'Plan Saved', 'Plan saved modal displays');\n- click('button:contains(Ok)');\n+ click('.modal-footer button:contains(Ok)');\n});\nandThen(() =>{\nassert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_FIX_ARM})`).length, 1, 'Procedure from typeahead gets added to procedure list on save');\n@@ -107,10 +108,14 @@ test('Plan and report creation', function(assert) {\nassert.equal(find('.view-current-title').text(), 'Edit Operative Plan', 'Edit operative plan title is correct');\nassert.equal(find('button:contains(Complete Plan)').length, 1, 'Complete Plan button appears');\nclick('button:contains(Complete Plan)');\n+ waitToAppear('.modal-dialog');\n+ });\n+ andThen(() =>{\n+ assert.equal(find('.modal-title').text(), 'Plan Completed', 'Plan completed modal displays');\n+ click('.modal-footer button:contains(Ok)');\n});\nandThen(() =>{\n- assert.equal(currentURL(), '/patients/operation-report/new', 'Operation report url is correct');\n- assert.equal(find('.view-current-title').text(), 'New Operation Report', 'New Operation Report title is correct');\n+ assert.equal(find('.view-current-title').text(), 'Edit Operation Report', 'Edit Operation Report title is correct');\nassert.equal(find('.patient-name .ps-info-data').text(), 'Joe Bagadonuts', 'Joe Bagadonuts patient header displays');\nassert.equal(find('a.primary-diagnosis:contains(Broken Arm)').length, 1, 'Primary diagnosis appears as editable');\nassert.equal(find('a.secondary-diagnosis:contains(Tennis Elbow)').length, 1, 'Secondary diagnosis appears as editable');\n@@ -121,12 +126,12 @@ test('Plan and report creation', function(assert) {\nassert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_HIP})`).length, 1, `Procedure ${PROCEDURE_HIP} is copied from operative plan`);\nassert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_FIX_ARM})`).length, 1, `Procedure ${PROCEDURE_FIX_ARM} is copied from operative plan`);\ntypeAheadFillIn('.operation-assistant', 'Dr Cindy');\n- click('.panel-footer button:contains(Add)');\n+ click('.panel-footer button:contains(Update)');\nwaitToAppear('.modal-dialog');\n});\nandThen(() =>{\nassert.equal(find('.modal-title').text(), 'Report Saved', 'Report Saved modal displays');\n- click('button:contains(Ok)');\n+ click('.modal-footer button:contains(Ok)');\n});\nandThen(() =>{\nclick('button:contains(Return)');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Changed creation of operation report
Addresses issue where operative report gets closed but operation report
does not get created. |
288,284 | 20.01.2017 17:28:03 | -3,600 | c9cab8ced2591695dfcc5fe26ceb2840e8598b13 | Fixed layout of add form button | [
{
"change_type": "MODIFY",
"old_path": "app/templates/components/custom-form-manager.hbs",
"new_path": "app/templates/components/custom-form-manager.hbs",
"diff": "{{custom-form model=model form=customForm.form propertyPrefix=customForm.propertyPrefix}}\n{{/each}}\n{{#if showAddButton}}\n+ <div class=\"row\">\n+ <div class=\"col-sm-2\">\n+ <label class=\"control-label\"> </label>\n+ <p class=\" form-control-static\">\n<button class=\"btn btn-primary\" {{action 'addForm' bubbles=false }}>\n<span class=\"octicon octicon-plus\"></span>\n{{t 'components.customFormManager.buttons.addForm'}}\n</button>\n+ </p>\n+ </div>\n+ </div>\n{{/if}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed layout of add form button |
288,284 | 25.01.2017 15:15:12 | 18,000 | afa1b4513ec12587608affbaed13077e72ecc017 | Fixed double fetch of model | [
{
"change_type": "MODIFY",
"old_path": "app/components/calendar-control.js",
"new_path": "app/components/calendar-control.js",
"diff": "import Ember from 'ember';\nimport moment from 'moment';\n+const { isEmpty } = Ember;\n+\nexport default Ember.Component.extend({\n+ defaultView: 'agendaWeek',\nvisibleDateIntervalStart: null,\nvisibleDateIntervalEnd: null,\n@@ -33,7 +36,9 @@ export default Ember.Component.extend({\nviewType: view.name\n};\n- if (configurationsDiffer(currentConfiguration, newConfiguration)) {\n+ if (isEmpty(currentConfiguration.dateIntervalStart) && isEmpty(currentConfiguration.dateIntervalEnd)) {\n+ this.set('visualConfiguration', newConfiguration);\n+ } else if (configurationsDiffer(currentConfiguration, newConfiguration)) {\nthis.set('visualConfiguration', newConfiguration);\nthis.get('onVisualConfigurationChanged')(newConfiguration);\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed double fetch of model |
288,284 | 25.01.2017 15:16:53 | 18,000 | 5a2e400d4ca929c88c73007f426e0b49bea9dcc7 | Added default view and height | [
{
"change_type": "MODIFY",
"old_path": "app/components/calendar-control.js",
"new_path": "app/components/calendar-control.js",
"diff": "@@ -4,7 +4,13 @@ import moment from 'moment';\nconst { isEmpty } = Ember;\nexport default Ember.Component.extend({\n+ calendarHeader: {\n+ left: 'title',\n+ center: 'agendaDay,agendaWeek,month',\n+ right: 'today prev,next'\n+ },\ndefaultView: 'agendaWeek',\n+ height: 500,\nvisibleDateIntervalStart: null,\nvisibleDateIntervalEnd: null,\n@@ -14,12 +20,6 @@ export default Ember.Component.extend({\nviewType: null\n},\n- calendarHeader: {\n- left: 'title',\n- center: 'agendaDay,agendaWeek,month',\n- right: 'today prev,next'\n- },\n-\nactions: {\nhandleRenderingComplete(view) {\nfunction configurationsDiffer(firstConfig, secondConfig) {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/calendar-control.hbs",
"new_path": "app/templates/components/calendar-control.hbs",
"diff": "header=calendarHeader\neventClick=onEventClick\neventAfterAllRender=(action \"handleRenderingComplete\")\n+ viewName=defaultView\n+ height=height\n}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Added default view and height |
288,284 | 25.01.2017 16:36:13 | 18,000 | 43fbdaab99f5d766538f67538d13766de4a7b3b1 | Fixed allDay and provider display | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/route.js",
"new_path": "app/appointments/calendar/route.js",
"diff": "import AppointmentIndexRoute from 'hospitalrun/appointments/index/route';\n+import Ember from 'ember';\nimport moment from 'moment';\nimport { translationMacro as t } from 'ember-i18n';\n+const { isEmpty } = Ember;\n+\nexport default AppointmentIndexRoute.extend({\neditReturn: 'appointments.calendar',\nmodelName: 'appointment',\n@@ -46,8 +49,14 @@ export default AppointmentIndexRoute.extend({\nmodel(params) {\nfunction createCalendarEvent(appointment) {\n+ let title = appointment.get('patient').get('displayName');\n+ let provider = appointment.get('provider');\n+ if (!isEmpty(provider)) {\n+ title = `${title}\\n${provider}`;\n+ }\nreturn {\n- title: `${appointment.get('patient').get('displayName')}\\n${appointment.get('provider')}`,\n+ allDay: appointment.get('allDay'),\n+ title,\nstart: appointment.get('startDate'),\nend: appointment.get('endDate'),\nreferencedAppointment: appointment\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed allDay and provider display |
288,284 | 25.01.2017 16:37:41 | 18,000 | a95047dec16662a5c0ddd5774ad8fbbbea97988d | Allow editing/creation of events from calendar | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/controller.js",
"new_path": "app/appointments/calendar/controller.js",
"diff": "@@ -4,6 +4,10 @@ import VisitTypes from 'hospitalrun/mixins/visit-types';\nimport SelectValues from 'hospitalrun/utils/select-values';\nimport Ember from 'ember';\n+const {\n+ set\n+} = Ember;\n+\nexport default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes, {\nappointmentsController: Ember.inject.controller('appointments'),\nstartKey: [],\n@@ -41,6 +45,16 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes\n},\nactions: {\n+ createNewAppointment(dateClicked) {\n+ let newAppointment = this.store.createRecord('appointment', {\n+ appointmentType: 'Admission',\n+ allDay: false,\n+ selectPatient: true,\n+ startDate: dateClicked.local().toDate()\n+ });\n+ this.send('editAppointment', newAppointment);\n+ },\n+\nnavigateToAppointment(calendarEvent) {\nthis.send('editAppointment', calendarEvent.referencedAppointment);\n},\n@@ -70,6 +84,15 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes\nthis.set('model.selectedProvider', null);\nthis.set('model.selectedLocation', null);\nthis.send('filter');\n+ },\n+\n+ updateAppointment(calendarEvent) {\n+ let appointmentToUpdate = calendarEvent.referencedAppointment;\n+ let newEnd = calendarEvent.end.local().toDate();\n+ let newStart = calendarEvent.start.local().toDate();\n+ set(appointmentToUpdate, 'startDate', newStart);\n+ set(appointmentToUpdate, 'endDate', newEnd);\n+ this.send('editAppointment', appointmentToUpdate);\n}\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/template.hbs",
"new_path": "app/appointments/calendar/template.hbs",
"diff": "</div>\n<div class=\"panel-body\">\n{{calendar-control events=model.events\n+ onDayClick=(action \"createNewAppointment\")\nonEventClick=(action \"navigateToAppointment\")\n+ onEventDrop=(action \"updateAppointment\")\n+ onEventResize=(action \"updateAppointment\")\nonVisualConfigurationChanged=(action \"handleVisualConfigurationChanged\")\n+ userCanEdit=canEdit\n}}\n</div>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "app/components/calendar-control.js",
"new_path": "app/components/calendar-control.js",
"diff": "@@ -9,8 +9,14 @@ export default Ember.Component.extend({\ncenter: 'agendaDay,agendaWeek,month',\nright: 'today prev,next'\n},\n+\ndefaultView: 'agendaWeek',\nheight: 500,\n+ onDayClick: null,\n+ onEventClick: null,\n+ onEventDrop: null,\n+ onEventResize: null,\n+ userCanEdit: false,\nvisibleDateIntervalStart: null,\nvisibleDateIntervalEnd: null,\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/calendar-control.hbs",
"new_path": "app/templates/components/calendar-control.hbs",
"diff": "{{full-calendar events=events\n- header=calendarHeader\n- eventClick=onEventClick\n+ dayClick=onDayClick\n+ editable=userCanEdit\neventAfterAllRender=(action \"handleRenderingComplete\")\n- viewName=defaultView\n+ eventClick=onEventClick\n+ eventDrop=onEventDrop\n+ eventResize=onEventResize\n+ header=calendarHeader\nheight=height\n+ viewName=defaultView\n}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Allow editing/creation of events from calendar |
288,284 | 25.01.2017 17:22:28 | 18,000 | 61d0446a2fcedfe79fd6e05abb66166a3c80ffbd | Updated to comply with styleguide | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/controller.js",
"new_path": "app/appointments/calendar/controller.js",
"diff": "@@ -5,46 +5,61 @@ import SelectValues from 'hospitalrun/utils/select-values';\nimport Ember from 'ember';\nconst {\n+ computed,\n+ computed: {\n+ alias\n+ },\n+ get,\n+ inject,\n+ isEmpty,\nset\n} = Ember;\nexport default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes, {\n- appointmentsController: Ember.inject.controller('appointments'),\n- startKey: [],\n-\n- queryParams: ['appointmentType', 'provider', 'status', 'location'],\nappointmentType: null,\n+ location: null,\nprovider: null,\n+ queryParams: ['appointmentType', 'provider', 'status', 'location'],\n+ startKey: [],\nstatus: null,\n- location: null,\n- physicians: Ember.computed.alias('appointmentsController.physicianList.value'),\n- physicianList: function() {\n- return SelectValues.selectValues(this.get('physicians'), true);\n- }.property('physicians'),\n+ appointmentsController: inject.controller('appointments'),\n+ locations: alias('appointmentsController.locationList.value'),\n+ physicians: alias('appointmentsController.physicianList.value'),\n- locations: Ember.computed.alias('appointmentsController.locationList.value'),\n- locationList: function() {\n- return SelectValues.selectValues(this.get('locations'), true);\n- }.property('locations'),\n+ locationList: computed('locations', function() {\n+ return SelectValues.selectValues(get(this, 'locations'), true);\n+ }),\n- getSelectedFilteringCriteria() {\n+ physicianList: computed('physicians', function() {\n+ return SelectValues.selectValues(get(this, 'physicians'), true);\n+ }),\n+\n+ _getSelectedFilteringCriteria() {\nlet rawCriteria = {\n- status: this.get('model.selectedStatus'),\n- type: this.get('model.selectedAppointmentType'),\n- provider: this.get('model.selectedProvider'),\n- location: this.get('model.selectedLocation')\n+ status: get(this, 'model.selectedStatus'),\n+ type: get(this, 'model.selectedAppointmentType'),\n+ provider: get(this, 'model.selectedProvider'),\n+ location: get(this, 'model.selectedLocation')\n};\nreturn {\n- status: Ember.isEmpty(rawCriteria.status) ? null : rawCriteria.status,\n- type: Ember.isEmpty(rawCriteria.type) ? null : rawCriteria.type,\n- provider: Ember.isEmpty(rawCriteria.provider) ? null : rawCriteria.provider,\n- location: Ember.isEmpty(rawCriteria.location) ? null : rawCriteria.location\n+ status: isEmpty(rawCriteria.status) ? null : rawCriteria.status,\n+ type: isEmpty(rawCriteria.type) ? null : rawCriteria.type,\n+ provider: isEmpty(rawCriteria.provider) ? null : rawCriteria.provider,\n+ location: isEmpty(rawCriteria.location) ? null : rawCriteria.location\n};\n},\nactions: {\n+ clearFilteringCriteria() {\n+ set(this, 'model.selectedStatus', null);\n+ set(this, 'model.selectedAppointmentType', null);\n+ set(this, 'model.selectedProvider', null);\n+ set(this, 'model.selectedLocation', null);\n+ this.send('filter');\n+ },\n+\ncreateNewAppointment(dateClicked) {\nlet newAppointment = this.store.createRecord('appointment', {\nappointmentType: 'Admission',\n@@ -55,17 +70,8 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes\nthis.send('editAppointment', newAppointment);\n},\n- navigateToAppointment(calendarEvent) {\n- this.send('editAppointment', calendarEvent.referencedAppointment);\n- },\n-\n- handleVisualConfigurationChanged(newConfiguration) {\n- let { dateIntervalStart, dateIntervalEnd } = newConfiguration;\n- this.send('updateDateInterval', dateIntervalStart, dateIntervalEnd);\n- },\n-\nfilter() {\n- let criteria = this.getSelectedFilteringCriteria();\n+ let criteria = this._getSelectedFilteringCriteria();\nthis.setProperties({\nstartKey: [],\npreviousStartKey: null,\n@@ -78,12 +84,13 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes\n});\n},\n- clearFilteringCriteria() {\n- this.set('model.selectedStatus', null);\n- this.set('model.selectedAppointmentType', null);\n- this.set('model.selectedProvider', null);\n- this.set('model.selectedLocation', null);\n- this.send('filter');\n+ handleVisualConfigurationChanged(newConfiguration) {\n+ let { dateIntervalStart, dateIntervalEnd } = newConfiguration;\n+ this.send('updateDateInterval', dateIntervalStart, dateIntervalEnd);\n+ },\n+\n+ navigateToAppointment(calendarEvent) {\n+ this.send('editAppointment', calendarEvent.referencedAppointment);\n},\nupdateAppointment(calendarEvent) {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/route.js",
"new_path": "app/appointments/calendar/route.js",
"diff": "@@ -3,15 +3,21 @@ import Ember from 'ember';\nimport moment from 'moment';\nimport { translationMacro as t } from 'ember-i18n';\n-const { isEmpty } = Ember;\n+const {\n+ get,\n+ isEmpty,\n+ set\n+} = Ember;\nexport default AppointmentIndexRoute.extend({\n+\n+ dateIntervalEnd: null,\n+ dateIntervalStart: null,\neditReturn: 'appointments.calendar',\n+ filterParams: ['appointmentType', 'provider', 'status', 'location'],\nmodelName: 'appointment',\npageTitle: t('appointments.calendarTitle'),\n- filterParams: ['appointmentType', 'provider', 'status', 'location'],\n-\nqueryParams: {\nappointmentType: { refreshModel: true },\nprovider: { refreshModel: true },\n@@ -19,46 +25,18 @@ export default AppointmentIndexRoute.extend({\nlocation: { refreshModel: true }\n},\n- dateIntervalStart: null,\n- dateIntervalEnd: null,\n-\n- _modelQueryParams(params) {\n- let dateIntervalStart = this.get('dateIntervalStart');\n- let dateIntervalEnd = this.get('dateIntervalEnd');\n-\n- if (dateIntervalStart === null || dateIntervalEnd === null) {\n- return this._super(params);\n- }\n-\n- let maxValue = this.get('maxValue');\n-\n- // To cater for times like 0:00 - investigate.\n- let adjustedStart = moment(dateIntervalStart).subtract(1, 'days').startOf('day').toDate().getTime();\n- let adjustedEnd = moment(dateIntervalEnd).add(1, 'days').endOf('day').toDate().getTime();\n-\n- let searchOptions = {\n- startkey: [adjustedStart, null, 'appointment_'],\n- endkey: [adjustedEnd, maxValue, `appointment_${maxValue}`]\n- };\n-\n- return {\n- options: searchOptions,\n- mapReduce: 'appointments_by_date'\n- };\n- },\n-\nmodel(params) {\nfunction createCalendarEvent(appointment) {\n- let title = appointment.get('patient').get('displayName');\n- let provider = appointment.get('provider');\n+ let title = get(appointment, 'patient.displayName');\n+ let provider = get(appointment, 'provider');\nif (!isEmpty(provider)) {\ntitle = `${title}\\n${provider}`;\n}\nreturn {\n- allDay: appointment.get('allDay'),\n+ allDay: get(appointment, 'allDay'),\ntitle,\n- start: appointment.get('startDate'),\n- end: appointment.get('endDate'),\n+ start: get(appointment, 'startDate'),\n+ end: get(appointment, 'endDate'),\nreferencedAppointment: appointment\n};\n}\n@@ -72,7 +50,6 @@ export default AppointmentIndexRoute.extend({\n.then(function(calendarEvents) {\nreturn {\nevents: calendarEvents,\n-\nselectedAppointmentType: params.appointmentType,\nselectedProvider: params.provider,\nselectedStatus: params.status,\n@@ -81,10 +58,35 @@ export default AppointmentIndexRoute.extend({\n});\n},\n+ _modelQueryParams(params) {\n+ let dateIntervalStart = get(this, 'dateIntervalStart');\n+ let dateIntervalEnd = get(this, 'dateIntervalEnd');\n+\n+ if (dateIntervalStart === null || dateIntervalEnd === null) {\n+ return this._super(params);\n+ }\n+\n+ let maxValue = get(this, 'maxValue');\n+\n+ // To cater for times like 0:00 - investigate.\n+ let adjustedStart = moment(dateIntervalStart).subtract(1, 'days').startOf('day').toDate().getTime();\n+ let adjustedEnd = moment(dateIntervalEnd).add(1, 'days').endOf('day').toDate().getTime();\n+\n+ let searchOptions = {\n+ startkey: [adjustedStart, null, this._getMinPouchId()],\n+ endkey: [adjustedEnd, maxValue, this._getMaxPouchId()]\n+ };\n+\n+ return {\n+ options: searchOptions,\n+ mapReduce: 'appointments_by_date'\n+ };\n+ },\n+\nactions: {\nupdateDateInterval(start, end) {\n- this.set('dateIntervalStart', start);\n- this.set('dateIntervalEnd', end);\n+ set(this, 'dateIntervalStart', start);\n+ set(this, 'dateIntervalEnd', end);\nthis.refresh();\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/components/calendar-control.js",
"new_path": "app/components/calendar-control.js",
"diff": "import Ember from 'ember';\nimport moment from 'moment';\n-const { isEmpty } = Ember;\n+const {\n+ get,\n+ isEmpty,\n+ set\n+} = Ember;\nexport default Ember.Component.extend({\ncalendarHeader: {\n- left: 'title',\ncenter: 'agendaDay,agendaWeek,month',\n+ left: 'title',\nright: 'today prev,next'\n},\n@@ -17,15 +21,16 @@ export default Ember.Component.extend({\nonEventDrop: null,\nonEventResize: null,\nuserCanEdit: false,\n- visibleDateIntervalStart: null,\n- visibleDateIntervalEnd: null,\nvisualConfiguration: {\n- dateIntervalStart: null,\ndateIntervalEnd: null,\n+ dateIntervalStart: null,\nviewType: null\n},\n+ visibleDateIntervalEnd: null,\n+ visibleDateIntervalStart: null,\n+\nactions: {\nhandleRenderingComplete(view) {\nfunction configurationsDiffer(firstConfig, secondConfig) {\n@@ -34,7 +39,7 @@ export default Ember.Component.extend({\n|| firstConfig.viewType !== secondConfig.viewType;\n}\n- let currentConfiguration = this.get('visualConfiguration');\n+ let currentConfiguration = get(this, 'visualConfiguration');\nlet newConfiguration = {\ndateIntervalStart: moment(view.intervalStart).startOf('day').toDate().getTime(),\n@@ -43,10 +48,10 @@ export default Ember.Component.extend({\n};\nif (isEmpty(currentConfiguration.dateIntervalStart) && isEmpty(currentConfiguration.dateIntervalEnd)) {\n- this.set('visualConfiguration', newConfiguration);\n+ set(this, 'visualConfiguration', newConfiguration);\n} else if (configurationsDiffer(currentConfiguration, newConfiguration)) {\n- this.set('visualConfiguration', newConfiguration);\n- this.get('onVisualConfigurationChanged')(newConfiguration);\n+ set(this, 'visualConfiguration', newConfiguration);\n+ get(this, 'onVisualConfigurationChanged')(newConfiguration);\n}\n}\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Updated to comply with styleguide |
288,284 | 26.01.2017 14:07:05 | 18,000 | 8ae66000f9f24fa554cd2aa3afe3659611d53539 | New styles for appointment calendars | [
{
"change_type": "MODIFY",
"old_path": "app/styles/app.scss",
"new_path": "app/styles/app.scss",
"diff": "// Components\n@import 'components/alert';\n@import 'components/buttons';\n+@import 'components/calendar';\n@import 'components/dropdown';\n@import 'components/form_styles';\n@import 'components/imaging';\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "app/styles/components/_calendar.scss",
"diff": "+.fc-toolbar {\n+ &.fc-header-toolbar {\n+ h2 {\n+ margin-top: .35em;\n+ font-size: 18px;\n+ }\n+\n+ margin-bottom: 0;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/templates/components/calendar-control.hbs",
"new_path": "app/templates/components/calendar-control.hbs",
"diff": "{{full-calendar events=events\ndayClick=onDayClick\n+ date=defaultDate\neditable=userCanEdit\neventAfterAllRender=(action \"handleRenderingComplete\")\neventClick=onEventClick\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | New styles for appointment calendars |
288,284 | 26.01.2017 14:07:28 | 18,000 | b0f9966808541ab6bb45082bf94c274e4817ea8e | Match calendar filters layout | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/search/template.hbs",
"new_path": "app/appointments/search/template.hbs",
"diff": "{{#em-form model=model submitButton=false }}\n<div class=\"row\">\n{{date-picker property=\"selectedStartingDate\" label=(t \"appointments.labels.selectedStartingDate\")class=\"col-sm-3\"}}\n- {{em-select class=\"col-sm-3\" property=\"selectedStatus\"\n+ {{em-select class=\"col-sm-3 form-input-group\" property=\"selectedStatus\"\nlabel=(t \"labels.status\") content=appointmentStatusesWithEmpty\n}}\n- </div>\n- <div class=\"row\">\n- {{em-select class=\"col-sm-3\" label=(t \"labels.type\")\n+ {{em-select class=\"col-sm-3 form-input-group\" label=(t \"labels.type\")\nproperty=\"selectedAppointmentType\" content=visitTypesWithEmpty\n}}\n- {{em-select class=\"col-sm-3\" property=\"selectedProvider\"\n+ {{em-select class=\"col-sm-3 form-input-group\" property=\"selectedProvider\"\nlabel=(t 'labels.with') content=physicianList\n}}\n</div>\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Match calendar filters layout |
288,284 | 26.01.2017 14:08:58 | 18,000 | c2d5dd0f0dc05241e8625c8c3edacd5ab73f1bab | Make sure calendar options work on return
Also fixed start date and end date on data retrieval of appointments | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/controller.js",
"new_path": "app/appointments/calendar/controller.js",
"diff": "import AppointmentIndexController from 'hospitalrun/appointments/index/controller';\nimport AppointmentStatuses from 'hospitalrun/mixins/appointment-statuses';\n+import moment from 'moment';\nimport VisitTypes from 'hospitalrun/mixins/visit-types';\nimport SelectValues from 'hospitalrun/utils/select-values';\nimport Ember from 'ember';\n@@ -17,16 +18,25 @@ const {\nexport default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes, {\nappointmentType: null,\n+ endDate: null,\nlocation: null,\nprovider: null,\n- queryParams: ['appointmentType', 'provider', 'status', 'location'],\n- startKey: [],\n+ queryParams: ['appointmentType', 'endDate', 'provider', 'status', 'startDate', 'location', 'viewType'],\n+ startDate: null,\nstatus: null,\n+ viewType: 'agendaWeek',\nappointmentsController: inject.controller('appointments'),\nlocations: alias('appointmentsController.locationList.value'),\nphysicians: alias('appointmentsController.physicianList.value'),\n+ calendarDate: computed('startDate', function() {\n+ let startDate = get(this, 'startDate');\n+ if (!isEmpty(startDate)) {\n+ return moment(parseInt(startDate));\n+ }\n+ }),\n+\nlocationList: computed('locations', function() {\nreturn SelectValues.selectValues(get(this, 'locations'), true);\n}),\n@@ -73,10 +83,6 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes\nfilter() {\nlet criteria = this._getSelectedFilteringCriteria();\nthis.setProperties({\n- startKey: [],\n- previousStartKey: null,\n- previousStartKeys: [],\n-\nappointmentType: criteria.type,\nprovider: criteria.provider,\nstatus: criteria.status,\n@@ -85,8 +91,7 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes\n},\nhandleVisualConfigurationChanged(newConfiguration) {\n- let { dateIntervalStart, dateIntervalEnd } = newConfiguration;\n- this.send('updateDateInterval', dateIntervalStart, dateIntervalEnd);\n+ this.setProperties(newConfiguration);\n},\nnavigateToAppointment(calendarEvent) {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/route.js",
"new_path": "app/appointments/calendar/route.js",
"diff": "import AppointmentIndexRoute from 'hospitalrun/appointments/index/route';\nimport Ember from 'ember';\n-import moment from 'moment';\nimport { translationMacro as t } from 'ember-i18n';\nconst {\nget,\n- isEmpty,\n- set\n+ isEmpty\n} = Ember;\nexport default AppointmentIndexRoute.extend({\n@@ -20,9 +18,12 @@ export default AppointmentIndexRoute.extend({\nqueryParams: {\nappointmentType: { refreshModel: true },\n+ endDate: { refreshModel: true },\nprovider: { refreshModel: true },\nstatus: { refreshModel: true },\n- location: { refreshModel: true }\n+ startDate: { refreshModel: true },\n+ location: { refreshModel: true },\n+ viewType: { refreshModel: false }\n},\nmodel(params) {\n@@ -59,35 +60,20 @@ export default AppointmentIndexRoute.extend({\n},\n_modelQueryParams(params) {\n- let dateIntervalStart = get(this, 'dateIntervalStart');\n- let dateIntervalEnd = get(this, 'dateIntervalEnd');\n+ let { endDate, startDate } = params;\n- if (dateIntervalStart === null || dateIntervalEnd === null) {\n+ if (endDate === null || startDate === null) {\nreturn this._super(params);\n}\n-\nlet maxValue = get(this, 'maxValue');\n-\n- // To cater for times like 0:00 - investigate.\n- let adjustedStart = moment(dateIntervalStart).subtract(1, 'days').startOf('day').toDate().getTime();\n- let adjustedEnd = moment(dateIntervalEnd).add(1, 'days').endOf('day').toDate().getTime();\n-\nlet searchOptions = {\n- startkey: [adjustedStart, null, this._getMinPouchId()],\n- endkey: [adjustedEnd, maxValue, this._getMaxPouchId()]\n+ startkey: [parseInt(startDate), null, this._getMinPouchId()],\n+ endkey: [parseInt(endDate), maxValue, this._getMaxPouchId()]\n};\nreturn {\noptions: searchOptions,\nmapReduce: 'appointments_by_date'\n};\n- },\n-\n- actions: {\n- updateDateInterval(start, end) {\n- set(this, 'dateIntervalStart', start);\n- set(this, 'dateIntervalEnd', end);\n- this.refresh();\n- }\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/template.hbs",
"new_path": "app/appointments/calendar/template.hbs",
"diff": "<div class=\"panel-body\">\n{{#em-form model=model submitButton=false}}\n<div class=\"row\">\n- {{em-select class=\"col-sm-3\"\n+ {{em-select class=\"col-sm-3 form-input-group\"\nlabel=(t \"labels.status\")\nproperty=\"selectedStatus\"\ncontent=appointmentStatusesWithEmpty\n}}\n- {{em-select class=\"col-sm-3\"\n+ {{em-select class=\"col-sm-3 form-input-group\"\nlabel=(t \"labels.type\")\nproperty=\"selectedAppointmentType\"\ncontent=visitTypesWithEmpty\n}}\n- {{em-select class=\"col-sm-3\"\n+ {{em-select class=\"col-sm-3 form-input-group\"\nlabel=(t 'labels.with')\nproperty=\"selectedProvider\"\ncontent=physicianList\n}}\n- {{em-select class=\"col-sm-3\"\n+ {{em-select class=\"col-sm-3 form-input-group\"\nlabel=(t 'labels.location')\nproperty=\"selectedLocation\"\ncontent=locationList\n}}\n</div>\n{{/em-form}}\n- </div>\n<div class=\"panel-footer\">\n<button class=\"btn btn-default warning\" {{action 'clearFilteringCriteria'}}>{{t 'buttons.clear'}}</button>\n<button class=\"btn btn-default\" {{action 'filter'}}>{{t 'buttons.filter'}}</button>\n</div>\n- <div class=\"panel-body\">\n{{calendar-control events=model.events\n+ defaultDate=calendarDate\n+ defaultView=viewType\nonDayClick=(action \"createNewAppointment\")\nonEventClick=(action \"navigateToAppointment\")\nonEventDrop=(action \"updateAppointment\")\n"
},
{
"change_type": "MODIFY",
"old_path": "app/components/calendar-control.js",
"new_path": "app/components/calendar-control.js",
"diff": "@@ -13,7 +13,7 @@ export default Ember.Component.extend({\nleft: 'title',\nright: 'today prev,next'\n},\n-\n+ defaultDate: null,\ndefaultView: 'agendaWeek',\nheight: 500,\nonDayClick: null,\n@@ -23,31 +23,43 @@ export default Ember.Component.extend({\nuserCanEdit: false,\nvisualConfiguration: {\n- dateIntervalEnd: null,\n- dateIntervalStart: null,\n+ endDate: null,\n+ startDate: null,\nviewType: null\n},\n- visibleDateIntervalEnd: null,\n- visibleDateIntervalStart: null,\n+ /**\n+ * FullCalendar gives the start and end timestamps based on UTC (eg start at\n+ * midnight UTC and end at 11:59PM UTC), but for our purposes we want to show\n+ * users events that start at midnight their timezone and end at 11:59PM in\n+ * their timezone. This function takes a UTC timestamps from fullcalendar\n+ * and returns the timestamp in the users timezone (eg midnight UTC is returned\n+ * as midnight EST for EST users).\n+ * @param timestamp A number representing the milliseconds elapsed between\n+ * 1 January 1970 00:00:00 UTC and the given date.\n+ * @return String timestamp in users timezone.\n+ */\n+ _convertDateFromUTCToLocal(date) {\n+ return moment(date.utc().format('YYYY-MM-DD HH:mm:ss')).valueOf();\n+ },\nactions: {\nhandleRenderingComplete(view) {\nfunction configurationsDiffer(firstConfig, secondConfig) {\n- return firstConfig.dateIntervalStart !== secondConfig.dateIntervalStart\n- || firstConfig.dateIntervalEnd !== secondConfig.dateIntervalEnd\n+ return firstConfig.startDate !== secondConfig.startDate\n+ || firstConfig.endDate !== secondConfig.endDate\n|| firstConfig.viewType !== secondConfig.viewType;\n}\nlet currentConfiguration = get(this, 'visualConfiguration');\nlet newConfiguration = {\n- dateIntervalStart: moment(view.intervalStart).startOf('day').toDate().getTime(),\n- dateIntervalEnd: moment(view.intervalEnd).endOf('day').toDate().getTime(),\n+ startDate: this._convertDateFromUTCToLocal(view.intervalStart),\n+ endDate: this._convertDateFromUTCToLocal(view.intervalEnd),\nviewType: view.name\n};\n- if (isEmpty(currentConfiguration.dateIntervalStart) && isEmpty(currentConfiguration.dateIntervalEnd)) {\n+ if (isEmpty(currentConfiguration.startDate) && isEmpty(currentConfiguration.endDate)) {\nset(this, 'visualConfiguration', newConfiguration);\n} else if (configurationsDiffer(currentConfiguration, newConfiguration)) {\nset(this, 'visualConfiguration', newConfiguration);\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Make sure calendar options work on return
Also fixed start date and end date on data retrieval of appointments |
288,376 | 28.01.2017 15:01:53 | 18,000 | b16ee176cdc63cf01d529d26c055f7596b8dca03 | Removing Workflow from the Administration submenu for 1.0
Closes Partially to test something else. Partially b/c
asked for it. | [
{
"change_type": "MODIFY",
"old_path": "app/mixins/navigation.js",
"new_path": "app/mixins/navigation.js",
"diff": "@@ -291,12 +291,6 @@ export default Ember.Mixin.create({\niconClass: 'octicon-chevron-right',\nroute: 'admin.roles',\ncapability: 'define_user_roles'\n- },\n- {\n- title: 'Workflow',\n- iconClass: 'octicon-chevron-right',\n- route: 'admin.workflow',\n- capability: 'update_config'\n}\n]\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Removing Workflow from the Administration submenu for 1.0
Closes #925. Partially to test something else. Partially b/c @mnorbeck
asked for it. |
288,284 | 30.01.2017 13:23:17 | 18,000 | e053172373617ffefc37846c2056a3d44d0279e3 | Show dialog when user session has expired. | [
{
"change_type": "MODIFY",
"old_path": "app/adapters/application.js",
"new_path": "app/adapters/application.js",
"diff": "import Ember from 'ember';\nimport { Adapter } from 'ember-pouch';\n+import UnauthorizedError from 'hospitalrun/utils/unauthorized-error';\nimport PouchAdapterUtils from 'hospitalrun/mixins/pouch-adapter-utils';\nimport uuid from 'npm:uuid';\n@@ -203,7 +204,7 @@ export default Adapter.extend(PouchAdapterUtils, {\n};\ndb.list(`${mapReduce}/sort/${mapReduce}`, listParams, (err, response) => {\nif (err) {\n- this._pouchError(reject)(err);\n+ reject(this._handleErrorResponse(err));\n} else {\nlet responseJSON = JSON.parse(response.body);\nthis._handleQueryResponse(responseJSON, store, type).then(resolve, reject);\n@@ -212,7 +213,7 @@ export default Adapter.extend(PouchAdapterUtils, {\n} else {\ndb.query(mapReduce, queryParams, (err, response) => {\nif (err) {\n- this._pouchError(reject)(err);\n+ reject(this._handleErrorResponse(err));\n} else {\nthis._handleQueryResponse(response, store, type).then(resolve, reject);\n}\n@@ -221,16 +222,50 @@ export default Adapter.extend(PouchAdapterUtils, {\n} else {\ndb.allDocs(queryParams, (err, response) => {\nif (err) {\n- this._pouchError(reject)(err);\n+ reject(this._handleErrorResponse(err));\n} else {\nthis._handleQueryResponse(response, store, type).then(resolve, reject);\n}\n});\n}\n} catch(err) {\n- this._pouchError(reject)(err);\n+ reject(this._handleErrorResponse(err));\n}\n}, 'findQuery in application-pouchdb-adapter');\n}\n+ },\n+\n+ createRecord(store, type, record) {\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ this._super(store, type, record).then(resolve, (err) => {\n+ reject(this._handleErrorResponse(err));\n+ });\n+ });\n+ },\n+\n+ updateRecord(store, type, record) {\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ this._super(store, type, record).then(resolve, (err) => {\n+ reject(this._handleErrorResponse(err));\n+ });\n+ });\n+ },\n+\n+ deleteRecord(store, type, record) {\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ this._super(store, type, record).then(resolve, (err) => {\n+ reject(this._handleErrorResponse(err));\n+ });\n+ });\n+ },\n+\n+ _handleErrorResponse(err) {\n+ if (err.status) {\n+ let detailedMessage = JSON.stringify(err, null, 2);\n+ return new UnauthorizedError(err, detailedMessage);\n+ } else {\n+ return err;\n}\n+ }\n+\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/controllers/abstract-edit-controller.js",
"new_path": "app/controllers/abstract-edit-controller.js",
"diff": "@@ -3,6 +3,9 @@ import EditPanelProps from 'hospitalrun/mixins/edit-panel-props';\nimport IsUpdateDisabled from 'hospitalrun/mixins/is-update-disabled';\nimport ModalHelper from 'hospitalrun/mixins/modal-helper';\nimport UserSession from 'hospitalrun/mixins/user-session';\n+\n+const { get } = Ember;\n+\nexport default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHelper, UserSession, {\ncancelAction: 'allItems',\n@@ -158,12 +161,14 @@ export default Ember.Controller.extend(EditPanelProps, IsUpdateDisabled, ModalHe\n* to skip the afterUpdate call.\n*/\nsaveModel(skipAfterUpdate) {\n- this.get('model').save().then(function(record) {\n+ get(this, 'model').save().then((record) => {\nthis.updateLookupLists();\nif (!skipAfterUpdate) {\nthis.afterUpdate(record);\n}\n- }.bind(this));\n+ }).catch((error) => {\n+ this.send('error', error);\n+ });\n},\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "app/locales/en/translations.js",
"new_path": "app/locales/en/translations.js",
"diff": "@@ -1230,5 +1230,13 @@ export default {\nnewTitle: 'New Operation Report',\nreportSaved: 'Report Saved'\n}\n+ },\n+ application: {\n+ messages: {\n+ sessionExpired: 'Your session has expired. Please login to continue.'\n+ },\n+ titles: {\n+ sessionExpired: 'Session Expired'\n+ }\n}\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "app/routes/application.js",
"new_path": "app/routes/application.js",
"diff": "import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';\nimport Ember from 'ember';\n+import ModalHelper from 'hospitalrun/mixins/modal-helper';\nimport SetupUserRole from 'hospitalrun/mixins/setup-user-role';\n+import UnauthorizedError from 'hospitalrun/utils/unauthorized-error';\n-const { inject, Route } = Ember;\n+const { get, inject, isEmpty, Route, set } = Ember;\n-let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, {\n+const TRANSITION_AFTER_LOGIN = 'transitionAfterLogin';\n+\n+let ApplicationRoute = Route.extend(ApplicationRouteMixin, ModalHelper, SetupUserRole, {\ndatabase: inject.service(),\nconfig: inject.service(),\nsession: inject.service(),\n@@ -17,6 +21,34 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, {\noutlet: 'modal'\n});\n},\n+\n+ error(reason, transition) {\n+ if (reason instanceof UnauthorizedError) {\n+ let i18n = this.get('i18n');\n+ let message = i18n.t('application.messages.sessionExpired');\n+ let session = get(this, 'session');\n+ let title = i18n.t('application.titles.sessionExpired');\n+ if (!isEmpty(transition)) {\n+ let sessionStore = session.get('store');\n+ let sessionData = session.get('data');\n+ let transitionName;\n+ if (transition.targetName) {\n+ transitionName = transition.targetName;\n+ } else {\n+ transitionName = transition;\n+ }\n+ set(sessionData, TRANSITION_AFTER_LOGIN, transitionName);\n+ sessionStore.persist(sessionData).then(() =>{\n+ this.displayAlert(title, message, 'unauthorizeSession');\n+ });\n+ } else {\n+ this.displayAlert(title, message, 'unauthorizeSession');\n+ }\n+ } else {\n+ this._super(reason);\n+ }\n+ },\n+\n/**\n* Render a modal using the specifed path and optionally set a model.\n* @param modalPath the path to use for the controller and template.\n@@ -24,42 +56,49 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, {\n*/\nopenModal(modalPath, model) {\nif (model) {\n- this.controllerFor(modalPath).set('model', model);\n+ set(this.controllerFor(modalPath), 'model', model);\n}\nthis.renderModal(modalPath);\n},\n+ unauthorizeSession() {\n+ let session = get(this, 'session');\n+ if (get(session, 'isAuthenticated')) {\n+ session.invalidate();\n+ }\n+ },\n+\n/**\n* Update an open modal using the specifed model.\n* @param modalPath the path to use for the controller and template.\n* @param model (optional) the model to set on the controller for the modal.\n*/\nupdateModal(modalPath, model) {\n- this.controllerFor(modalPath).set('model', model);\n+ set(this.controllerFor(modalPath), 'model', model);\n}\n},\nmodel(params, transition) {\n- let session = this.get('session');\n- let isAuthenticated = session && session.get('isAuthenticated');\n- return this.get('config').setup().then(function(configs) {\n+ let session = get(this, 'session');\n+ let isAuthenticated = session && get(session, 'isAuthenticated');\n+ return get(this, 'config').setup().then(function(configs) {\nif (transition.targetName !== 'finishgauth' && transition.targetName !== 'login') {\n- this.set('shouldSetupUserRole', true);\n+ set(this, 'shouldSetupUserRole', true);\nif (isAuthenticated) {\n- return this.get('database').setup(configs)\n+ return get(this, 'database').setup(configs)\n.catch(() => {\n// Error thrown indicates missing auth, so invalidate session.\nsession.invalidate();\n});\n}\n} else if (transition.targetName === 'finishgauth') {\n- this.set('shouldSetupUserRole', false);\n+ set(this, 'shouldSetupUserRole', false);\n}\n}.bind(this));\n},\nafterModel() {\n- this.controllerFor('navigation').set('allowSearch', false);\n+ set(this.controllerFor('navigation'), 'allowSearch', false);\n$('#apploading').remove();\n},\n@@ -71,11 +110,21 @@ let ApplicationRoute = Route.extend(ApplicationRouteMixin, SetupUserRole, {\n},\nsessionAuthenticated() {\n- if (this.get('shouldSetupUserRole') === true) {\n+ if (get(this, 'shouldSetupUserRole') === true) {\nthis.setupUserRole();\n}\n+ let session = get(this, 'session');\n+ let sessionData = session.get('data');\n+ let transitionAfterLogin = get(sessionData, TRANSITION_AFTER_LOGIN);\n+ if (!isEmpty(transitionAfterLogin)) {\n+ let sessionStore = session.get('store');\n+ set(sessionData, 'transitionAfterLogin', null);\n+ sessionStore.persist(sessionData).then(() =>{\n+ this.transitionTo(transitionAfterLogin);\n+ });\n+ } else {\nthis._super();\n}\n-\n+ }\n});\nexport default ApplicationRoute;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "app/utils/unauthorized-error.js",
"diff": "+import DS from 'ember-data';\n+\n+const { AdapterError } = DS;\n+\n+let UnauthorizedError = function(errors, message = 'The adapter operation is unauthorized') {\n+ AdapterError.call(this, errors, message);\n+};\n+\n+UnauthorizedError.prototype = Object.create(AdapterError.prototype);\n+\n+export default UnauthorizedError;\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Show dialog when user session has expired. |
288,284 | 30.01.2017 13:24:03 | 18,000 | 4f86031714a39b83c2ae1c1277581e28ae9ff3e7 | Automatically save appointment
Save appointment automatically when dragged or resized on calendar view. | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/controller.js",
"new_path": "app/appointments/calendar/controller.js",
"diff": "@@ -104,7 +104,9 @@ export default AppointmentIndexController.extend(AppointmentStatuses, VisitTypes\nlet newStart = calendarEvent.start.local().toDate();\nset(appointmentToUpdate, 'startDate', newStart);\nset(appointmentToUpdate, 'endDate', newEnd);\n- this.send('editAppointment', appointmentToUpdate);\n+ appointmentToUpdate.save().catch((error) => {\n+ this.send('error', error, 'appointments.calendar');\n+ });\n}\n}\n});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Automatically save appointment
Save appointment automatically when dragged or resized on calendar view. |
288,284 | 30.01.2017 16:09:02 | 18,000 | 535907402fcada5828da4e0a9af80bdfec94a6b9 | Added appointment test for calendar | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/edit/template.hbs",
"new_path": "app/appointments/edit/template.hbs",
"diff": "{{else}}\n{{date-time-picker datePickerClass=\"required test-appointment-date\" label=(t 'labels.date') model=model}}\n{{/if}}\n- {{em-checkbox label=(t 'labels.allDay') property=\"allDay\" class=\"col-sm-2\"}}\n+ {{em-checkbox label=(t 'labels.allDay') property=\"allDay\" class=\"col-sm-2 appointment-all-day\"}}\n</div>\n<div class=\"row\">\n<div class=\"form-input-group col-sm-6 required test-appointment-type\">\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/appointments-test.js",
"new_path": "tests/acceptance/appointments-test.js",
"diff": "@@ -3,6 +3,9 @@ import { module, test } from 'qunit';\nimport moment from 'moment';\nimport startApp from 'hospitalrun/tests/helpers/start-app';\n+const DATE_TIME_FORMAT = 'l h:mm A';\n+const TIME_FORMAT = 'h:mm';\n+\nmodule('Acceptance | appointments', {\nbeforeEach() {\nthis.application = startApp();\n@@ -33,7 +36,7 @@ test('visiting /appointments/missed', function(assert) {\nlet today = moment();\nlet tomorrow = moment().add(1, 'days');\nlet status = 'Missed';\n- createAppointment(today, tomorrow, status);\n+ createAppointment(today, tomorrow, false, status);\nvisit(url);\nandThen(function() {\nassert.equal(currentURL(), url);\n@@ -136,20 +139,51 @@ test('Delete an appointment', function(assert) {\n});\n});\n-function createAppointment(startDate = (new Date()), endDate = (moment().add(1, 'day').toDate()), status = 'Scheduled') {\n+test('Appointment calendar', function(assert) {\n+ runWithPouchDump('appointments', function() {\n+ authenticateUser();\n+ let later = moment().add(1, 'hours');\n+ let today = moment();\n+ let startTime = today.format(TIME_FORMAT);\n+ let endTime = later.format(TIME_FORMAT);\n+ let timeString = `${startTime} - ${endTime}`;\n+ createAppointment(today, later, false);\n+\n+ andThen(function() {\n+ visit('/appointments/calendar');\n+ });\n+\n+ andThen(function() {\n+ assert.equal(currentURL(), '/appointments/calendar');\n+ assert.equal(find('.view-current-title').text(), 'Appointments Calendar', 'Appoinment Calendar displays');\n+ assert.equal(find('.fc-content .fc-time').text(), timeString, 'Time appears in calendar');\n+ assert.equal(find('.fc-title').text(), 'Lennex ZinyandoDr Test', 'Appoinment displays in calendar');\n+ click('.fc-title');\n+ });\n+\n+ andThen(() => {\n+ assert.equal(find('.view-current-title').text(), 'Edit Appointment', 'Edit Appointment displays');\n+ assert.equal(find('.test-appointment-start input').val(), today.format(DATE_TIME_FORMAT), 'Start date/time are correct');\n+ assert.equal(find('.test-appointment-end input').val(), later.format(DATE_TIME_FORMAT), 'End date/time are correct');\n+ });\n+ });\n+});\n+\n+function createAppointment(startDate = (new Date()), endDate = (moment().add(1, 'day').toDate()), allDay = true, status = 'Scheduled') {\nvisit('/appointments/edit/new');\ntypeAheadFillIn('.test-patient-input', 'Lennex Zinyando - P00017');\nselect('.test-appointment-type', 'Admission');\nselect('.test-appointment-status', status);\n- waitToAppear('.test-appointment-start input');\n- andThen(function() {\n+ if (!allDay) {\n+ click('.appointment-all-day input');\n+ fillIn('.test-appointment-start input', startDate.format(DATE_TIME_FORMAT));\n+ fillIn('.test-appointment-end input', endDate.format(DATE_TIME_FORMAT));\n+ } else {\nselectDate('.test-appointment-start input', startDate);\n- });\n- andThen(function() {\nselectDate('.test-appointment-end input', endDate);\n- });\n+ }\ntypeAheadFillIn('.test-appointment-location', 'Harare');\n- fillIn('.test-appointment-with', 'Dr Test');\n+ typeAheadFillIn('.test-appointment-with', 'Dr Test');\nclick('button:contains(Add)');\nwaitToAppear('.table-header');\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Added appointment test for calendar |
288,284 | 03.02.2017 14:36:18 | 18,000 | df679bc6602e437a93505eed19315f71b567ce11 | Make sure admin works with user timeout
Fixes | [
{
"change_type": "MODIFY",
"old_path": "app/adapters/application.js",
"new_path": "app/adapters/application.js",
"diff": "import Ember from 'ember';\nimport { Adapter } from 'ember-pouch';\n-import UnauthorizedError from 'hospitalrun/utils/unauthorized-error';\n-import PouchAdapterUtils from 'hospitalrun/mixins/pouch-adapter-utils';\nimport uuid from 'npm:uuid';\nconst {\n+ get,\nrun: {\nbind\n}\n} = Ember;\n-export default Adapter.extend(PouchAdapterUtils, {\n+export default Adapter.extend({\ndatabase: Ember.inject.service(),\ndb: Ember.computed.reads('database.mainDB'),\n@@ -193,6 +192,7 @@ export default Adapter.extend(PouchAdapterUtils, {\n} else if (query.containsValue) {\nreturn this._executeContainsSearch(store, type, query);\n}\n+ let database = get(this, 'database');\nreturn new Ember.RSVP.Promise((resolve, reject) => {\nlet db = this.get('db');\ntry {\n@@ -204,7 +204,7 @@ export default Adapter.extend(PouchAdapterUtils, {\n};\ndb.list(`${mapReduce}/sort/${mapReduce}`, listParams, (err, response) => {\nif (err) {\n- reject(this._handleErrorResponse(err));\n+ reject(database.handleErrorResponse(err));\n} else {\nlet responseJSON = JSON.parse(response.body);\nthis._handleQueryResponse(responseJSON, store, type).then(resolve, reject);\n@@ -213,7 +213,7 @@ export default Adapter.extend(PouchAdapterUtils, {\n} else {\ndb.query(mapReduce, queryParams, (err, response) => {\nif (err) {\n- reject(this._handleErrorResponse(err));\n+ reject(database.handleErrorResponse(err));\n} else {\nthis._handleQueryResponse(response, store, type).then(resolve, reject);\n}\n@@ -222,50 +222,54 @@ export default Adapter.extend(PouchAdapterUtils, {\n} else {\ndb.allDocs(queryParams, (err, response) => {\nif (err) {\n- reject(this._handleErrorResponse(err));\n+ reject(database.handleErrorResponse(err));\n} else {\nthis._handleQueryResponse(response, store, type).then(resolve, reject);\n}\n});\n}\n} catch(err) {\n- reject(this._handleErrorResponse(err));\n+ reject(database.handleErrorResponse(err));\n}\n}, 'findQuery in application-pouchdb-adapter');\n}\n},\ncreateRecord(store, type, record) {\n- return new Ember.RSVP.Promise((resolve, reject) => {\n- this._super(store, type, record).then(resolve, (err) => {\n- reject(this._handleErrorResponse(err));\n- });\n- });\n+ return this._checkForErrors(this._super(store, type, record));\n+ },\n+\n+ findAll(store, type) {\n+ return this._checkForErrors(this._super(store, type));\n+ },\n+\n+ findMany(store, type, ids) {\n+ return this._checkForErrors(this._super(store, type, ids));\n+ },\n+\n+ findHasMany(store, record, link, rel) {\n+ return this._checkForErrors(this._super(store, record, link, rel));\n+ },\n+\n+ findRecord(store, type, id) {\n+ return this._checkForErrors(this._super(store, type, id));\n},\nupdateRecord(store, type, record) {\n- return new Ember.RSVP.Promise((resolve, reject) => {\n- this._super(store, type, record).then(resolve, (err) => {\n- reject(this._handleErrorResponse(err));\n- });\n- });\n+ return this._checkForErrors(this._super(store, type, record));\n},\ndeleteRecord(store, type, record) {\n+ return this._checkForErrors(this._super(store, type, record));\n+ },\n+\n+ _checkForErrors(callPromise) {\nreturn new Ember.RSVP.Promise((resolve, reject) => {\n- this._super(store, type, record).then(resolve, (err) => {\n- reject(this._handleErrorResponse(err));\n+ callPromise.then(resolve, (err) => {\n+ let database = get(this, 'database');\n+ reject(database.handleErrorResponse(err));\n});\n});\n- },\n-\n- _handleErrorResponse(err) {\n- if (err.status) {\n- let detailedMessage = JSON.stringify(err, null, 2);\n- return new UnauthorizedError(err, detailedMessage);\n- } else {\n- return err;\n- }\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/adapters/user.js",
"new_path": "app/adapters/user.js",
"diff": "import Ember from 'ember';\nimport DS from 'ember-data';\nimport UserSession from 'hospitalrun/mixins/user-session';\n+\n+const { get } = Ember;\n+\nexport default DS.RESTAdapter.extend(UserSession, {\ndatabase: Ember.inject.service(),\nsession: Ember.inject.service(),\n@@ -82,7 +85,12 @@ export default DS.RESTAdapter.extend(UserSession, {\n*/\nfind(store, type, id) {\nlet findUrl = this.endpoint + id;\n- return this.ajax(findUrl, 'GET');\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ this.ajax(findUrl, 'GET').then(resolve, (error) => {\n+ let database = get(this, 'database');\n+ reject(database.handleErrorResponse(error));\n+ });\n+ });\n},\nheaders: function() {\n@@ -126,8 +134,13 @@ export default DS.RESTAdapter.extend(UserSession, {\n}\ndata = this._cleanPasswordAttrs(data);\nlet putURL = `${this.endpoint}${Ember.get(record, 'id')}`;\n- return this.ajax(putURL, 'PUT', {\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ this.ajax(putURL, 'PUT', {\ndata\n+ }).then(resolve, (error) => {\n+ let database = get(this, 'database');\n+ reject(database.handleErrorResponse(error));\n+ });\n});\n},\n@@ -153,7 +166,12 @@ export default DS.RESTAdapter.extend(UserSession, {\n}\n};\nlet allURL = `${this.endpoint}_all_docs`;\n- return this.ajax(allURL, 'GET', ajaxData);\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ this.ajax(allURL, 'GET', ajaxData).then(resolve, (error) => {\n+ let database = get(this, 'database');\n+ reject(database.handleErrorResponse(error));\n+ });\n+ });\n},\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "app/admin/address/route.js",
"new_path": "app/admin/address/route.js",
"diff": "import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\nimport Ember from 'ember';\nimport { translationMacro as t } from 'ember-i18n';\n+import UnauthorizedError from 'hospitalrun/utils/unauthorized-error';\n+\nexport default AbstractEditRoute.extend({\nhideNewButton: true,\nnewTitle: t('admin.address.newTitle'),\neditTitle: t('admin.address.editTitle'),\nmodel() {\n- return new Ember.RSVP.Promise(function(resolve) {\n- this.get('store').find('option', 'address_options').then(function(addressOptions) {\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ this.get('store').find('option', 'address_options').then((addressOptions) => {\nresolve(addressOptions);\n- }, function() {\n+ }, (err) => {\n+ if (err instanceof UnauthorizedError) {\n+ reject(err);\n+ } else {\nlet store = this.get('store');\nlet newConfig = store.push(store.normalize('option', {\nid: 'address_options',\n@@ -19,7 +24,8 @@ export default AbstractEditRoute.extend({\n}\n}));\nresolve(newConfig);\n- }.bind(this));\n- }.bind(this));\n+ }\n+ });\n+ });\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/admin/loaddb/route.js",
"new_path": "app/admin/loaddb/route.js",
"diff": "@@ -2,18 +2,24 @@ import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\nimport Ember from 'ember';\nimport { translationMacro as t } from 'ember-i18n';\nimport UserSession from 'hospitalrun/mixins/user-session';\n+\n+const { get, inject } = Ember;\n+\nexport default AbstractEditRoute.extend(UserSession, {\nhideNewButton: true,\neditTitle: t('admin.loaddb.editTitle'),\n+ database: inject.service(),\n+\nbeforeModel() {\nif (!this.currentUserCan('load_db')) {\nthis.transitionTo('application');\n}\n},\n- // No model needed for import.\n+ // Make sure database is available for import\nmodel() {\n- return Ember.RSVP.resolve(Ember.Object.create({}));\n+ let database = get(this, 'database');\n+ return database.getDBInfo().catch((err) => this.send('error', database.handleErrorResponse(err)));\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/admin/lookup/route.js",
"new_path": "app/admin/lookup/route.js",
"diff": "@@ -4,7 +4,7 @@ export default AbstractIndexRoute.extend({\nhideNewButton: true,\npageTitle: t('admin.lookup.pageTitle'),\nmodel() {\n- return this.store.findAll('lookup');\n+ return this.store.findAll('lookup').catch((error) => this.send('error', error));\n},\nafterModel(model) {\n"
},
{
"change_type": "DELETE",
"old_path": "app/mixins/pouch-adapter-utils.js",
"new_path": null,
"diff": "-import Ember from 'ember';\n-export default Ember.Mixin.create({\n- session: Ember.inject.service(),\n- _pouchError(reject) {\n- return function(err) {\n- if (err.status === 401) {\n- // User is unauthorized; reload to force login.\n- let session = this.get('session');\n- if (!Ember.isEmpty(session) && session.get('isAuthenticated')) {\n- session.invalidate();\n- }\n- }\n- let errmsg = [err.status,\n- `${(err.name || err.error)}:`,\n- (err.message || err.reason)\n- ].join(' ');\n- Ember.run(null, reject, errmsg);\n- }.bind(this);\n- }\n-});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/services/database.js",
"new_path": "app/services/database.js",
"diff": "@@ -2,13 +2,13 @@ import Ember from 'ember';\nimport createPouchViews from 'hospitalrun/utils/pouch-views';\nimport List from 'npm:pouchdb-list';\nimport PouchAdapterMemory from 'npm:pouchdb-adapter-memory';\n-import PouchAdapterUtils from 'hospitalrun/mixins/pouch-adapter-utils';\n+import UnauthorizedError from 'hospitalrun/utils/unauthorized-error';\nconst {\nisEmpty\n} = Ember;\n-export default Ember.Service.extend(PouchAdapterUtils, {\n+export default Ember.Service.extend({\nconfig: Ember.inject.service(),\nmainDB: null, // Server DB\noauthHeaders: null,\n@@ -68,7 +68,7 @@ export default Ember.Service.extend(PouchAdapterUtils, {\nif (mapReduce) {\nmainDB.query(mapReduce, queryParams, (err, response) => {\nif (err) {\n- this._pouchError(reject)(err);\n+ reject(this.handleErrorResponse(err));\n} else {\nresponse.rows = this._mapPouchData(response.rows);\nresolve(response);\n@@ -77,7 +77,7 @@ export default Ember.Service.extend(PouchAdapterUtils, {\n} else {\nmainDB.allDocs(queryParams, (err, response) => {\nif (err) {\n- this._pouchError(reject)(err);\n+ reject(this.handleErrorResponse(err));\n} else {\nresponse.rows = this._mapPouchData(response.rows);\nresolve(response);\n@@ -104,7 +104,7 @@ export default Ember.Service.extend(PouchAdapterUtils, {\nlet mainDB = this.get('mainDB');\nmainDB.get(docId, (err, doc) => {\nif (err) {\n- this._pouchError(reject)(err);\n+ reject(this.handleErrorResponse(err));\n} else {\nresolve(doc);\n}\n@@ -168,6 +168,25 @@ export default Ember.Service.extend(PouchAdapterUtils, {\n});\n},\n+ getDBInfo() {\n+ let mainDB = this.get('mainDB');\n+ return mainDB.info();\n+ },\n+\n+ handleErrorResponse(err) {\n+ if (!err.status) {\n+ if (err.errors && err.errors.length > 0) {\n+ err.status = parseInt(err.errors[0].status);\n+ }\n+ }\n+ if (err.status === 401 || err.status === 403) {\n+ let detailedMessage = JSON.stringify(err, null, 2);\n+ return new UnauthorizedError(err, detailedMessage);\n+ } else {\n+ return err;\n+ }\n+ },\n+\n_mapPouchData(rows) {\nlet mappedRows = [];\nif (rows) {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/users/edit/controller.js",
"new_path": "app/users/edit/controller.js",
"diff": "@@ -7,7 +7,7 @@ export default AbstractEditController.extend(UserRoles, {\nusersController: Ember.inject.controller('users/index'),\nupdateCapability: 'add_user',\n- users: Ember.computed.alias('usersController.model'),\n+ users: null,\nactions: {\nupdate() {\n@@ -38,9 +38,9 @@ export default AbstractEditController.extend(UserRoles, {\n}\nupdateModel.set('userPrefix', prefix);\n}\n- updateModel.save().then(function() {\n+ updateModel.save().then(() => {\nthis.displayAlert(this.get('i18n').t('messages.userSaved'), this.get('i18n').t('messages.userHasBeenSaved'));\n- }.bind(this));\n+ }).catch((error) => this.send('error', error));\n}\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/users/edit/route.js",
"new_path": "app/users/edit/route.js",
"diff": "import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\nimport Ember from 'ember';\nimport { translationMacro as t } from 'ember-i18n';\n+\n+const { set } = Ember;\n+\nexport default AbstractEditRoute.extend({\neditTitle: t('labels.editUser'),\nmodelName: 'user',\n@@ -10,5 +13,12 @@ export default AbstractEditRoute.extend({\nreturn Ember.RSVP.resolve({\nroles: ['Data Entry', 'user']\n});\n+ },\n+\n+ setupController(controller, model) {\n+ this._super(controller, model);\n+ this.store.findAll('user').then(function(users) {\n+ set(controller, 'users', users);\n+ }).catch((err) => this.send('error', err));\n}\n});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Make sure admin works with user timeout
Fixes #930 |
288,284 | 03.02.2017 15:23:37 | 18,000 | a786848ee0bb6df89366a3cea51030631bfd1792 | Updated to ember-cli-stylelint 0.9.1 | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"broccoli-manifest\": \"0.0.7\",\n\"broccoli-merge-trees\": \"^1.1.1\",\n\"broccoli-serviceworker\": \"0.1.4\",\n- \"broccoli-stylelint\": \"billybonks/broccoli-stylelint\",\n\"ember-ajax\": \"2.5.2\",\n\"ember-browserify\": \"^1.1.12\",\n\"ember-cli\": \"2.10.0\",\n\"ember-cli-release\": \"^0.2.9\",\n\"ember-cli-sass\": \"^5.2.1\",\n\"ember-cli-sri\": \"^2.1.0\",\n- \"ember-cli-stylelint\": \"0.9.0\",\n+ \"ember-cli-stylelint\": \"0.9.1\",\n\"ember-cli-template-lint\": \"0.4.12\",\n\"ember-cli-test-loader\": \"^1.1.0\",\n\"ember-cli-uglify\": \"^1.2.0\",\n\"pouchdb-core\": \"^6.0.7\",\n\"pouchdb-list\": \"^1.1.0\",\n\"request\": \"2.79.0\",\n- \"stylelint\": \"7.6.0\",\n+ \"stylelint\": \"~7.7.1\",\n\"stylelint-config-concentric\": \"1.0.6\",\n\"stylelint-declaration-use-variable\": \"1.6.0\",\n\"stylelint-scss\": \"1.3.4\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Updated to ember-cli-stylelint 0.9.1 |
288,284 | 03.02.2017 15:34:00 | 18,000 | e33ff61c8722b509c42aa2e4009b8abaa57a4e91 | Updated to stylelint-scss 1.4.1 | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"stylelint\": \"~7.7.1\",\n\"stylelint-config-concentric\": \"1.0.6\",\n\"stylelint-declaration-use-variable\": \"1.6.0\",\n- \"stylelint-scss\": \"1.4.0\",\n+ \"stylelint-scss\": \"1.4.1\",\n\"uuid\": \"^3.0.0\"\n},\n\"ember-addon\": {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Updated to stylelint-scss 1.4.1 |
288,284 | 06.02.2017 11:53:34 | 18,000 | db002b9fc48744aff92f1342b78da9942c934b8b | Fixed error in theater scheduling test | [
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/appointments-test.js",
"new_path": "tests/acceptance/appointments-test.js",
"diff": "@@ -183,8 +183,12 @@ test('Appointment calendar', function(assert) {\ntest('Theater scheduling', function(assert) {\nrunWithPouchDump('appointments', function() {\nauthenticateUser();\n- let later = moment().add(2, 'hours');\n- let today = moment().add(1, 'hours');\n+ let later = moment();\n+ later.hour(11);\n+ later.minute(30);\n+ let today = moment();\n+ today.hour(10);\n+ today.minute(30);\nlet startTime = today.format(TIME_FORMAT);\nlet endTime = later.format(TIME_FORMAT);\nlet timeString = `${startTime} - ${endTime}`;\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed error in theater scheduling test |
288,284 | 06.02.2017 13:04:12 | 18,000 | 424b56addb1dbb50aef7500218a3a72176a97fac | Updated ember-cli-sass to 6.1.1 | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"ember-cli-moment-shim\": \"3.0.1\",\n\"ember-cli-qunit\": \"^3.0.1\",\n\"ember-cli-release\": \"^0.2.9\",\n- \"ember-cli-sass\": \"^6.0.0\",\n+ \"ember-cli-sass\": \"^6.1.1\",\n\"ember-cli-sri\": \"^2.1.0\",\n\"ember-cli-stylelint\": \"0.9.1\",\n\"ember-cli-template-lint\": \"0.4.12\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Updated ember-cli-sass to 6.1.1 |
288,284 | 15.02.2017 09:31:22 | 18,000 | 225bcff09898de4faabde82be2b3228023f89548 | Fix for load db screen not loading. | [
{
"change_type": "MODIFY",
"old_path": "app/routes/abstract-edit-route.js",
"new_path": "app/routes/abstract-edit-route.js",
"diff": "import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';\nimport Ember from 'ember';\n+\n+const { get } = Ember;\n+\nexport default Ember.Route.extend(AuthenticatedRouteMixin, {\neditTitle: null,\nhideNewButton: false,\n@@ -10,7 +13,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {\nreturn new Ember.RSVP.Promise(function(resolve) {\nthis.generateId().then(function(newId) {\nthis.getNewData(params).then(function(data) {\n- let modelName = this.get('modelName');\n+ let modelName = get(this, 'modelName');\nif (newId) {\ndata.id = newId;\n}\n@@ -25,7 +28,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {\n},\nidParam: function() {\n- let modelName = this.get('modelName');\n+ let modelName = get(this, 'modelName');\nreturn `${modelName}_id`;\n}.property('modelName'),\n@@ -47,15 +50,15 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {\n},\ngetScreenTitle(model) {\n- if (model.get('isNew')) {\n- return this.get('newTitle');\n+ if (get(model, 'isNew')) {\n+ return get(this, 'newTitle');\n} else {\n- return this.get('editTitle');\n+ return get(this, 'editTitle');\n}\n},\nmodel(params) {\n- let idParam = this.get('idParam');\n+ let idParam = get(this, 'idParam');\nif (!Ember.isEmpty(idParam) && params[idParam] === 'new') {\nreturn this._createNewRecord(params);\n} else {\n@@ -66,7 +69,7 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {\nsetupController(controller, model) {\nlet sectionDetails = {};\nsectionDetails.currentScreenTitle = this.getScreenTitle(model);\n- if (this.get('hideNewButton')) {\n+ if (get(this, 'hideNewButton')) {\nsectionDetails.newButtonAction = null;\n}\nthis.send('setSectionHeader', sectionDetails);\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fix for load db screen not loading. |
288,284 | 15.02.2017 12:19:36 | 18,000 | 9d0c479b6292d1887f40086aa57f9e6696c1b7ef | Make sure outPatient flag gets properly set. | [
{
"change_type": "MODIFY",
"old_path": "app/visits/edit/controller.js",
"new_path": "app/visits/edit/controller.js",
"diff": "@@ -267,14 +267,19 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn\nmessage: 'creating new patient first'\n});\n}\n+ let outPatient = false;\nlet visitType = newVisit.get('visitType');\nlet visitStatus;\nif (visitType === 'Admission') {\nvisitStatus = VisitStatus.ADMITTED;\n} else {\n+ outPatient = true;\nvisitStatus = VisitStatus.CHECKED_IN;\n}\n- newVisit.set('status', visitStatus);\n+ newVisit.setProperties({\n+ outPatient,\n+ status: visitStatus\n+ });\nif (this.get('model.checkIn')) {\nthis._saveAssociatedAppointment(newVisit).then(() => {\nthis.saveNewDiagnoses().then(resolve, reject);\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Make sure outPatient flag gets properly set. |
288,284 | 16.02.2017 14:33:36 | 18,000 | cfbbb351523d6769522dc54467ad79eb227bb3f8 | Fixed importing of lookup lists
Fixes | [
{
"change_type": "MODIFY",
"old_path": "app/admin/lookup/controller.js",
"new_path": "app/admin/lookup/controller.js",
"diff": "import Ember from 'ember';\nimport BillingCategories from 'hospitalrun/mixins/billing-categories';\n+import csvParse from 'npm:csv-parse';\nimport ModalHelper from 'hospitalrun/mixins/modal-helper';\nimport InventoryTypeList from 'hospitalrun/mixins/inventory-type-list';\nimport UnitTypes from 'hospitalrun/mixins/unit-types';\n@@ -7,7 +8,7 @@ import VisitTypes from 'hospitalrun/mixins/visit-types';\nimport { EKMixin, keyDown } from 'ember-keyboard';\nconst {\n- computed\n+ computed, get\n} = Ember;\nexport default Ember.Controller.extend(BillingCategories, EKMixin,\n@@ -291,6 +292,31 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,\nreturn true;\n},\n+ _importLookupList(file) {\n+ let fileSystem = get(this, 'fileSystem');\n+ let lookupTypeList = get(this, 'lookupTypeList');\n+ let lookupValues = get(lookupTypeList, 'value');\n+ fileSystem.fileToString(file).then((values) => {\n+ csvParse(values, { trim: true }, (err, data) =>{\n+ data.forEach((row) => {\n+ let [newValue] = row;\n+ if (!lookupValues.includes(newValue)) {\n+ lookupValues.addObject(newValue);\n+ }\n+ });\n+ lookupValues.sort();\n+ let i18n = get(this, 'i18n');\n+ let message = i18n.t('admin.lookup.alertImportListSaveMessage');\n+ let title = i18n.t('admin.lookup.alertImportListSaveTitle');\n+ lookupTypeList.save().then(() => {\n+ this.displayAlert(title, message);\n+ this.set('importFile');\n+ this.set('model.importFileName');\n+ });\n+ });\n+ });\n+ },\n+\n_sortValues(a, b) {\nreturn Ember.compare(a.toLowerCase(), b.toLowerCase());\n},\n@@ -335,35 +361,14 @@ export default Ember.Controller.extend(BillingCategories, EKMixin,\n}\n},\nimportList() {\n- let fileSystem = this.get('fileSystem');\nlet fileToImport = this.get('importFile');\n- let lookupTypeList = this.get('lookupTypeList');\nif (!fileToImport || !fileToImport.type) {\nthis.displayAlert(\nthis.get('i18n').t('admin.lookup.alertImportListTitle'),\nthis.get('i18n').t('admin.lookup.alertImportListMessage')\n);\n} else {\n- fileSystem.fileToDataURL(fileToImport).then(function(fileDataUrl) {\n- let dataUrlParts = fileDataUrl.split(',');\n- lookupTypeList.setProperties({\n- _attachments: {\n- file: {\n- content_type: fileToImport.type,\n- data: dataUrlParts[1]\n- }\n- },\n- importFile: true\n- });\n- lookupTypeList.save().then(function() {\n- this.displayAlert(\n- this.get('i18n').t('admin.lookup.alertImportListSaveTitle'),\n- this.get('i18n').t('admin.lookup.alertImportListSaveMessage'),\n- 'refreshLookupLists');\n- this.set('importFile');\n- this.set('model.importFileName');\n- }.bind(this));\n- }.bind(this));\n+ this._importLookupList(fileToImport);\n}\n},\nupdateList() {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/admin/lookup/route.js",
"new_path": "app/admin/lookup/route.js",
"diff": "@@ -14,9 +14,6 @@ export default AbstractIndexRoute.extend({\nactions: {\ndeleteValue(value) {\nthis.controller.send('deleteValue', value);\n- },\n- refreshLookupLists() {\n- this.refresh();\n}\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/models/lookup.js",
"new_path": "app/models/lookup.js",
"diff": "import { Model } from 'ember-pouch';\nimport DS from 'ember-data';\n+\n+const { attr } = DS;\n+\nexport default Model.extend({\n- _attachments: DS.attr(), // Temporarily store file as attachment until it gets uploaded to the server\n- importFile: DS.attr('boolean', { defaultValue: false }),\n- value: DS.attr(''),\n- organizeByType: DS.attr('boolean'),\n- userCanAdd: DS.attr('boolean')\n+ organizeByType: attr('boolean'),\n+ userCanAdd: attr('boolean'),\n+ value: attr('')\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"broccoli-manifest\": \"0.0.7\",\n\"broccoli-merge-trees\": \"^1.1.1\",\n\"broccoli-serviceworker\": \"0.1.4\",\n+ \"csv-parse\": \"^1.2.0\",\n\"ember-ajax\": \"2.5.4\",\n\"ember-browserify\": \"^1.1.12\",\n\"ember-cli\": \"2.10.0\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed importing of lookup lists
Fixes #921 |
288,332 | 22.02.2017 05:13:44 | -28,800 | e023b78ecd80236575a7aaebea609f8fb0461dfe | refactor patients model translation | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/calendar/template.hbs",
"new_path": "app/appointments/calendar/template.hbs",
"diff": "{{#em-form model=model submitButton=false}}\n<div class=\"row\">\n{{em-select class=\"col-sm-3 form-input-group\"\n- label=(t \"labels.status\")\n+ label=(t \"models.appointment.labels.status\")\nproperty=\"selectedStatus\"\ncontent=appointmentStatusesWithEmpty\n}}\n{{em-select class=\"col-sm-3 form-input-group\"\n- label=(t \"labels.type\")\n+ label=(t \"models.appointment.labels.type\")\nproperty=\"selectedAppointmentType\"\ncontent=visitTypesWithEmpty\n}}\n{{em-select class=\"col-sm-3 form-input-group\"\n- label=(t 'labels.with')\n+ label=(t 'models.appointment.labels.provider')\nproperty=\"selectedProvider\"\ncontent=physicianList\n}}\n{{em-select class=\"col-sm-3 form-input-group\"\n- label=(t 'labels.location')\n+ label=(t 'models.appointment.labels.location')\nproperty=\"selectedLocation\"\ncontent=locationList\n}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/edit/template.hbs",
"new_path": "app/appointments/edit/template.hbs",
"diff": "{{#edit-panel editPanelProps=editPanelProps}}\n{{#em-form model=model submitButton=false }}\n{{#if model.selectPatient}}\n- {{patient-typeahead property=\"patientTypeAhead\" label=(t 'labels.patient') content=patientList selection=selectedPatient class=\"required test-patient-input\"}}\n+ {{patient-typeahead property=\"patientTypeAhead\" label=(t 'models.patient.names.singular') content=patientList selection=selectedPatient class=\"required test-patient-input\"}}\n{{else}}\n{{patient-summary patient=model.patient returnTo='appointments.edit' returnToContext=model.id disablePatientLink=model.isNew }}\n{{/if}}\n<div class=\"row\">\n{{#if isAdmissionAppointment}}\n- {{date-picker property=\"startDate\" label=(t 'labels.startDate') showTime=showTime class=\"col-sm-4 required test-appointment-start\"}}\n- {{date-picker property=\"endDate\" label=(t 'labels.endDate') showTime=showTime class=\"col-sm-4 required test-appointment-end\"}}\n+ {{date-picker property=\"startDate\" label=(t 'models.appointment.labels.startDate') showTime=showTime class=\"col-sm-4 required test-appointment-start\"}}\n+ {{date-picker property=\"endDate\" label=(t 'models.appointment.labels.endDate') showTime=showTime class=\"col-sm-4 required test-appointment-end\"}}\n{{else}}\n{{date-time-picker datePickerClass=\"required test-appointment-date\" label=(t 'labels.date') model=model}}\n{{/if}}\n- {{em-checkbox label=(t 'labels.allDay') property=\"allDay\" class=\"col-sm-2 appointment-all-day\"}}\n+ {{em-checkbox label=(t 'models.appointment.labels.allDay') property=\"allDay\" class=\"col-sm-2 appointment-all-day\"}}\n</div>\n{{#if (eq model.appointmentType 'Surgery')}}\n<div class=\"row\">\n{{select-or-typeahead className=\"col-sm-6 test-appointment-with\" property=\"provider\"\n- label=(t 'labels.with') list=physicianList\n+ label=(t 'models.appointment.labels.provider') list=physicianList\nselection=model.provider\n}}\n{{select-or-typeahead className=\"col-sm-6 test-appointment-location\" property=\"location\"\n- label=(t 'labels.location') list=surgeryLocationList\n+ label=(t 'models.appointment.labels.location') list=surgeryLocationList\nselection=model.location\n}}\n</div>\n{{else}}\n<div class=\"row\">\n<div class=\"form-input-group col-sm-6 required test-appointment-type\">\n- <label class=\"control-label\" for=\"startTime\">{{t 'labels.type'}}</label>\n+ <label class=\"control-label\" for=\"startTime\">{{t 'models.appointment.labels.type'}}</label>\n{{select-list\ncontent=visitTypes\noptionLabelPath='value'\n}}\n</div>\n{{select-or-typeahead className=\"col-sm-6 test-appointment-with\" property=\"provider\"\n- label=(t 'labels.with') list=physicianList\n+ label=(t 'models.appointment.labels.provider') list=physicianList\nselection=model.provider\n}}\n</div>\n<div class=\"row\">\n{{select-or-typeahead className=\"col-sm-6 test-appointment-location\" property=\"location\"\n- label=(t 'labels.location') list=visitLocationList\n+ label=(t 'models.appointment.labels.location') list=visitLocationList\nselection=model.location\n}}\n{{em-select class=\"form-input-group col-sm-3 test-appointment-status\" property=\"status\"\n- label=(t 'labels.status') content=appointmentStatuses\n+ label=(t 'models.appointment.labels.status') content=appointmentStatuses\n}}\n</div>\n{{/if}}\n- {{em-text label=(t 'labels.notes') property=\"notes\" rows=3 }}\n+ {{em-text label=(t 'models.appointment.labels.notes') property=\"notes\" rows=3 }}\n{{/em-form}}\n{{/edit-panel}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/index/template.hbs",
"new_path": "app/appointments/index/template.hbs",
"diff": "{{#item-listing paginationProps=paginationProps }}\n<table class=\"table\">\n<tr class=\"table-header\">\n- <th>{{t 'labels.date'}}</th>\n- <th>{{t 'labels.name'}}</th>\n- <th>{{t 'labels.type'}}</th>\n- <th>{{t 'labels.location'}}</th>\n- <th>{{t 'labels.provider'}}</th>\n- <th>{{t 'labels.status'}}</th>\n+ <th>{{t 'models.appointment.labels.appointmentDate'}}</th>\n+ <th>{{t 'models.patient.labels.name'}}</th>\n+ <th>{{t 'models.appointment.labels.type'}}</th>\n+ <th>{{t 'models.appointment.labels.location'}}</th>\n+ <th>{{t 'models.appointment.labels.provider'}}</th>\n+ <th>{{t 'models.appointment.labels.status'}}</th>\n<th>{{t 'labels.actions'}}</th>\n</tr>\n{{#each model as |appointment|}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/search/template.hbs",
"new_path": "app/appointments/search/template.hbs",
"diff": "<div class=\"row\">\n{{date-picker property=\"selectedStartingDate\" label=(t \"appointments.labels.selectedStartingDate\")class=\"col-sm-3\"}}\n{{em-select class=\"col-sm-3 form-input-group\" property=\"selectedStatus\"\n- label=(t \"labels.status\") content=appointmentStatusesWithEmpty\n+ label=(t \"models.appointment.labels.status\") content=appointmentStatusesWithEmpty\n}}\n- {{em-select class=\"col-sm-3 form-input-group\" label=(t \"labels.type\")\n+ {{em-select class=\"col-sm-3 form-input-group\" label=(t \"models.appointment.labels.type\")\nproperty=\"selectedAppointmentType\" content=visitTypesWithEmpty\n}}\n{{em-select class=\"col-sm-3 form-input-group\" property=\"selectedProvider\"\n- label=(t 'labels.with') content=physicianList\n+ label=(t 'models.appointment.labels.provider') content=physicianList\n}}\n</div>\n{{/em-form}}\n</div>\n<table class=\"table\">\n<tr class=\"table-header\">\n- {{#sortable-column sortBy='date' sortDesc=sortDesc sortKey=sortKey }}{{t 'labels.date'}}{{/sortable-column}}\n- <th>{{t 'labels.name'}}</th>\n- {{#sortable-column sortBy='appointmentType' sortDesc=sortDesc sortKey=sortKey }}{{t 'labels.type'}}{{/sortable-column}}\n- {{#sortable-column sortBy='location' sortDesc=sortDesc sortKey=sortKey }}{{t 'labels.location'}}{{/sortable-column}}\n- {{#sortable-column sortBy='provider' sortDesc=sortDesc sortKey=sortKey }}{{t 'labels.with'}}{{/sortable-column}}\n- {{#sortable-column sortBy='status' sortDesc=sortDesc sortKey=sortKey }}{{t 'labels.status'}}{{/sortable-column}}\n+ {{#sortable-column sortBy='date' sortDesc=sortDesc sortKey=sortKey }}{{t 'models.appointment.labels.appointmentDate'}}{{/sortable-column}}\n+ <th>{{t 'models.patient.labels.name'}}</th>\n+ {{#sortable-column sortBy='appointmentType' sortDesc=sortDesc sortKey=sortKey }}{{t 'models.appointment.labels.type'}}{{/sortable-column}}\n+ {{#sortable-column sortBy='location' sortDesc=sortDesc sortKey=sortKey }}{{t 'models.appointment.labels.location'}}{{/sortable-column}}\n+ {{#sortable-column sortBy='provider' sortDesc=sortDesc sortKey=sortKey }}{{t 'models.appointment.labels.provider'}}{{/sortable-column}}\n+ {{#sortable-column sortBy='status' sortDesc=sortDesc sortKey=sortKey }}{{t 'models.appointment.labels.status'}}{{/sortable-column}}\n<th>{{t 'labels.actions'}}</th>\n</tr>\n{{#each model as |appointment|}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/appointments/theater/template.hbs",
"new_path": "app/appointments/theater/template.hbs",
"diff": "{{#em-form model=model submitButton=false}}\n<div class=\"row\">\n{{em-select class=\"col-sm-3 form-input-group\"\n- label=(t \"labels.status\")\n+ label=(t \"models.appointment.labels.status\")\nproperty=\"selectedStatus\"\ncontent=appointmentStatusesWithEmpty\n}}\n{{em-select class=\"col-sm-3 form-input-group\"\n- label=(t 'labels.with')\n+ label=(t 'models.appointment.labels.provider')\nproperty=\"selectedProvider\"\ncontent=physicianList\n}}\n{{em-select class=\"col-sm-3 form-input-group\"\n- label=(t 'labels.location')\n+ label=(t 'models.appointment.labels.location')\nproperty=\"selectedLocation\"\ncontent=locationList\n}}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/locales/en/translations.js",
"new_path": "app/locales/en/translations.js",
"diff": "@@ -1261,5 +1261,30 @@ export default {\ntitles: {\nsessionExpired: 'Session Expired'\n}\n+ },\n+ models: {\n+ appointment: {\n+ labels: {\n+ status: 'First Name',\n+ appointmentType: 'Type',\n+ provider: 'With',\n+ location: 'Location',\n+ patient: 'Patient',\n+ startDate: 'Start Date',\n+ endDate: 'End Date',\n+ allDay: 'All Day',\n+ type: 'Type',\n+ notes: 'Notes',\n+ appointmentDate: 'Date'\n+ }\n+ },\n+ patient: {\n+ labels: {\n+ name: 'Name'\n+ },\n+ names: {\n+ singular: 'Patient'\n+ }\n+ }\n}\n};\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | refactor patients model translation (#951) |
288,284 | 22.02.2017 12:05:53 | 18,000 | 0990ad1919c6ff2666dd767260cec78185204001 | Change how "new" routes work
Makes sure that if user redirects to url the patient is properly
selected. | [
{
"change_type": "MODIFY",
"old_path": "app/appointments/edit/route.js",
"new_path": "app/appointments/edit/route.js",
"diff": "import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\n+import AddToPatientRoute from 'hospitalrun/mixins/add-to-patient-route';\nimport Ember from 'ember';\nimport moment from 'moment';\nimport PatientListRoute from 'hospitalrun/mixins/patient-list-route';\n@@ -6,12 +7,13 @@ import { translationMacro as t } from 'ember-i18n';\nconst {\nget,\n+ isEmpty,\nRSVP: {\nresolve\n}\n} = Ember;\n-export default AbstractEditRoute.extend(PatientListRoute, {\n+export default AbstractEditRoute.extend(AddToPatientRoute, PatientListRoute, {\neditTitle: t('appointments.editTitle'),\nmodelName: 'appointment',\nnewButtonText: t('appointments.buttons.newButton'),\n@@ -26,7 +28,7 @@ export default AbstractEditRoute.extend(PatientListRoute, {\nselectPatient: true,\nstartDate: new Date()\n};\n- if (!Ember.isEmpty(idParam) && params[idParam] === 'newsurgery') {\n+ if (!isEmpty(idParam) && params[idParam] === 'newsurgery') {\nnewData.appointmentType = 'Surgery';\nnewData.allDay = false;\nnewData.endDate = moment().add('1', 'hours').toDate();\n@@ -53,10 +55,16 @@ export default AbstractEditRoute.extend(PatientListRoute, {\nmodel(params) {\nlet idParam = this.get('idParam');\nlet modelId = params[idParam];\n- if (!Ember.isEmpty(idParam) && (modelId.indexOf('new') === 0)) {\n+ if (!isEmpty(idParam) && (modelId.indexOf('new') === 0)) {\n+ if (!isEmpty(params.forPatientId)) {\n+ let modelPromise = this._super(params);\n+ return this._setPatientOnModel(modelPromise, params.forPatientId);\n+ } else {\nreturn this._createNewRecord(params);\n+ }\n} else {\nreturn this._super(params);\n}\n}\n+\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/imaging/edit/route.js",
"new_path": "app/imaging/edit/route.js",
"diff": "import { translationMacro as t } from 'ember-i18n';\nimport AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\n+import AddToPatientRoute from 'hospitalrun/mixins/add-to-patient-route';\nimport ChargeRoute from 'hospitalrun/mixins/charge-route';\nimport Ember from 'ember';\nimport moment from 'moment';\nimport PatientListRoute from 'hospitalrun/mixins/patient-list-route';\n-export default AbstractEditRoute.extend(ChargeRoute, PatientListRoute, {\n+export default AbstractEditRoute.extend(AddToPatientRoute, ChargeRoute, PatientListRoute, {\neditTitle: t('imaging.titles.editTitle'),\nmodelName: 'imaging',\nnewTitle: t('imaging.titles.editTitle'),\n"
},
{
"change_type": "MODIFY",
"old_path": "app/labs/edit/route.js",
"new_path": "app/labs/edit/route.js",
"diff": "-import Ember from 'ember';\nimport AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\n+import AddToPatientRoute from 'hospitalrun/mixins/add-to-patient-route';\nimport ChargeRoute from 'hospitalrun/mixins/charge-route';\n+import Ember from 'ember';\nimport moment from 'moment';\nimport PatientListRoute from 'hospitalrun/mixins/patient-list-route';\nimport { translationMacro as t } from 'ember-i18n';\n-export default AbstractEditRoute.extend(ChargeRoute, PatientListRoute, {\n+export default AbstractEditRoute.extend(AddToPatientRoute, ChargeRoute, PatientListRoute, {\neditTitle: t('labs.editTitle'),\nmodelName: 'lab',\nnewTitle: t('labs.newTitle'),\n"
},
{
"change_type": "MODIFY",
"old_path": "app/medication/edit/route.js",
"new_path": "app/medication/edit/route.js",
"diff": "import { translationMacro as t } from 'ember-i18n';\nimport AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\n+import AddToPatientRoute from 'hospitalrun/mixins/add-to-patient-route';\nimport Ember from 'ember';\nimport FulfillRequest from 'hospitalrun/mixins/fulfill-request';\nimport InventoryLocations from 'hospitalrun/mixins/inventory-locations'; // inventory-locations mixin is needed for fulfill-request mixin!\nimport moment from 'moment';\nimport PatientListRoute from 'hospitalrun/mixins/patient-list-route';\nimport uuid from 'npm:uuid';\n-export default AbstractEditRoute.extend(FulfillRequest, InventoryLocations, PatientListRoute, {\n+\n+const { isEmpty } = Ember;\n+\n+export default AbstractEditRoute.extend(AddToPatientRoute, FulfillRequest, InventoryLocations, PatientListRoute, {\neditTitle: t('medication.titles.editMedicationRequest'),\nmodelName: 'medication',\nnewTitle: t('medication.titles.newMedicationRequest'),\n@@ -27,8 +31,13 @@ export default AbstractEditRoute.extend(FulfillRequest, InventoryLocations, Pati\nmodel(params) {\nlet idParam = this.get('idParam');\n+ let modelPromise = this._super(params);\nif (!Ember.isEmpty(idParam) && params[idParam] === 'new' || params[idParam] === 'dispense') {\n+ if (!isEmpty(params.forPatientId)) {\n+ return this._setPatientOnModel(modelPromise, params.forPatientId);\n+ } else {\nreturn this._createNewRecord(params);\n+ }\n} else {\nreturn this._super(params);\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "app/mixins/add-to-patient-route.js",
"diff": "+import Ember from 'ember';\n+\n+const { get, isEmpty, Mixin } = Ember;\n+\n+export default Mixin.create({\n+ queryParams: {\n+ forPatientId: {\n+ refreshModel: false\n+ }\n+ },\n+\n+ model(params) {\n+ let idParam = get(this, 'idParam');\n+ let modelPromise = this._super(params);\n+ if (!isEmpty(params.forPatientId) && params[idParam] === 'new') {\n+ return this._setPatientOnModel(modelPromise, params.forPatientId);\n+ } else {\n+ return modelPromise;\n+ }\n+ },\n+\n+ /**\n+ * Resolves the model promise and then sets the patient information on the model.\n+ */\n+ _setPatientOnModel(modelPromise, patientId) {\n+ let store = get(this, 'store');\n+ return modelPromise.then((model) => {\n+ return store.find('patient', patientId).then((patient) => {\n+ model.set('patient', patient);\n+ model.set('returnToPatient', patientId);\n+ model.set('selectPatient', false);\n+ return model;\n+ });\n+ });\n+ }\n+});\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/edit/controller.js",
"new_path": "app/patients/edit/controller.js",
"diff": "@@ -540,16 +540,16 @@ export default AbstractEditController.extend(BloodTypes, DiagnosisActions, Retur\n},\n_addChildObject(route, afterTransition) {\n- this.transitionToRoute(route, 'new').then(function(newRoute) {\n- newRoute.currentModel.setProperties({\n- patient: this.get('model'),\n- returnToPatient: this.get('model.id'),\n- selectPatient: false\n- });\n+ let options = {\n+ queryParams: {\n+ forPatientId: this.get('model.id')\n+ }\n+ };\n+ this.transitionToRoute(route, 'new', options).then((newRoute) => {\nif (afterTransition) {\nafterTransition(newRoute);\n}\n- }.bind(this));\n+ });\n},\n_showEditSocial(editAttributes, modelName, route) {\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/operative-plan/route.js",
"new_path": "app/patients/operative-plan/route.js",
"diff": "import AbstractEditRoute from 'hospitalrun/routes/abstract-edit-route';\n+import AddToPatientRoute from 'hospitalrun/mixins/add-to-patient-route';\nimport Ember from 'ember';\nimport moment from 'moment';\nimport { translationMacro as t } from 'ember-i18n';\n@@ -8,7 +9,7 @@ const {\ninject\n} = Ember;\n-export default AbstractEditRoute.extend({\n+export default AbstractEditRoute.extend(AddToPatientRoute, {\neditTitle: t('operativePlan.titles.editTitle'),\nmodelName: 'operative-plan',\nnewTitle: t('operativePlan.titles.newTitle'),\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/operative-test.js",
"new_path": "tests/acceptance/operative-test.js",
"diff": "@@ -56,7 +56,7 @@ test('Plan and report creation', function(assert) {\nwaitToAppear('span.secondary-diagnosis:contains(Tennis Elbow)');\n});\nandThen(() =>{\n- assert.equal(currentURL(), '/patients/operative-plan/new', 'New operative plan URL is correct');\n+ assert.equal(currentURL(), '/patients/operative-plan/new?forPatientId=C87BFCB2-F772-7A7B-8FC7-AD00C018C32A', 'New operative plan URL is correct');\nassert.equal(find('.patient-name .ps-info-data').text(), 'Joe Bagadonuts', 'Joe Bagadonuts patient header displays');\nassert.equal(find('.view-current-title').text(), 'New Operative Plan', 'New operative plan title is correct');\nassert.equal(find('span.primary-diagnosis:contains(Broken Arm)').length, 1, 'Primary diagnosis appears as read only');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Change how "new" routes work
Makes sure that if user redirects to url the patient is properly
selected. |
288,284 | 22.02.2017 12:06:10 | 18,000 | 917cfdf301cf9b1c2b565f4264e141eb9fdf5359 | Move back to official release of ember-rapid-forms. | [
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"ember-load-initializers\": \"^0.6.0\",\n\"ember-pouch\": \"4.2.1\",\n\"ember-radio-buttons\": \"^4.0.1\",\n- \"ember-rapid-forms\": \"GCorbel/ember-rapid-forms#26229804a2c430bbdf1ffb6bab8fb53af17bb3a4\",\n+ \"ember-rapid-forms\": \"1.0.0-beta10\",\n\"ember-resolver\": \"^2.0.3\",\n\"ember-select-list\": \"0.9.5\",\n\"ember-simple-auth\": \"^1.1.0\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Move back to official release of ember-rapid-forms. |
288,344 | 25.02.2017 16:07:01 | -28,800 | 4503f7729e80eb5bb5d9cf019c042f32e9f42862 | Move modal alert to inline | [
{
"change_type": "MODIFY",
"old_path": "app/patients/edit/controller.js",
"new_path": "app/patients/edit/controller.js",
"diff": "@@ -645,13 +645,9 @@ export default AbstractEditController.extend(BloodTypes, DiagnosisActions, Retur\nafterUpdate(record) {\nthis._updateSequence(record).then(() => {\n- this.send('openModal', 'dialog', Ember.Object.create({\n- title: this.get('i18n').t('patients.titles.savedPatient'),\n- message: this.get('i18n').t('patients.messages.savedPatient', record),\n- updateButtonAction: 'returnToPatient',\n- updateButtonText: this.get('i18n').t('patients.buttons.backToPatients'),\n- cancelButtonText: this.get('i18n').t('buttons.close')\n- }));\n+ $('.message').show();\n+ $('.message').text(this.get('i18n').t('patients.messages.savedPatient', record));\n+ $(\".message\").delay(3000).fadeOut(100);\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "app/patients/edit/template.hbs",
"new_path": "app/patients/edit/template.hbs",
"diff": "{{/unless}}\n</div>\n{{/em-form}}\n+ <div class=\"alert alert-success message\" style=\"display:none;\"></div>\n{{/edit-panel}}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Move modal alert to inline |
288,284 | 11.03.2017 11:31:55 | 18,000 | 1c0e2d0be91cc4b09ac5891eec8e63b1442da4ec | Try to get tests to work better in Travis | [
{
"change_type": "MODIFY",
"old_path": ".travis.yml",
"new_path": ".travis.yml",
"diff": "@@ -10,20 +10,19 @@ branches:\nsudo: false\ncache:\n- directories\n+ directories:\n- $HOME/.npm\n- $HOME/.cache # includes bowers cache\nbefore_install:\n- npm config set spin false\n- - npm install -g bower\n+ - npm install -g bower phantomjs-prebuilt\n- bower --version\n- - npm install phantomjs-prebuilt\n- - node_modules/phantomjs-prebuilt/bin/phantomjs --version\n+ - phantomjs --version\ninstall:\n- npm install\n- bower install\nscript:\n- - npm test\n+ - travis_retry npm test\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/operative-test.js",
"new_path": "tests/acceptance/operative-test.js",
"diff": "@@ -35,6 +35,8 @@ test('Plan and report creation', function(assert) {\nandThen(() => {\nassert.equal(find('.modal-title').text(), 'Add Diagnosis', 'Add Diagnosis dialog displays');\nfillIn('.diagnosis-text input', 'Broken Arm');\n+ });\n+ andThen(() => {\nclick('.modal-footer button:contains(Add)');\n});\nandThen(() => {\n@@ -50,6 +52,8 @@ test('Plan and report creation', function(assert) {\nassert.equal(find('.modal-title').text(), 'Add Diagnosis', 'Add Diagnosis dialog displays');\nfillIn('.diagnosis-text input', 'Tennis Elbow');\nclick('.secondary-diagnosis input');\n+ });\n+ andThen(() => {\nclick('.modal-footer button:contains(Add)');\n});\nandThen(() => {\n@@ -69,12 +73,16 @@ test('Plan and report creation', function(assert) {\nassert.equal(find('span.secondary-diagnosis:contains(Tennis Elbow)').length, 1, 'Secondary diagnosis appears as read only');\nfillIn('.operation-description textarea', OPERATION_DESCRIPTION);\ntypeAheadFillIn('.procedure-description', PROCEDURE_HIP);\n+ });\n+ andThen(() => {\nclick('button:contains(Add Procedure)');\nwaitToAppear('.procedure-listing td.procedure-description');\n});\nandThen(() => {\nassert.equal(find('.procedure-listing td.procedure-description').text(), PROCEDURE_HIP, 'Added procedure displays in procedure table');\ntypeAheadFillIn('.procedure-description', 'Delete Me');\n+ });\n+ andThen(() => {\nclick('button:contains(Add Procedure)');\nwaitToAppear('.procedure-listing td.procedure-description:contains(Delete Me)');\n});\n@@ -129,6 +137,8 @@ test('Plan and report creation', function(assert) {\nassert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_HIP})`).length, 1, `Procedure ${PROCEDURE_HIP} is copied from operative plan`);\nassert.equal(find(`.procedure-listing td.procedure-description:contains(${PROCEDURE_FIX_ARM})`).length, 1, `Procedure ${PROCEDURE_FIX_ARM} is copied from operative plan`);\ntypeAheadFillIn('.operation-assistant', 'Dr Cindy');\n+ });\n+ andThen(() => {\nclick('.panel-footer button:contains(Update)');\nwaitToAppear('.modal-dialog');\n});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Try to get tests to work better in Travis |
288,284 | 13.03.2017 16:08:51 | 14,400 | 964018d7a270024b73eef3e7b4417f269868e5aa | Fix issues with tests. | [
{
"change_type": "MODIFY",
"old_path": "config/deprecation-workflow.js",
"new_path": "config/deprecation-workflow.js",
"diff": "window.deprecationWorkflow = window.deprecationWorkflow || {};\nwindow.deprecationWorkflow.config = {\nworkflow: [\n- { handler: \"silence\", matchId: \"ember-application.injected-container\" },\n- { handler: \"silence\", matchId: \"ember-views.render-double-modify\" },\n- { handler: \"silence\", matchId: \"ember-metal.binding\" },\n- { handler: \"silence\", matchId: \"ember-views.did-init-attrs\" }\n+ { handler: 'silence', matchId: 'ember-getowner-polyfill.import' },\n+ { handler: 'silence', matchId: 'ember-metal.binding' },\n+ { handler: 'silence', matchId: 'ember-views.did-init-attrs' },\n+ { handler: 'silence', matchId: 'ds.serializer.private-should-serialize-has-many' }\n]\n};\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/incident-test.js",
"new_path": "tests/acceptance/incident-test.js",
"diff": "@@ -177,9 +177,10 @@ test('Incident creation and editing', function(assert) {\nvisit('/incident/edit/56c64d71-ba30-4271-b899-f6f6b031f589');\n});\nandThen(() => {\n+ let incidentDate = moment(1489004400000);\nassert.equal(currentURL(), '/incident/edit/56c64d71-ba30-4271-b899-f6f6b031f589', 'Incident edit url is correct');\nassert.equal(find('.sentinel-event input:checked').length, 1, 'Sentinel Event checkbox is checked');\n- assert.equal(find('.incident-date input').val(), '3/8/2017 3:20 PM', 'Date of incident displays');\n+ assert.equal(find('.incident-date input').val(), incidentDate.format(DATE_TIME_FORMAT), 'Date of incident displays');\nassert.equal(find('.incident-department .tt-input').val(), 'Reception', 'Incident department displays');\nassert.equal(find('.reported-to input').val(), 'Jane Bagadonuts', 'Reported to displays.');\nassert.equal(find('.incident-category option:selected').text().trim(), 'Accident or Injury', 'Category displays');\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/unit/controllers/abstract-edit-controller-test.js",
"new_path": "tests/unit/controllers/abstract-edit-controller-test.js",
"diff": "@@ -119,7 +119,6 @@ test('actions.update exception message', function(assert) {\nthrow new Error('Test');\n};\ncontroller.displayAlert = function stub(title, message) {\n- console.log('title for display alert is:', title);\nalertTitle = title.toString();\nalertMessage = message.toString();\n};\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fix issues with tests. |
288,284 | 15.03.2017 14:36:21 | 14,400 | 5441db8d45a204d6e542a42bc822bd8fd4c23c2c | Fixed button to display update after adding new visit. | [
{
"change_type": "MODIFY",
"old_path": "app/visits/edit/controller.js",
"new_path": "app/visits/edit/controller.js",
"diff": "@@ -141,14 +141,14 @@ export default AbstractEditController.extend(AddNewPatient, ChargeActions, Diagn\n}\n}),\n- updateButtonText: function() {\n+ updateButtonText: computed('model.{checkIn,isNew}', function() {\nlet i18n = this.get('i18n');\nif (this.get('model.checkIn')) {\nreturn i18n.t('visits.buttons.checkIn');\n} else {\nreturn this._super();\n}\n- }.property('model.checkIn'),\n+ }),\nvalidVisitTypes: function() {\nlet outPatient = this.get('model.outPatient');\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed button to display update after adding new visit. |
288,284 | 15.03.2017 15:14:11 | 14,400 | ab20e7d522a3ce7a631fa7913f1021d95aebe856 | Remove default value for print header
This information can now be set by the print header admin option. | [
{
"change_type": "MODIFY",
"old_path": "app/services/database.js",
"new_path": "app/services/database.js",
"diff": "@@ -3,10 +3,8 @@ import createPouchViews from 'hospitalrun/utils/pouch-views';\nimport List from 'npm:pouchdb-list';\nimport PouchAdapterMemory from 'npm:pouchdb-adapter-memory';\nimport UnauthorizedError from 'hospitalrun/utils/unauthorized-error';\n-import enviroment from './../config/environment';\nconst {\n- get,\nisEmpty\n} = Ember;\n@@ -22,44 +20,6 @@ export default Ember.Service.extend({\n.then((db) => {\nthis.set('mainDB', db);\nthis.set('setMainDB', true);\n- })\n- .then(() => {\n- this.createOptionHeader([enviroment.hospitalInfoDoc]);\n- });\n- },\n-\n- createOptionHeader(docs) {\n- return new Ember.RSVP.Promise((resolve, reject) => {\n- let mainDB = get(this, 'mainDB');\n- let ids = docs.map((doc) => {\n- return doc._id;\n- });\n- return mainDB.allDocs({ keys: ids })\n- .then((res) => {\n- if (res.rows) {\n- let docsToCreate = res.rows.filter((row) => {\n- return (row.error && row.error === 'not_found') || (row.value && row.value.deleted);\n- }).map((row) => {\n- return docs.find((doc) => {\n- if (doc._id === row.key) {\n- if (row.value && row.value.deleted && row.value.rev !== doc._rev) {\n- doc._rev = row.value.rev;\n- }\n- return true;\n- }\n- });\n- });\n- if (docsToCreate.length) {\n- return mainDB.bulkDocs(docsToCreate);\n- }\n- }\n- })\n- .then((res) => {\n- resolve(res);\n- })\n- .catch((err) => {\n- reject(err);\n- });\n});\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "config/environment.js",
"new_path": "config/environment.js",
"diff": "@@ -74,18 +74,5 @@ module.exports = function(environment) {\nschedulerLicenseKey: 'GPL-My-Project-Is-Open-Source'\n};\n- ENV.hospitalInfoDoc = {\n- \"_id\": \"option_2_print_header\",\n- \"_rev\": \"1-4457555eacb405267c6d3b7a53d8521d\",\n- \"data\": {\n- \"value\": {\n- \"facilityName\": \"Beit CURE International Hospital\",\n- \"headerLine1\": \"PO Box 31236\",\n- \"headerLine2\": \"Blantyre 3\",\n- \"headerLine3\": \"+265 (0) 1 871 900 / +265 (0) 1 875 015 /+265 (0) 1 873 694 / +265 (0) 999 505 212\",\n- \"logoURL\": \"https://curehospital.mw/wp-content/uploads/4/2012/11/CURE-Malawi-Logo_rgb_280_89.jpg\"\n- }\n- }\n- };\nreturn ENV;\n};\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Remove default value for print header
This information can now be set by the print header admin option. |
288,284 | 15.03.2017 15:14:46 | 14,400 | 5101d2f45c1d6d81962353ebe704129f06f20b31 | Display error in user crud
Updated to use abstract _handleError function. | [
{
"change_type": "MODIFY",
"old_path": "app/users/edit/controller.js",
"new_path": "app/users/edit/controller.js",
"diff": "@@ -48,7 +48,9 @@ export default AbstractEditController.extend(UserRoles, {\nlet sectionDetails = {};\nsectionDetails.currentScreenTitle = editTitle;\nthis.send('setSectionHeader', sectionDetails);\n- }).catch((error) => this.send('error', error));\n+ }).catch((error) => {\n+ this._handleError(error);\n+ });\n}\n}\n});\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Display error in user crud
Updated to use abstract _handleError function. |
288,284 | 15.03.2017 16:01:17 | 14,400 | c9bcdcf4c09d25a385887211a7c2dcd308ddfd8d | Fix issue not saving patient sequence on new db. | [
{
"change_type": "MODIFY",
"old_path": "app/mixins/friendly-id.js",
"new_path": "app/mixins/friendly-id.js",
"diff": "@@ -25,9 +25,11 @@ export default Ember.Mixin.create({\nvalue: 1,\nprefix\n}));\n+ return sequence.save().then((sequence) => {\nreturn this._findUnusedId(sequence, prefix, modelName);\n});\n});\n+ });\n},\nsequencePrefix() {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fix issue not saving patient sequence on new db. |
288,376 | 15.03.2017 16:04:46 | 14,400 | bd05eab5f9bd36f715e74b74af86c6447e46fe18 | Adding standAlone flag in config service | [
{
"change_type": "MODIFY",
"old_path": "app/services/config.js",
"new_path": "app/services/config.js",
"diff": "@@ -7,6 +7,7 @@ export default Ember.Service.extend({\ndatabase: inject.service(),\nsession: inject.service(),\nsessionData: Ember.computed.alias('session.data'),\n+ standAlone: false,\nsetup() {\nlet replicateConfigDB = this.replicateConfigDB.bind(this);\n@@ -14,7 +15,14 @@ export default Ember.Service.extend({\nlet db = this.createDB();\nthis.set('configDB', db);\nthis.setCurrentUser();\n+ if (window.electron) {\n+ this.set('standAlone', true);\n+ }\n+ if (this.get('standAlone') === false) {\nreturn replicateConfigDB(db).then(loadConfig);\n+ } else {\n+ return loadConfig();\n+ }\n},\ncreateDB() {\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Adding standAlone flag in config service |
288,376 | 15.03.2017 16:07:05 | 14,400 | 0579dbcea2f19d5594620a3621570001da15e889 | conditionally create the local usersDB | [
{
"change_type": "MODIFY",
"old_path": "app/services/database.js",
"new_path": "app/services/database.js",
"diff": "@@ -11,20 +11,26 @@ const {\nexport default Ember.Service.extend({\nconfig: Ember.inject.service(),\nmainDB: null, // Server DB\n+ usersDB: null, // local users database for standAlone mode\noauthHeaders: null,\nsetMainDB: false,\nsetup(configs) {\nPouchDB.plugin(List);\n- return this.createDB(configs)\n- .then((db) => {\n+ let pouchOptions = this._getOptions(configs);\n+ return this.createDB(configs, pouchOptions).then((db) => {\nthis.set('mainDB', db);\nthis.set('setMainDB', true);\n+ if (this.get('config.standAlone')) {\n+ let usersDB = new PouchDB('_users', pouchOptions);\n+ return usersDB.info().then(() => {\n+ this.set('usersDB', usersDB);\n+ });\n+ }\n});\n},\n- createDB(configs) {\n- return new Ember.RSVP.Promise((resolve, reject) => {\n+ _getOptions(configs) {\nlet pouchOptions = {};\nif (configs && configs.config_use_google_auth) {\npouchOptions.ajax = {\n@@ -47,6 +53,11 @@ export default Ember.Service.extend({\npouchOptions.ajax.headers = headers;\n}\n}\n+ return pouchOptions;\n+ },\n+\n+ createDB(configs, pouchOptions) {\n+ return new Ember.RSVP.Promise((resolve, reject) => {\nlet url = `${document.location.protocol}//${document.location.host}/db/main`;\nthis._createRemoteDB(url, pouchOptions)\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | conditionally create the local usersDB |
288,376 | 15.03.2017 16:07:54 | 14,400 | 0b9fc6a9f8699b7f22f4e33991df39ade92ec66b | if we're in standAlone mode, read the local PouchDB
changes to the user adapter for the local users database. Note that
this is not fully functioning at present. | [
{
"change_type": "MODIFY",
"old_path": "app/adapters/user.js",
"new_path": "app/adapters/user.js",
"diff": "@@ -5,6 +5,7 @@ import UserSession from 'hospitalrun/mixins/user-session';\nconst { get } = Ember;\nexport default DS.RESTAdapter.extend(UserSession, {\n+ config: Ember.inject.service(),\ndatabase: Ember.inject.service(),\nsession: Ember.inject.service(),\nendpoint: '/db/_users/',\n@@ -84,6 +85,10 @@ export default DS.RESTAdapter.extend(UserSession, {\n@returns {Promise} promise\n*/\nfind(store, type, id) {\n+ if (this.get('config.standAlone') === true) {\n+ let userKey = 'org.couchdb.user:' + id;\n+ return this._offlineFind(userKey);\n+ } else {\nlet findUrl = this.endpoint + id;\nreturn new Ember.RSVP.Promise((resolve, reject) => {\nthis.ajax(findUrl, 'GET').then(resolve, (error) => {\n@@ -91,6 +96,24 @@ export default DS.RESTAdapter.extend(UserSession, {\nreject(database.handleErrorResponse(error));\n});\n});\n+ }\n+ },\n+\n+ /**\n+ Called by find in we're in standAlone mode.\n+\n+ @method private\n+ @param {String} id - document id we are retrieving\n+ @returns {Promise} promise\n+ */\n+ _offlineFind(id) {\n+ let usersDB = get(this, 'database.usersDB');\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ usersDB.get(id).then(resolve).catch((err) => {\n+ let database = get(this, 'database');\n+ reject(database.handleErrorResponse(err));\n+ });\n+ });\n},\nheaders: function() {\n@@ -133,6 +156,9 @@ export default DS.RESTAdapter.extend(UserSession, {\ndelete data._rev;\n}\ndata = this._cleanPasswordAttrs(data);\n+ if (this.get('config.standAlone') === true) {\n+ return this._offlineUpdateRecord(data);\n+ } else {\nlet putURL = `${this.endpoint}${Ember.get(record, 'id')}`;\nreturn new Ember.RSVP.Promise((resolve, reject) => {\nthis.ajax(putURL, 'PUT', {\n@@ -142,6 +168,24 @@ export default DS.RESTAdapter.extend(UserSession, {\nreject(database.handleErrorResponse(error));\n});\n});\n+ }\n+ },\n+\n+ /**\n+ Called by updateRecord in we're in standAlone mode.\n+\n+ @method private\n+ @param {POJO} data - the data we're going to store in Pouch\n+ @returns {Promise} promise\n+ */\n+ _offlineUpdateRecord(data) {\n+ let usersDB = get(this, 'database.usersDB');\n+ return new Ember.RSVP.Promise((resolve, reject) => {\n+ usersDB.put(data).then(resolve).catch((err) => {\n+ let database = get(this, 'database');\n+ reject(database.handleErrorResponse(err));\n+ });\n+ });\n},\n/**\n@@ -165,6 +209,9 @@ export default DS.RESTAdapter.extend(UserSession, {\nstartkey: '\"org.couchdb.user\"'\n}\n};\n+ if (this.get('config.standAlone') === true) {\n+ return this._offlineFindAll(ajaxData);\n+ } else {\nlet allURL = `${this.endpoint}_all_docs`;\nreturn new Ember.RSVP.Promise((resolve, reject) => {\nthis.ajax(allURL, 'GET', ajaxData).then(resolve, (error) => {\n@@ -172,6 +219,19 @@ export default DS.RESTAdapter.extend(UserSession, {\nreject(database.handleErrorResponse(error));\n});\n});\n+ }\n+ },\n+\n+ /**\n+ Called by updateRecord in we're in standAlone mode.\n+\n+ @method private\n+ @param {POJO} data - the data we're going to search for in Pouch\n+ @returns {Promise} promise\n+ */\n+ _offlineFindAll(data) {\n+ let usersDB = get(this, 'database.usersDB');\n+ return usersDB.allDocs(data);\n},\n/**\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | if we're in standAlone mode, read the local PouchDB
changes to the user adapter for the local users database. Note that
this is not fully functioning at present. |
288,284 | 16.03.2017 21:16:18 | 14,400 | 9550d520e8656c4d444a79cad6129ec9b4b3163e | Fixed appointment calendar test
Fixes
Closes | [
{
"change_type": "MODIFY",
"old_path": "tests/acceptance/appointments-test.js",
"new_path": "tests/acceptance/appointments-test.js",
"diff": "@@ -32,7 +32,6 @@ test('visiting /appointments/missed', function(assert) {\nrunWithPouchDump('appointments', function() {\nauthenticateUser();\nlet url = '/appointments';\n- // create an apointmet scheduled in the past\nlet today = moment();\nlet tomorrow = moment().add(1, 'days');\nlet status = 'Missed';\n@@ -148,8 +147,8 @@ test('Delete an appointment', function(assert) {\ntest('Appointment calendar', function(assert) {\nrunWithPouchDump('appointments', function() {\nauthenticateUser();\n- let later = moment().add(1, 'hours');\n- let today = moment();\n+ let today = moment().startOf('day');\n+ let later = moment(today).add(1, 'hours');\nlet startTime = today.format(TIME_FORMAT);\nlet endTime = later.format(TIME_FORMAT);\nlet timeString = `${startTime} - ${endTime}`;\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fixed appointment calendar test
Fixes #976
Closes #978 |
288,284 | 17.03.2017 13:36:48 | 14,400 | d6afb52aaab691a097d839ecb41fbede0ea323c1 | Fix missing octicons | [
{
"change_type": "MODIFY",
"old_path": "vendor/octicons/octicons/octicons.css",
"new_path": "vendor/octicons/octicons/octicons.css",
"diff": "@font-face {\nfont-family: 'octicons';\n- src: url('/fonts/octicons.eot?#iefix') format('embedded-opentype'),\n- url('/fonts/octicons.woff') format('woff'),\n- url('/fonts/octicons.ttf') format('truetype'),\n- url('/fonts/octicons.svg#octicons') format('svg');\n+ src: url('fonts/octicons.eot?#iefix') format('embedded-opentype'),\n+ url('fonts/octicons.woff') format('woff'),\n+ url('fonts/octicons.ttf') format('truetype'),\n+ url('fonts/octicons.svg#octicons') format('svg');\nfont-weight: normal;\nfont-style: normal;\n}\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Fix missing octicons |
288,284 | 17.03.2017 13:37:09 | 14,400 | f4133d0a4e856f4834f4bb71ac3461faa9e39aa0 | Added pouchdb-users for electron | [
{
"change_type": "MODIFY",
"old_path": "app/services/database.js",
"new_path": "app/services/database.js",
"diff": "@@ -2,6 +2,7 @@ import Ember from 'ember';\nimport createPouchViews from 'hospitalrun/utils/pouch-views';\nimport List from 'npm:pouchdb-list';\nimport PouchAdapterMemory from 'npm:pouchdb-adapter-memory';\n+import PouchDBUsers from 'npm:pouchdb-users';\nimport UnauthorizedError from 'hospitalrun/utils/unauthorized-error';\nconst {\n@@ -17,13 +18,14 @@ export default Ember.Service.extend({\nsetup(configs) {\nPouchDB.plugin(List);\n+ PouchDB.plugin(PouchDBUsers);\nlet pouchOptions = this._getOptions(configs);\nreturn this.createDB(configs, pouchOptions).then((db) => {\nthis.set('mainDB', db);\nthis.set('setMainDB', true);\nif (this.get('config.standAlone')) {\n- let usersDB = new PouchDB('_users', pouchOptions);\n- return usersDB.info().then(() => {\n+ let usersDB = new PouchDB('_users');\n+ return usersDB.installUsersBehavior().then(() => {\nthis.set('usersDB', usersDB);\n});\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"pouchdb-adapter-memory\": \"^6.0.7\",\n\"pouchdb-core\": \"^6.0.7\",\n\"pouchdb-list\": \"^1.1.0\",\n+ \"pouchdb-users\": \"^1.0.3\",\n\"request\": \"2.79.0\",\n\"stylelint\": \"~7.7.1\",\n\"stylelint-config-concentric\": \"1.0.7\",\n"
}
] | TypeScript | MIT License | hospitalrun/hospitalrun-frontend | Added pouchdb-users for electron |
Subsets and Splits